diff options
author | Nicolas George <nicolas.george@normalesup.org> | 2011-07-01 14:58:24 +0200 |
---|---|---|
committer | Nicolas George <nicolas.george@normalesup.org> | 2011-07-01 18:18:53 +0200 |
commit | 392acaedcb052fa64386d5d0aea4931386f72d64 (patch) | |
tree | d9d9496b59806b2e5a92d7c5bea589d60662104b /libavdevice/alsa-audio-dec.c | |
parent | 46edd3a01b68f7a1ca833510bef39f599a5055c9 (diff) | |
download | ffmpeg-streaming-392acaedcb052fa64386d5d0aea4931386f72d64.zip ffmpeg-streaming-392acaedcb052fa64386d5d0aea4931386f72d64.tar.gz |
ALSA: fix use of period_size.
period_size is in frames, while the demuxer assumed it was in bytes,
resulting in short reads.
Diffstat (limited to 'libavdevice/alsa-audio-dec.c')
-rw-r--r-- | libavdevice/alsa-audio-dec.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libavdevice/alsa-audio-dec.c b/libavdevice/alsa-audio-dec.c index 2424c02..e3ad98b 100644 --- a/libavdevice/alsa-audio-dec.c +++ b/libavdevice/alsa-audio-dec.c @@ -127,11 +127,11 @@ static int audio_read_packet(AVFormatContext *s1, AVPacket *pkt) snd_htimestamp_t timestamp; snd_pcm_uframes_t ts_delay; - if (av_new_packet(pkt, s->period_size) < 0) { + if (av_new_packet(pkt, s->period_size * s->frame_size) < 0) { return AVERROR(EIO); } - while ((res = snd_pcm_readi(s->h, pkt->data, pkt->size / s->frame_size)) < 0) { + while ((res = snd_pcm_readi(s->h, pkt->data, s->period_size)) < 0) { if (res == -EAGAIN) { av_free_packet(pkt); |