+
+#define p_pic p_dec->p_owner->p_vout->render.pp_picture[i_pic]
+ /* Check the decoder doesn't leak pictures */
+ for( i_pic = 0; i_pic < p_dec->p_owner->p_vout->render.i_pictures;
+ i_pic++ )
+ {
+ if( p_pic->i_status != DISPLAYED_PICTURE &&
+ p_pic->i_status != RESERVED_PICTURE ) break;
+
+ if( !p_pic->i_refcount ) break;
+ }
+ if( i_pic == p_dec->p_owner->p_vout->render.i_pictures )
+ {
+ msg_Err( p_dec, "decoder is leaking pictures, reseting the heap" );
+
+ /* Just free all the pictures */
+ for( i_pic = 0; i_pic < p_dec->p_owner->p_vout->render.i_pictures;
+ i_pic++ )
+ {
+ if( p_pic->i_status == RESERVED_PICTURE )
+ vout_DestroyPicture( p_dec->p_owner->p_vout, p_pic );
+ if( p_pic->i_refcount > 0 )
+ vout_UnlinkPicture( p_dec->p_owner->p_vout, p_pic );
+ }
+ }
+#undef p_pic
+