This fixes a bogus bitrate value in the header of WAV files with alaw/ulaw audio.
Signed-off-by: Mans Rullgard <[email protected]> --- libavcodec/pcm.c | 1 + tests/ref/acodec/pcm_alaw | 2 +- tests/ref/acodec/pcm_mulaw | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/libavcodec/pcm.c b/libavcodec/pcm.c index 9614e8c..5f43f9b 100644 --- a/libavcodec/pcm.c +++ b/libavcodec/pcm.c @@ -48,6 +48,7 @@ static av_cold int pcm_encode_init(AVCodecContext *avctx) avctx->bits_per_coded_sample = av_get_bits_per_sample(avctx->codec->id); avctx->block_align = avctx->channels * avctx->bits_per_coded_sample / 8; + avctx->bit_rate = avctx->block_align * avctx->sample_rate * 8; avctx->coded_frame = avcodec_alloc_frame(); if (!avctx->coded_frame) return AVERROR(ENOMEM); diff --git a/tests/ref/acodec/pcm_alaw b/tests/ref/acodec/pcm_alaw index 4943831..0eba43a 100644 --- a/tests/ref/acodec/pcm_alaw +++ b/tests/ref/acodec/pcm_alaw @@ -1,4 +1,4 @@ -ede2da07839a00c255a43129922f2c7b *./tests/data/acodec/pcm_alaw.wav +a2dd6a934ec6d5ec901a211652e85227 *./tests/data/acodec/pcm_alaw.wav 529258 ./tests/data/acodec/pcm_alaw.wav f323f7551ffad91de8613f44dcb198b6 *./tests/data/pcm_alaw.acodec.out.wav stddev: 101.67 PSNR: 56.19 MAXDIFF: 515 bytes: 1058400/ 1058400 diff --git a/tests/ref/acodec/pcm_mulaw b/tests/ref/acodec/pcm_mulaw index cefd76b..e1abcbe 100644 --- a/tests/ref/acodec/pcm_mulaw +++ b/tests/ref/acodec/pcm_mulaw @@ -1,4 +1,4 @@ -0c2a55850fb46ad5385a69b15b271f10 *./tests/data/acodec/pcm_mulaw.wav +fd10ee54bd298fc29fd6fc70baa71414 *./tests/data/acodec/pcm_mulaw.wav 529258 ./tests/data/acodec/pcm_mulaw.wav 7ae8c3fc804bd574006fd547fe28980c *./tests/data/pcm_mulaw.acodec.out.wav stddev: 103.38 PSNR: 56.04 MAXDIFF: 644 bytes: 1058400/ 1058400 -- 1.7.10 _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
