[vlc-devel] commit: Clean up a bit subpicture release code. (Laurent Aimar )

git version control git at videolan.org
Wed Sep 17 19:11:30 CEST 2008


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Wed Sep 17 00:22:53 2008 +0200| [123e35c974cec3a6fcd836f2628c9d53fd588272] | committer: Laurent Aimar 

Clean up a bit subpicture release code.

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

 src/video_output/vout_subpictures.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/video_output/vout_subpictures.c b/src/video_output/vout_subpictures.c
index cf2ebfb..7b90e3b 100644
--- a/src/video_output/vout_subpictures.c
+++ b/src/video_output/vout_subpictures.c
@@ -215,11 +215,15 @@ void spu_Attach( spu_t *p_spu, vlc_object_t *p_this, bool b_attach )
 
 
 /* */
-static void RegionPictureRelease( picture_t *p_pic )
+static void RegionPictureRelease( picture_t *p_picture )
 {
-    free( p_pic->p_data_orig );
-    /* We use pf_release nullity to know if the picture has already been released. */
-    p_pic->pf_release = NULL;
+    if( --p_picture->i_refcount > 0 )
+        return;
+
+    assert( p_picture->i_refcount == 0 );
+    free( p_picture->p_q );
+    free( p_picture->p_data_orig );
+    free( p_picture->p_sys );
 }
 
 /**
@@ -261,6 +265,7 @@ subpicture_region_t *__spu_CreateRegion( vlc_object_t *p_this,
         return NULL;
     }
 
+    p_region->picture.i_refcount = 1;
     p_region->picture.pf_release = RegionPictureRelease;
 
     return p_region;




More information about the vlc-devel mailing list