[FFmpeg-devel] libossupport status

Michael Niedermayer michaelni
Fri Dec 28 19:55:05 CET 2007


On Fri, Dec 28, 2007 at 07:18:40PM +0100, Luca Abeni wrote:
> Hi Michael,
>
> Michael Niedermayer wrote:
> [...]
>>> BTW the POSIX-recommended way to sleep seems to be using select with
>>> no file descriptors. Does this work on Windows?
>> Does it matter? Most of our sleeps are because of "unix" API design flaws,
>> the related code simply isnt used on windows ...
>> no x11, no v4l, no bktr
> So, the only problematic use of usleep is in ffmpeg.c... I wrote the 
> attached patch to change it in select(), as suggested by Rich. This seems 
> to work well on Linux; I'll test on mingw tomorrow.
>
>
> 				Luca

> Index: ffmpeg/ffmpeg.c
> ===================================================================
> --- ffmpeg.orig/ffmpeg.c	2007-12-28 17:36:58.000000000 +0100
> +++ ffmpeg/ffmpeg.c	2007-12-28 17:47:40.000000000 +0100
> @@ -1169,8 +1169,12 @@
>          if (ist->st->codec->rate_emu) {
>              int64_t pts = av_rescale((int64_t) ist->frame * ist->st->codec->time_base.num, 1000000, ist->st->codec->time_base.den);
>              int64_t now = av_gettime() - ist->start;
> -            if (pts > now)
> -                usleep(pts - now);
> +            if (pts > now) {
> +                struct timeval tv;
> +                tv.tv_sec = (pts - now) / 1000000;
> +                tv.tv_usec = (pts - now) % 1000000;
> +                select(0, NULL, NULL, NULL, &tv);
> +            }

iam NOT in favor of this obfuscation!

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No snowflake in an avalanche ever feels responsible. -- Voltaire
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20071228/ca786db8/attachment.pgp>



More information about the ffmpeg-devel mailing list