[FFmpeg-devel] [PATCH] ALSA for libavdevice
Wed Dec 10 12:53:18 CET 2008
On Wed, Dec 10, 2008 at 09:34:11AM +0100, Luca Abeni wrote:
> Michael Niedermayer wrote:
> >> + }
> >> + pkt->size = res * s->frame_size;
> >> + pkt->pts = av_gettime(); /* FIXME: We might need something better... */
> > yes, this really needs to be improved, this is unacceptable unless alsa
> > completely lacks functionality to do better
> Just a short email to say that this is totally my fault: when I wrote this code,
> I've been told that the current time should be corrected using some alsa call that
> returns the current state of the audio buffer (it is also mentioned in some alsa
> tutorials, I think). I tried it, but I've not been able to notice any difference
> (A/V synch was good even with the current code - maybe because I used small audio
> buffers, maybe because I've been lucky, or maybe because the CPU load was low...
> I do not know).
> So, I did not include that code, because I was not able to validate it. Not
> the best decision, I admit.
> Anyway, I hope Nicolas will be able to easily add the needed correction to the
you should print the duration of packets in samples based on the actual
number of samples and in samples based on the pts difference, if these
differ by more than +-1 you should try hard to fix it because this will
cause problems on some players IMHO. and the various specs likely dont
I do not know if alsa provides timestamps to this accuracy, but if
av_gettime() + correction is everything they have then the awnser is
no and some timestamp correction filter will be required. audio.c
needs one as well so it should be in the common code.
You could try the filter described at
Also i suspect the reason why the corrent pts of audio.c work is that
ffmpeg.c probably ignores them. That is unless you use -async ...
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Good people do not need laws to tell them to act responsibly, while bad
people will find a way around the laws. -- Plato
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: Digital signature
More information about the ffmpeg-devel