From 5d35b279e21814b3b1499ae0b2e0e0dad7d7f782 Mon Sep 17 00:00:00 2001 From: Nicolas George Date: Fri, 1 Jul 2011 15:26:40 +0200 Subject: ALSA demuxer: use av_gettime and a timefilter. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The PTS for captured audio was measured using snd_pcm_htimestamp. snd_pcm_htimestamp hangs when the input is a dsnoop plugin. Furthermore, at some point, snd_pcm_htimestamp started returning monotonic timestamps rather than wall clock timestamps, in most but not all situations. Monotonic timestamps are fine, but ffmpeg uses wall clock timestamps everywhere else, and we have no API to inform the user which kind of timestamps it is. A separate snd_pcm_htimestamp is only slightly less accurate than snd_pcm_htimestamp: the standard deviation for the difference between two consecutive timestamps is (on my hardware): - ~13 µs with snd_pcm_htimestamp; - ~35 µs with av_gettime; - ~5 µs with av_gettime and a timefilter. --- libavdevice/alsa-audio-common.c | 1 + 1 file changed, 1 insertion(+) (limited to 'libavdevice/alsa-audio-common.c') diff --git a/libavdevice/alsa-audio-common.c b/libavdevice/alsa-audio-common.c index 8c5be3c864..6188721f48 100644 --- a/libavdevice/alsa-audio-common.c +++ b/libavdevice/alsa-audio-common.c @@ -316,6 +316,7 @@ av_cold int ff_alsa_close(AVFormatContext *s1) AlsaData *s = s1->priv_data; av_freep(&s->reorder_buf); + ff_timefilter_destroy(s->timefilter); snd_pcm_close(s->h); return 0; } -- cgit v1.2.3