It will not be set unless the codec context is used as the encoding
context, which is discouraged. Instead set the frame size explicitly.
---
libavformat/riffenc.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/libavformat/riffenc.c b/libavformat/riffenc.c
index b83533a..da449c9 100644
--- a/libavformat/riffenc.c
+++ b/libavformat/riffenc.c
@@ -63,8 +63,6 @@ int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc)
* fall back on using AVCodecContext.frame_size, which is not as reliable
* for indicating packet duration. */
frame_size = av_get_audio_frame_duration(enc, enc->block_align);
- if (!frame_size)
- frame_size = enc->frame_size;
waveformatextensible = (enc->channels > 2 && enc->channel_layout) ||
enc->sample_rate > 48000 ||
@@ -98,10 +96,7 @@ int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc)
if (enc->codec_id == AV_CODEC_ID_MP2 ||
enc->codec_id == AV_CODEC_ID_MP3) {
- /* This is wrong, but it seems many demuxers do not work if this
- * is set correctly. */
- blkalign = frame_size;
- // blkalign = 144 * enc->bit_rate/enc->sample_rate;
+ blkalign = 576 * (sample_rate <= 24000 ? 1 : 2)
} else if (enc->codec_id == AV_CODEC_ID_AC3) {
blkalign = 3840; /* maximum bytes per frame */
} else if (enc->block_align != 0) { /* specified by the codec */
--
2.0.0
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel