[vlc-devel] commit: mtime: Use mach_absolute_time on Mac OS X instead of gettimeofday. (Pierre d'Herbemont )
Rémi Denis-Courmont
rem at videolan.org
Sat Feb 14 17:31:30 CET 2009
Le dimanche 8 février 2009 02:03:05 git version control, vous avez écrit :
> vlc | branch: 0.9-bugfix | Pierre d'Herbemont <pdherbemont at videolan.org> |
> Sun Feb 8 00:31:33 2009 +0100| [5ead92ffd58088828ed802173d963b2571f0cd69]
> | committer: Pierre d'Herbemont
>
> mtime: Use mach_absolute_time on Mac OS X instead of gettimeofday.
>
> mach_absolute_time() is a monotic clock, whereas gettimeofday() is not. For
> that reason setting your computer time while playing a movie won't halt
> playback anymore.
>
> Seems to fix the dropped frame issue on Mac OS X.
>
> > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5ead92ffd58088828e
> >d802173d963b2571f0cd69
>
> ---
>
> include/vlc_threads.h | 14 ++++++++++++++
> src/misc/mtime.c | 34 ++++++++++++++++++++++++++++++++++
> 2 files changed, 48 insertions(+), 0 deletions(-)
>
> diff --git a/include/vlc_threads.h b/include/vlc_threads.h
> index e2810e9..8a21f84 100644
> --- a/include/vlc_threads.h
> +++ b/include/vlc_threads.h
> @@ -359,12 +359,26 @@ static inline void __vlc_cond_wait( const char *
> psz_file, int i_line, #define vlc_cond_timedwait( P_COND, P_MUTEX, DEADLINE
> ) \ __vlc_cond_timedwait( __FILE__, __LINE__, P_COND,
> P_MUTEX, DEADLINE )
>
> +#ifdef __APPLE__
> +# include <sys/time.h> /* gettimeofday in vlc_cond_timedwait */
> +#endif
> +
> static inline int __vlc_cond_timedwait( const char * psz_file, int i_line,
> vlc_cond_t *p_condvar,
> vlc_mutex_t *p_mutex,
> mtime_t deadline )
> {
> #if defined(LIBVLC_USE_PTHREAD)
> +#ifdef __APPLE__
> + /* mdate() is mac_absolute_time on osx, which we must convert to do
> + * the same base than gettimeofday() on which pthread_cond_timedwait
> + * counts on. */
I wonder why bother use monotonic time if vlc_cond_timedwait still breaks.
--
Rémi Denis-Courmont
http://git.remlab.net/cgi-bin/gitweb.cgi?p=vlc-courmisch.git;a=summary
More information about the vlc-devel
mailing list