codecs: mpeg2decoder: decode only if B and not closed gop
authorVíctor Manuel Jáquez Leal <vjaquez@igalia.com>
Wed, 6 Jan 2021 15:38:14 +0000 (16:38 +0100)
committerVíctor Manuel Jáquez Leal <vjaquez@igalia.com>
Wed, 6 Jan 2021 15:47:42 +0000 (16:47 +0100)
Mark as decode only if picture type is B, without previous picture in DBP and
closed_gop is 0 as might be understood in "6.3.8 Group of pictures header".

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1939>

gst-libs/gst/codecs/gstmpeg2decoder.c

index c3d9a073e7b45d9fdcd634c9e3922b9e1244bafc..18b11ed870f5caa787e20c05a8aafcc0fe4741d6 100644 (file)
@@ -732,6 +732,11 @@ gst_mpeg2_decoder_start_current_picture (GstMpeg2Decoder * decoder,
   gst_mpeg2_dpb_get_neighbours (priv->dpb, priv->current_picture,
       &prev_picture, &next_picture);
 
+  if (priv->current_picture->type == GST_MPEG_VIDEO_PICTURE_TYPE_B
+      && !prev_picture && !priv->gop.closed_gop) {
+    GST_VIDEO_CODEC_FRAME_FLAG_SET (priv->current_frame,
+        GST_VIDEO_CODEC_FRAME_FLAG_DECODE_ONLY);
+  }
 
   ret = klass->start_picture (decoder, priv->current_picture, slice,
       prev_picture, next_picture);