v4l2videoenc: Skip negotiation of profiles/level if no codec

The codec structure is optional and not used for fwht test codec. This
was leading to a crash dereferencing NULL pointer.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/650>
This commit is contained in:
Nicolas Dufresne 2020-06-25 16:47:42 -04:00
parent 57eebe8b05
commit 7bbe4653a4

View file

@ -530,6 +530,9 @@ gst_v4l2_video_enc_negotiate (GstVideoEncoder * encoder)
if (self->input_state)
return TRUE;
if (!codec)
goto done;
allowed_caps = gst_pad_get_allowed_caps (GST_VIDEO_ENCODER_SRC_PAD (encoder));
if (allowed_caps) {
@ -581,6 +584,7 @@ gst_v4l2_video_enc_negotiate (GstVideoEncoder * encoder)
if (codec->level_cid)
gst_structure_set (s, "level", G_TYPE_STRING, ctx.level, NULL);
done:
if (!GST_VIDEO_ENCODER_CLASS (parent_class)->negotiate (encoder))
return FALSE;