[vlc-devel] commit: We must not return the picture directly but copy it (in case we' re not ( Rémi Duraffort )

git version control git at videolan.org
Tue Jun 30 23:31:42 CEST 2009


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Tue Jun 30 23:25:55 2009 +0200| [f5a31fb7192bd8cbf700cb553d8f4467240cf23e] | committer: Rémi Duraffort 

We must not return the picture directly but copy it (in case we're not
modifying anything).

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

 modules/video_filter/postproc.c |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/modules/video_filter/postproc.c b/modules/video_filter/postproc.c
index 945925b..a583c40 100644
--- a/modules/video_filter/postproc.c
+++ b/modules/video_filter/postproc.c
@@ -290,21 +290,22 @@ static picture_t *PostprocPict( filter_t *p_filter, picture_t *p_pic )
     int i_plane;
     int i_src_stride[3], i_dst_stride[3];
 
+    picture_t *p_outpic = filter_NewPicture( p_filter );
+    if( !p_outpic )
+    {
+        picture_Release( p_pic );
+        return NULL;
+    }
+
     /* Lock to prevent issues if pp_mode is changed */
     vlc_mutex_lock( &p_sys->lock );
     if( !p_sys->pp_mode )
     {
         vlc_mutex_unlock( &p_sys->lock );
-        return p_pic;
+        picture_CopyPixels( p_outpic, p_pic );
+        return CopyInfoAndRelease( p_outpic, p_pic );
     }
 
-    picture_t *p_outpic = filter_NewPicture( p_filter );
-    if( !p_outpic )
-    {
-        picture_Release( p_pic );
-        vlc_mutex_unlock( &p_sys->lock );
-        return NULL;
-    }
 
     for( i_plane = 0; i_plane < p_pic->i_planes; i_plane++ )
     {




More information about the vlc-devel mailing list