decoder: h264: fix marking of non-reference picture into DPB.
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>
Wed, 25 Jun 2014 20:26:32 +0000 (22:26 +0200)
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>
Wed, 25 Jun 2014 20:38:35 +0000 (22:38 +0200)
Fix search for a picture in the DPB that has a lower POC value than
the current picture. The dpb_find_lowest_poc() function will return
a picture with the lowest POC in DPB and that is marked as "needed
for output", but an additional check against the actual POC value
of the current picture is needed.

This is a regression from 1c46990.

https://bugzilla.gnome.org/show_bug.cgi?id=732130

gst-libs/gst/vaapi/gstvaapidecoder_h264.c

index 03dd51b..e223318 100644 (file)
@@ -955,8 +955,10 @@ dpb_add(GstVaapiDecoderH264 *decoder, GstVaapiPictureH264 *picture)
         if (!picture->output_flag && !StoreInterViewOnlyRefFlag)
             return TRUE;
         while (priv->dpb_count == priv->dpb_size) {
+            GstVaapiPictureH264 *found_picture;
             if (!StoreInterViewOnlyRefFlag) {
-                if (dpb_find_lowest_poc(decoder, picture, NULL) < 0)
+                if (dpb_find_lowest_poc(decoder, picture, &found_picture) < 0 ||
+                    found_picture->base.poc > picture->base.poc)
                     return dpb_output(decoder, NULL, picture);
             }
             if (!dpb_bump(decoder, picture))