From 5d4257a4c448740d9ab5844757a91000bf039c60 Mon Sep 17 00:00:00 2001 From: He Junyan Date: Fri, 24 Feb 2023 21:12:40 +0800 Subject: [PATCH] mpeg2decoder: fail early if no input caps have been provided The mpeg2decoder class does not implement the ->parse() virtual function, and we always need to add the mpegvideoparse element before it. So we should set_needs_format of the decoder to TRUE, then if no parse before it, it can fail with a "not-negotiated" error early, rather than go on and generate unexpected error. Part-of: --- .../gst-plugins-bad/gst-libs/gst/codecs/gstmpeg2decoder.c | 1 + 1 file changed, 1 insertion(+) diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/codecs/gstmpeg2decoder.c b/subprojects/gst-plugins-bad/gst-libs/gst/codecs/gstmpeg2decoder.c index 7a45be6b91..d0fefce260 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/codecs/gstmpeg2decoder.c +++ b/subprojects/gst-plugins-bad/gst-libs/gst/codecs/gstmpeg2decoder.c @@ -329,6 +329,7 @@ static void gst_mpeg2_decoder_init (GstMpeg2Decoder * self) { gst_video_decoder_set_packetized (GST_VIDEO_DECODER (self), TRUE); + gst_video_decoder_set_needs_format (GST_VIDEO_DECODER (self), TRUE); self->priv = gst_mpeg2_decoder_get_instance_private (self);