[FFmpeg-cvslog] lavd/lavfi: compute and use the used samples buffer size for the output audio packet size
Stefano Sabatini
git at videolan.org
Sun Oct 16 21:19:50 CEST 2011
ffmpeg | branch: master | Stefano Sabatini <stefasab at gmail.com> | Sun Oct 16 10:35:07 2011 +0200| [477718f40b3d8fddfb3ee3bea1125fe56986c7e6] | committer: Stefano Sabatini
lavd/lavfi: compute and use the used samples buffer size for the output audio packet size
Do not assume the used size is the same of the allocated size, as it was
wrongly assumed. Fix audio playback when the two values differ.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=477718f40b3d8fddfb3ee3bea1125fe56986c7e6
---
libavdevice/lavfi.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/libavdevice/lavfi.c b/libavdevice/lavfi.c
index 4d7297b..0477081 100644
--- a/libavdevice/lavfi.c
+++ b/libavdevice/lavfi.c
@@ -299,7 +299,9 @@ static int lavfi_read_packet(AVFormatContext *avctx, AVPacket *pkt)
avpicture_layout(&pict, ref->format, ref->video->w,
ref->video->h, pkt->data, size);
} else if (ref->audio) {
- size = ref->linesize[0];
+ size = ref->audio->nb_samples *
+ av_get_bytes_per_sample(ref->format) *
+ av_get_channel_layout_nb_channels(ref->audio->channel_layout);
if ((ret = av_new_packet(pkt, size)) < 0)
return ret;
memcpy(pkt->data, ref->data[0], size);
More information about the ffmpeg-cvslog
mailing list