[FFmpeg-devel] [PATCH] av_get_delay

Nicolas George nicolas.george at normalesup.org
Thu Jun 30 20:01:48 CEST 2011

Le duodi 12 messidor, an CCXIX, Michael Niedermayer a écrit :
> These are both bad actually.
> the reason is they are non constant and that on a normal multitasking
> OS the results will be unreliable because time can pass between 2
> get delay calls or any get time call.
> the obvious solution would be to
> * Consider a media stream to be a continuous stream not made of samples
>   or frames
> * Return as delay the pair of (wallclock, current presented position in
>   sufficeint high precission)
> The advnatage is that the (correctly scaled) difference between these
> 2 would be truly constant up to the drift of the (sound/video)
> device clock and the system clock.
> So the timing of when to do the call becomes irrelevant.
> and AV sync can be achived by doing such a call for video and one for
> audio and then compensating either stream by the difference. And that
> works even when the 2 calls are done some time appart.

That sounds reasonable.

I join the patches required to implement that in ALSA.

I had to use a separate av_gettime because snd_pcm_htimestamp hangs on dmix
plugins like it hangs on dsnoop, and while this is a minor annoyance for
capture, this is a complete feature breaker for playback.

Also, at some time snd_pcm_htimestamp seems to have started reporting
monotonic timestamps rather than wall time: I'll have to find a way to fix
the demuxer. But this is a completely different issue.


  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110630/f0721eb7/attachment.asc>

More information about the ffmpeg-devel mailing list