v4l2codecdec: Fix error handling

If none of the format the HW produce is supported, the fiter will be NULL,
which would lead to assertion when trying to release it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1268>
This commit is contained in:
Nicolas Dufresne 2020-04-30 15:17:05 -04:00 committed by GStreamer Merge Bot
parent 26264163de
commit 661f0c161e
2 changed files with 10 additions and 0 deletions

View file

@ -185,6 +185,11 @@ gst_v4l2_codec_h264_dec_negotiate (GstVideoDecoder * decoder)
}
filter = gst_v4l2_decoder_enum_src_formats (self->decoder);
if (!filter) {
GST_ELEMENT_ERROR (self, CORE, NEGOTIATION,
("No supported decoder output formats"), (NULL));
return FALSE;
}
GST_DEBUG_OBJECT (self, "Supported output formats: %" GST_PTR_FORMAT, filter);
caps = gst_pad_peer_query_caps (decoder->srcpad, filter);

View file

@ -175,6 +175,11 @@ gst_v4l2_codec_vp8_dec_negotiate (GstVideoDecoder * decoder)
}
filter = gst_v4l2_decoder_enum_src_formats (self->decoder);
if (!filter) {
GST_ELEMENT_ERROR (self, CORE, NEGOTIATION,
("No supported decoder output formats"), (NULL));
return FALSE;
}
GST_DEBUG_OBJECT (self, "Supported output formats: %" GST_PTR_FORMAT, filter);
caps = gst_pad_peer_query_caps (decoder->srcpad, filter);