/* If we are not flushing now, videodecoder baseclass will hold
* GstVideoCodecFrame. Release frames manually */
if (!flush) {
- while ((picture = gst_h265_dpb_bump (priv->dpb)) != NULL) {
+ while ((picture = gst_h265_dpb_bump (priv->dpb, TRUE)) != NULL) {
GstVideoCodecFrame *frame = gst_video_decoder_get_frame (decoder,
picture->system_frame_number);
GstH265DecoderPrivate *priv = self->priv;
GstH265Picture *picture;
- while ((picture = gst_h265_dpb_bump (priv->dpb)) != NULL)
+ while ((picture = gst_h265_dpb_bump (priv->dpb, TRUE)) != NULL)
gst_h265_decoder_do_output_picture (self, picture);
gst_h265_dpb_clear (priv->dpb);
gst_h265_decoder_clear_dpb (self, FALSE);
} else {
gst_h265_dpb_delete_unused (priv->dpb);
- while ((to_output = gst_h265_dpb_bump (priv->dpb)) != NULL)
+ while ((to_output = gst_h265_dpb_bump (priv->dpb, FALSE)) != NULL)
gst_h265_decoder_do_output_picture (self, to_output);
}
} else {
priv->SpsMaxLatencyPictures,
sps->max_dec_pic_buffering_minus1[sps->max_sub_layers_minus1] +
1)) {
- to_output = gst_h265_dpb_bump (priv->dpb);
+ to_output = gst_h265_dpb_bump (priv->dpb, FALSE);
/* Something wrong... */
if (!to_output) {
while (gst_h265_dpb_needs_bump (priv->dpb,
sps->max_num_reorder_pics[sps->max_sub_layers_minus1],
priv->SpsMaxLatencyPictures, 0)) {
- GstH265Picture *to_output = gst_h265_dpb_bump (priv->dpb);
+ GstH265Picture *to_output = gst_h265_dpb_bump (priv->dpb, FALSE);
/* Something wrong... */
if (!to_output) {
/**
* gst_h265_dpb_bump:
* @dpb: a #GstH265Dpb
+ * @drain: whether draining or not
*
* Perform bumping process as defined in C.5.2.4 "Bumping" process.
+ * If @drain is %TRUE, @dpb will remove a #GstH265Picture from internal array
+ * so that returned #GstH265Picture could hold the last reference of it
*
* Returns: (nullable) (transfer full): a #GstH265Picture which is needed to be
* outputted
* Since: 1.20
*/
GstH265Picture *
-gst_h265_dpb_bump (GstH265Dpb * dpb)
+gst_h265_dpb_bump (GstH265Dpb * dpb, gboolean drain)
{
GstH265Picture *picture;
gint index;
dpb->num_output_needed--;
g_assert (dpb->num_output_needed >= 0);
- if (!picture->ref)
+ if (!picture->ref || drain)
g_array_remove_index_fast (dpb->pic_list, index);
return picture;