diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-11-06 13:18:42 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-11-06 13:19:26 +0100 |
commit | a51eb6d34ceda7cc4f46fc3f9d0e9b57eba61cb6 (patch) | |
tree | 29569c477d611545385d5d323a9fc02f92617b76 /libavformat | |
parent | 042eba52a5ff4939b8c548a9fb5e209790c17b37 (diff) | |
parent | 56dc46a1893251e74be1ad63e54fb38d754bb1fe (diff) | |
download | ffmpeg-a51eb6d34ceda7cc4f46fc3f9d0e9b57eba61cb6.tar.gz |
Merge commit '56dc46a1893251e74be1ad63e54fb38d754bb1fe'
* commit '56dc46a1893251e74be1ad63e54fb38d754bb1fe':
riffenc: do not fall back on AVCodecContext.frame_size for MP3
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/riffenc.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/libavformat/riffenc.c b/libavformat/riffenc.c index 2eb2ae1d0e..c670d303a6 100644 --- a/libavformat/riffenc.c +++ b/libavformat/riffenc.c @@ -68,8 +68,6 @@ int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc, int flags) * 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 || @@ -104,12 +102,10 @@ int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc, int flags) enc->bits_per_coded_sample, bps); } - 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. */ + if (enc->codec_id == AV_CODEC_ID_MP2) { blkalign = frame_size; - // blkalign = 144 * enc->bit_rate/enc->sample_rate; + } else if (enc->codec_id == AV_CODEC_ID_MP3) { + blkalign = 576 * (enc->sample_rate <= 24000 ? 1 : 2); } else if (enc->codec_id == AV_CODEC_ID_AC3) { blkalign = 3840; /* maximum bytes per frame */ } else if (enc->codec_id == AV_CODEC_ID_AAC) { |