[vlc-devel] commit: auhal: don't mix vlc_ and pthread_ function calls ( Rémi Denis-Courmont )

git version control git at videolan.org
Sun Apr 27 21:26:19 CEST 2008


vlc | branch: master | Rémi Denis-Courmont <rem at videolan.org> | Sun Apr 27 22:26:34 2008 +0300| [eab50dcfa990fd08e2c9d0ba404b5393746dad1d]

auhal: don't mix vlc_ and pthread_ function calls

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

 modules/audio_output/auhal.c |   14 ++++----------
 1 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/modules/audio_output/auhal.c b/modules/audio_output/auhal.c
index 3f9deb3..1b29a2d 100644
--- a/modules/audio_output/auhal.c
+++ b/modules/audio_output/auhal.c
@@ -24,13 +24,12 @@
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
-#include <unistd.h>
-#include <sys/time.h> /* gettimeofday() */
-
 #ifdef HAVE_CONFIG_H
 # include "config.h"
 #endif
 
+#include <unistd.h>
+
 #include <vlc/vlc.h>
 #include <vlc_interface.h>
 #include <vlc_aout.h>
@@ -1190,8 +1189,6 @@ static int AudioStreamChangeFormat( aout_instance_t *p_aout, AudioStreamID i_str
     UInt32              i_param_size = 0;
     int i;
 
-    struct timeval now;
-    struct timespec timeout;
     struct { vlc_mutex_t lock; vlc_cond_t cond; } w;
  
     msg_Dbg( p_aout, STREAM_FORMAT_MSG( "setting stream format: ", change_format ) );
@@ -1229,12 +1226,9 @@ static int AudioStreamChangeFormat( aout_instance_t *p_aout, AudioStreamID i_str
     for( i = 0; i < 5; i++ )
     {
         AudioStreamBasicDescription actual_format;
+        mtime_t timeout = mtime() + 500000;
 
-        gettimeofday( &now, NULL );
-        timeout.tv_sec = now.tv_sec;
-        timeout.tv_nsec = (now.tv_usec + 500000) * 1000;
-
-        if( pthread_cond_timedwait( &w.cond, &w.lock, &timeout ) )
+        if( vlc_object_timedwait( &w, timeout ) )
         {
             msg_Dbg( p_aout, "reached timeout" );
         }




More information about the vlc-devel mailing list