decoder: hevc: Fix the dpb_add() based on C.5.2.3
authorSreerenj Balachandran <sreerenj.balachandran@intel.com>
Fri, 4 Sep 2015 19:11:10 +0000 (22:11 +0300)
committerSreerenj Balachandran <sreerenj.balachandran@intel.com>
Fri, 4 Sep 2015 19:11:10 +0000 (22:11 +0300)
Follow the spec as it is in C.5.2.3, add the decoded frame to dpb
just after the PicLatencyCnt setting of existing dpb frames.

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

gst-libs/gst/vaapi/gstvaapidecoder_h265.c

index ba2ab39..460c830 100644 (file)
@@ -826,6 +826,13 @@ dpb_add (GstVaapiDecoderH265 * decoder, GstVaapiPictureH265 * picture)
     }
   }
 
+  /* Create new frame store */
+  fs = gst_vaapi_frame_store_new (picture);
+  if (!fs)
+    return FALSE;
+  gst_vaapi_frame_store_replace (&priv->dpb[priv->dpb_count++], fs);
+  gst_vaapi_frame_store_unref (fs);
+
   if (picture->output_flag) {
     picture->output_needed = 1;
     picture->pic_latency_cnt = 0;
@@ -843,13 +850,6 @@ dpb_add (GstVaapiDecoderH265 * decoder, GstVaapiPictureH265 * picture)
           && check_latency_cnt (decoder)))
     dpb_bump (decoder, picture);
 
-  /* Create new frame store */
-  fs = gst_vaapi_frame_store_new (picture);
-  if (!fs)
-    return FALSE;
-  gst_vaapi_frame_store_replace (&priv->dpb[priv->dpb_count++], fs);
-  gst_vaapi_frame_store_unref (fs);
-
   return TRUE;
 }