[vlc-commits] commit: Fixed picture leaks when unlinking a non displayed picture. ( Laurent Aimar )

git version control git at videolan.org
Wed Mar 3 22:15:07 CET 2010


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Wed Mar  3 22:10:34 2010 +0100| [a1b58a771b1bdfcca56d24541b43ce5bf6caf8b7] | committer: Laurent Aimar 

Fixed picture leaks when unlinking a non displayed picture.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a1b58a771b1bdfcca56d24541b43ce5bf6caf8b7
---

 src/input/decoder.c              |    6 ++++++
 src/video_output/vout_pictures.c |    3 ++-
 2 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/src/input/decoder.c b/src/input/decoder.c
index 1aad25e..2dc6404 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -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;
diff --git a/src/video_output/vout_pictures.c b/src/video_output/vout_pictures.c
index 4625917..9327a4b 100644
--- a/src/video_output/vout_pictures.c
+++ b/src/video_output/vout_pictures.c
@@ -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 );



More information about the vlc-commits mailing list