[FFmpeg-cvslog] alsa: fix timefilter usage.

Nicolas George git at videolan.org
Mon Mar 5 17:31:58 CET 2012


ffmpeg | branch: master | Nicolas George <nicolas.george at normalesup.org> | Fri Mar  2 11:54:45 2012 +0100| [456d65a5c6a9013adabbe0f21c920a6f04b9e6e9] | committer: Nicolas George

alsa: fix timefilter usage.

The period argument is supposed to be the number of samples since
the last update.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=456d65a5c6a9013adabbe0f21c920a6f04b9e6e9
---

 libavdevice/alsa-audio-dec.c |    3 ++-
 libavdevice/alsa-audio.h     |    1 +
 2 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/libavdevice/alsa-audio-dec.c b/libavdevice/alsa-audio-dec.c
index 62bf42d..e0e0954 100644
--- a/libavdevice/alsa-audio-dec.c
+++ b/libavdevice/alsa-audio-dec.c
@@ -123,7 +123,8 @@ static int audio_read_packet(AVFormatContext *s1, AVPacket *pkt)
     dts = av_gettime();
     snd_pcm_delay(s->h, &delay);
     dts -= av_rescale(delay + res, 1000000, s->sample_rate);
-    pkt->pts = ff_timefilter_update(s->timefilter, dts, res);
+    pkt->pts = ff_timefilter_update(s->timefilter, dts, s->last_period);
+    s->last_period = res;
 
     pkt->size = res * s->frame_size;
 
diff --git a/libavdevice/alsa-audio.h b/libavdevice/alsa-audio.h
index e453a20..6719384 100644
--- a/libavdevice/alsa-audio.h
+++ b/libavdevice/alsa-audio.h
@@ -52,6 +52,7 @@ typedef struct {
     int period_size; ///< preferred size for reads and writes, in frames
     int sample_rate; ///< sample rate set by user
     int channels;    ///< number of channels set by user
+    int last_period;
     TimeFilter *timefilter;
     void (*reorder_func)(const void *, void *, int);
     void *reorder_buf;



More information about the ffmpeg-cvslog mailing list