decoder: h265: fix to release all dpb pictures

Without this, all dpb pictures are not released during flush,
because we used the global dpb_count variable for checking the
dpb fullness which get decremented in dpb_remove_index()
routine during each loop iteration.

https://bugzilla.gnome.org/show_bug.cgi?id=767934
This commit is contained in:
Hyunjun Ko 2016-06-22 15:11:56 +03:00 committed by Sreerenj Balachandran
parent c5681cff6a
commit 05cf583c97

View file

@ -622,6 +622,15 @@ get_max_dec_frame_buffering (GstH265SPS * sps)
(sps->max_dec_pic_buffering_minus1[sps->max_sub_layers_minus1] + 1));
}
static void
dpb_remove_all (GstVaapiDecoderH265 * decoder)
{
GstVaapiDecoderH265Private *const priv = &decoder->priv;
while (priv->dpb_count > 0)
gst_vaapi_frame_store_replace (&priv->dpb[--priv->dpb_count], NULL);
}
static void
dpb_remove_index (GstVaapiDecoderH265 * decoder, gint index)
{
@ -745,9 +754,7 @@ dpb_clear (GstVaapiDecoderH265 * decoder, gboolean hard_flush)
guint i;
if (hard_flush) {
for (i = 0; i < priv->dpb_count; i++)
dpb_remove_index (decoder, i);
priv->dpb_count = 0;
dpb_remove_all (decoder);
} else {
/* Remove unused pictures from DPB */
i = 0;