[vlc-devel] commit: Properly lock SPU_CHANNEL_REGISTER. (Laurent Aimar )

git version control git at videolan.org
Sat Sep 13 13:23:14 CEST 2008


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Sat Sep 13 00:05:24 2008 +0200| [e4a1bb5ba32d8e9440d7078880663531a0699fec] | committer: Laurent Aimar 

Properly lock SPU_CHANNEL_REGISTER.

( At best, a = b++ is not atomic)

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

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

diff --git a/src/video_output/vout_subpictures.c b/src/video_output/vout_subpictures.c
index 2090b35..05378c6 100644
--- a/src/video_output/vout_subpictures.c
+++ b/src/video_output/vout_subpictures.c
@@ -1322,7 +1322,10 @@ static int spu_vaControlDefault( spu_t *p_spu, int i_query, va_list args )
     {
     case SPU_CHANNEL_REGISTER:
         pi = (int *)va_arg( args, int * );
-        if( pi ) *pi = p_spu->i_channel++;
+        vlc_mutex_lock( &p_spu->subpicture_lock );
+        if( pi )
+            *pi = p_spu->i_channel++;
+        vlc_mutex_unlock( &p_spu->subpicture_lock );
         break;
 
     case SPU_CHANNEL_CLEAR:




More information about the vlc-devel mailing list