From a1c92c0cb1e83d9642c23db434d1482d20903995 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Maillart?= Date: Tue, 5 Nov 2024 14:34:03 +0100 Subject: [PATCH] mpegvideoparse: do not set delta unit flag on unknown frame type When encoding an image to mpeg2 video, with something like: gst-launch-1.0 encodebin name=e profile=mpegpsmux:video/mpeg,mpegversion=2,systemstream=false ! \ filesink location=sample.mpg filesrc num-buffers=1 blocksize=$(stat -c%s sample.png) \ location=sample/dts.png ! pngdec ! e. The only frame's type is set to an invalid value 0 The consequence is that mpegvideoparse sets the delta unit flag on the buffer because it is not an I frame, then decodebin3 drops this only frame because the delta unit flag is set and the decoder receives eos before it was able to receive any encoded data Part-of: --- .../gst-plugins-bad/gst/videoparsers/gstmpegvideoparse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subprojects/gst-plugins-bad/gst/videoparsers/gstmpegvideoparse.c b/subprojects/gst-plugins-bad/gst/videoparsers/gstmpegvideoparse.c index 57a301e586..779b3af895 100644 --- a/subprojects/gst-plugins-bad/gst/videoparsers/gstmpegvideoparse.c +++ b/subprojects/gst-plugins-bad/gst/videoparsers/gstmpegvideoparse.c @@ -931,7 +931,7 @@ gst_mpegv_parse_parse_frame (GstBaseParse * parse, GstBaseParseFrame * frame) if (G_UNLIKELY (mpvparse->pichdr.pic_type == GST_MPEG_VIDEO_PICTURE_TYPE_I)) GST_BUFFER_FLAG_UNSET (buffer, GST_BUFFER_FLAG_DELTA_UNIT); - else + else if (mpvparse->pichdr.pic_type != 0) GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DELTA_UNIT); /* maybe only sequence in this buffer, though not recommended,