[vlc-devel] commit: mac PPC: don't use mach absolute_time() (Derk-Jan Hartman )

git version control git at videolan.org
Mon Jun 1 12:37:18 CEST 2009


vlc | branch: master | Derk-Jan Hartman <hartman at videolan.org> | Mon Jun  1 12:35:38 2009 +0200| [c6ce6df890b7c66defc54c4dd4edbd940728fe94] | committer: Derk-Jan Hartman 

mac PPC: don't use mach absolute_time()

Introduced in [5ead92ffd58088828ed802173d963b2571f0cd69], on PowerPC-based Macs this breaks the playback of a certain AVI and WMV files for reasons not fully understood. The commit was reverted for PPC macs in
* [49f3721c5baa88feece1d8793f08f08b2ed86a4d]
* [7786caa59f70d40794273cd741ea96f98d43621f]
but these commits were never applied to the master branch.

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

 src/misc/mtime.c   |   11 ++++++-----
 src/misc/pthread.c |    2 +-
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/misc/mtime.c b/src/misc/mtime.c
index c735bdf..6cd1653 100644
--- a/src/misc/mtime.c
+++ b/src/misc/mtime.c
@@ -56,7 +56,8 @@
 #   include <sys/time.h>
 #endif
 
-#ifdef __APPLE__
+#ifdef __APPLE__ && && !defined(__powerpc__) && !defined(__ppc__) && !defined(__ppc64__)
+#define USE_APPLE_MACH 1
 #   include <mach/mach.h>
 #   include <mach/mach_time.h>
 #endif
@@ -173,7 +174,7 @@ static inline unsigned mprec( void )
 #endif
 }
 
-#ifdef __APPLE__
+#ifdef USE_APPLE_MACH
 static mach_timebase_info_data_t mtime_timebase_info;
 static pthread_once_t mtime_timebase_info_once = PTHREAD_ONCE_INIT;
 static void mtime_init_timebase(void)
@@ -207,7 +208,7 @@ mtime_t mdate( void )
 #elif defined( HAVE_KERNEL_OS_H )
     res = real_time_clock_usecs();
 
-#elif defined( __APPLE__ )
+#elif defined( USE_APPLE_MACH )
     pthread_once(&mtime_timebase_info_once, mtime_init_timebase);
     uint64_t date = mach_absolute_time();
 
@@ -323,7 +324,7 @@ mtime_t mdate( void )
         i_previous_time = res;
         LeaveCriticalSection( &date_lock );
     }
-#elif defined( __APPLE__ ) /* The version that should be used, if it was cancelable */
+#elif USE_APPLE_MACH /* The version that should be used, if it was cancelable */
     pthread_once(&mtime_timebase_info_once, mtime_init_timebase);
     uint64_t mach_time = date * 1000 * mtime_timebase_info.denom / mtime_timebase_info.numer;
     mach_wait_until(mach_time);
@@ -424,7 +425,7 @@ void msleep( mtime_t delay )
 
     while( nanosleep( &ts_delay, &ts_delay ) && ( errno == EINTR ) );
 
-#elif defined( __APPLE__ ) /* The version that should be used, if it was cancelable */
+#elif USE_APPLE_MACH /* The version that should be used, if it was cancelable */
     pthread_once(&mtime_timebase_info_once, mtime_init_timebase);
     uint64_t mach_time = delay * 1000 * mtime_timebase_info.denom / mtime_timebase_info.numer;
     mach_wait_until(mach_time + mach_absolute_time());
diff --git a/src/misc/pthread.c b/src/misc/pthread.c
index bca5afd..757df9a 100644
--- a/src/misc/pthread.c
+++ b/src/misc/pthread.c
@@ -356,7 +356,7 @@ void vlc_cond_wait (vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex)
 int vlc_cond_timedwait (vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex,
                         mtime_t deadline)
 {
-#ifdef __APPLE__
+#if defined(__APPLE__) && !defined(__powerpc__) && !defined( __ppc__ ) && !defined( __ppc64__ )
     /* mdate() is mac_absolute_time on OSX, which we must convert to do
      * the same base than gettimeofday() which pthread_cond_timedwait
      * relies on. */




More information about the vlc-devel mailing list