]> git.sesse.net Git - vlc/commitdiff
Fixed picture leaks when unlinking a non displayed picture.
authorLaurent Aimar <fenrir@videolan.org>
Wed, 3 Mar 2010 21:10:34 +0000 (22:10 +0100)
committerLaurent Aimar <fenrir@videolan.org>
Wed, 3 Mar 2010 21:14:40 +0000 (22:14 +0100)
src/input/decoder.c
src/video_output/vout_pictures.c

index 1aad25e3a9f407d30769d56fdd230d9a8211927b..2dc6404a359524b1874f33f2925861fb4ce683bb 100644 (file)
@@ -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;
index 4625917c6ebd9835f4549fd1734ececb8553c40e..9327a4b28b7a4db306ab9545de98ed01017034e0 100644 (file)
@@ -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 );