Commit a1b58a77 authored by Laurent Aimar's avatar Laurent Aimar

Fixed picture leaks when unlinking a non displayed picture.

parent 35a59f2d
......@@ -1342,6 +1342,7 @@ static void DecoderPlayVideo( decoder_t *p_dec, picture_t *p_picture,
vout_DropPicture( p_vout, p_picture );
return;
}
vout_LinkPicture( p_vout, p_picture );
/* */
vlc_mutex_lock( &p_owner->lock );
......@@ -1421,6 +1422,7 @@ static void DecoderPlayVideo( decoder_t *p_dec, picture_t *p_picture,
p_owner->i_last_rate = i_rate;
}
vout_DisplayPicture( p_vout, p_picture );
vout_UnlinkPicture( p_vout, p_picture );
}
else
{
......@@ -1430,6 +1432,7 @@ static void DecoderPlayVideo( decoder_t *p_dec, picture_t *p_picture,
msg_Warn( p_vout, "non-dated video buffer received" );
*pi_lost_sum += 1;
vout_UnlinkPicture( p_vout, p_picture );
vout_DropPicture( p_vout, p_picture );
}
int i_tmp_display;
......@@ -1683,7 +1686,10 @@ static void DecoderFlushBuffering( decoder_t *p_dec )
p_owner->buffer.i_count--;
if( p_owner->p_vout )
{
vout_UnlinkPicture( p_owner->p_vout, p_picture );
vout_DropPicture( p_owner->p_vout, p_picture );
}
if( !p_owner->buffer.p_picture )
p_owner->buffer.pp_picture_next = &p_owner->buffer.p_picture;
......
......@@ -311,7 +311,8 @@ void vout_UnlinkPicture( vout_thread_t *p_vout, picture_t *p_pic )
msg_Err( p_vout, "Invalid picture reference count (%p, %d)",
p_pic, p_pic->i_refcount );
if( p_pic->i_refcount == 0 && p_pic->i_status == DISPLAYED_PICTURE )
if( p_pic->i_refcount == 0 &&
( p_pic->i_status == DISPLAYED_PICTURE || p_pic->i_status == RESERVED_PICTURE ) )
DestroyPicture( p_vout, p_pic );
vlc_mutex_unlock( &p_vout->picture_lock );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment