[vlc-devel] commit: Use var_AcquireMutex for the quicktime lock. ( Rémi Denis-Courmont )

git version control git at videolan.org
Fri May 2 18:24:02 CEST 2008


vlc | branch: master | Rémi Denis-Courmont <rem at videolan.org> | Fri May  2 19:25:10 2008 +0300| [651e249197e50e39b02c011d77f0e0f1373ba590]

Use var_AcquireMutex for the quicktime lock.

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

 include/vlc_main.h          |    3 ---
 modules/gui/macosx/voutqt.m |    6 +++---
 src/libvlc-common.c         |    1 -
 3 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/include/vlc_main.h b/include/vlc_main.h
index de96471..4892e1d 100644
--- a/include/vlc_main.h
+++ b/include/vlc_main.h
@@ -76,9 +76,6 @@ struct libvlc_int_t
     counter_t            **pp_timers;     ///< Array of all timers
 
     vlc_mutex_t            config_lock;    ///< Lock for the config file
-#ifdef __APPLE__
-    vlc_mutex_t            quicktime_lock; ///< QT is not thread safe on OSX
-#endif
 
     /* Structure storing the action name / key associations */
     struct hotkey
diff --git a/modules/gui/macosx/voutqt.m b/modules/gui/macosx/voutqt.m
index a2ca07a..05bb498 100644
--- a/modules/gui/macosx/voutqt.m
+++ b/modules/gui/macosx/voutqt.m
@@ -165,8 +165,8 @@ int E_(OpenVideoQT) ( vlc_object_t *p_this )
         return VLC_EGENERIC;
     }
 
-    /* Damn QT isn't thread safe. so keep a lock in the p_libvlc object */
-    vlc_mutex_lock( &p_vout->p_libvlc->quicktime_lock );
+    /* Damn QT isn't thread safe, so keep a process-wide lock */
+    vlc_mutex_t *p_qtlock = var_AcquireMutex( "quicktime_mutex" );
 
     /* Can we find the right chroma ? */
     if( p_vout->p_sys->b_cpu_has_simd )
@@ -179,7 +179,7 @@ int E_(OpenVideoQT) ( vlc_object_t *p_this )
         err = FindCodec( kYUV420CodecType, bestSpeedCodec,
                         nil, &p_vout->p_sys->img_dc );
     }
-    vlc_mutex_unlock( &p_vout->p_libvlc->quicktime_lock );
+    vlc_mutex_unlock( p_qtlock );
  
     if( err == noErr && p_vout->p_sys->img_dc != 0 )
     {
diff --git a/src/libvlc-common.c b/src/libvlc-common.c
index 2acfc03..7831340 100644
--- a/src/libvlc-common.c
+++ b/src/libvlc-common.c
@@ -212,7 +212,6 @@ libvlc_int_t * libvlc_InternalCreate( void )
     vlc_mutex_init( p_libvlc, &p_libvlc->timer_lock );
     vlc_mutex_init( p_libvlc, &p_libvlc->config_lock );
 #ifdef __APPLE__
-    vlc_mutex_init( p_libvlc, &p_libvlc->quicktime_lock );
     vlc_thread_set_priority( p_libvlc, VLC_THREAD_PRIORITY_LOW );
 #endif
     /* Store data for the non-reentrant API */




More information about the vlc-devel mailing list