Commit 456d65a5 authored by Nicolas George's avatar Nicolas George

alsa: fix timefilter usage.

The period argument is supposed to be the number of samples since
the last update.
parent 9bbe6ed1
...@@ -123,7 +123,8 @@ static int audio_read_packet(AVFormatContext *s1, AVPacket *pkt) ...@@ -123,7 +123,8 @@ static int audio_read_packet(AVFormatContext *s1, AVPacket *pkt)
dts = av_gettime(); dts = av_gettime();
snd_pcm_delay(s->h, &delay); snd_pcm_delay(s->h, &delay);
dts -= av_rescale(delay + res, 1000000, s->sample_rate); 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; pkt->size = res * s->frame_size;
......
...@@ -52,6 +52,7 @@ typedef struct { ...@@ -52,6 +52,7 @@ typedef struct {
int period_size; ///< preferred size for reads and writes, in frames int period_size; ///< preferred size for reads and writes, in frames
int sample_rate; ///< sample rate set by user int sample_rate; ///< sample rate set by user
int channels; ///< number of channels set by user int channels; ///< number of channels set by user
int last_period;
TimeFilter *timefilter; TimeFilter *timefilter;
void (*reorder_func)(const void *, void *, int); void (*reorder_func)(const void *, void *, int);
void *reorder_buf; void *reorder_buf;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment