v4l2: videodec: Fix broken template caps

The profiles and levels were applied to the common caps instead of the copy.
That had the side effect of setting profiles/level from one CODEC onto
another. Leaving to encoder not being registered or not-negotiated errors.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/599>
This commit is contained in:
Nicolas Dufresne 2020-05-21 17:12:55 -04:00 committed by GStreamer Merge Bot
parent d93664d65d
commit 3ea71a63f6

View file

@ -1176,20 +1176,20 @@ gst_v4l2_video_enc_register (GstPlugin * plugin, GType type,
GstV4l2VideoEncCData *cdata;
GValue value = G_VALUE_INIT;
filtered_caps = gst_caps_intersect (src_caps, codec_caps);
if (codec != NULL && video_fd != -1) {
if (gst_v4l2_codec_probe_levels (codec, video_fd, &value)) {
gst_caps_set_value (src_caps, "level", &value);
gst_caps_set_value (filtered_caps, "level", &value);
g_value_unset (&value);
}
if (gst_v4l2_codec_probe_profiles (codec, video_fd, &value)) {
gst_caps_set_value (src_caps, "profile", &value);
gst_caps_set_value (filtered_caps, "profile", &value);
g_value_unset (&value);
}
}
filtered_caps = gst_caps_intersect (src_caps, codec_caps);
cdata = g_new0 (GstV4l2VideoEncCData, 1);
cdata->device = g_strdup (device_path);
cdata->sink_caps = gst_caps_ref (sink_caps);