if( p_owner->p_vout )
{
/* Hack to make sure all the the pictures are freed by the decoder */
- for( int i_pic = 0; i_pic < p_owner->p_vout->render.i_pictures; i_pic++ )
- {
- picture_t *p_pic = p_owner->p_vout->render.pp_picture[i_pic];
-
- if( p_pic->i_status == RESERVED_PICTURE )
- vout_DestroyPicture( p_owner->p_vout, p_pic );
- if( p_pic->i_refcount > 0 )
- vout_UnlinkPicture( p_owner->p_vout, p_pic );
- }
+ vout_FixLeaks( p_owner->p_vout, true );
/* We are about to die. Reattach video output to p_vlc. */
vout_Request( p_dec, p_owner->p_vout, NULL );
DecoderSignalBuffering( p_dec, true );
/* Check the decoder doesn't leak pictures */
- vout_FixLeaks( p_owner->p_vout );
+ vout_FixLeaks( p_owner->p_vout, false );
msleep( VOUT_OUTMEM_SLEEP );
}
}
vlc_mutex_unlock( &p_vout->picture_lock );
}
-void vout_FixLeaks( vout_thread_t *p_vout )
+void vout_FixLeaks( vout_thread_t *p_vout, bool b_forced )
{
int i_pic, i_ready_pic;
vlc_mutex_lock( &p_vout->picture_lock );
- for( i_pic = 0, i_ready_pic = 0; i_pic < p_vout->render.i_pictures; i_pic++ )
+ for( i_pic = 0, i_ready_pic = 0; i_pic < p_vout->render.i_pictures && !b_forced; i_pic++ )
{
const picture_t *p_pic = p_vout->render.pp_picture[i_pic];
break;
}
}
- if( i_pic < p_vout->render.i_pictures )
+ if( i_pic < p_vout->render.i_pictures && !b_forced )
{
vlc_mutex_unlock( &p_vout->picture_lock );
return;
/* Too many pictures are still referenced, there is probably a bug
* with the decoder */
- msg_Err( p_vout, "pictures leaked, resetting the heap" );
+ if( !b_forced )
+ msg_Err( p_vout, "pictures leaked, resetting the heap" );
/* Just free all the pictures */
for( i_pic = 0; i_pic < p_vout->render.i_pictures; i_pic++ )
*
* XXX This function is there to workaround bugs in decoder
*/
-void vout_FixLeaks( vout_thread_t *p_vout );
+void vout_FixLeaks( vout_thread_t *p_vout, bool b_forced );
/**
* This functions will drop a picture retreived by vout_CreatePicture.