X-Git-Url: https://git.piment-noir.org/?p=deb_ffmpeg.git;a=blobdiff_plain;f=ffmpeg%2Flibavformat%2Friffenc.c;h=5e858008f561508063d2c7e3696d7d9037414ef8;hp=2eb2ae1d0ef5c2b7b2527594adc626eaf14a843a;hb=f6fa7814ccfe3e76514b36cf04f5cd3cb657c8cf;hpb=2ba45a602cbfa7b771effba9b11bb4245c21bc00 diff --git a/ffmpeg/libavformat/riffenc.c b/ffmpeg/libavformat/riffenc.c index 2eb2ae1..5e85800 100644 --- a/ffmpeg/libavformat/riffenc.c +++ b/ffmpeg/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 + 32000)/2 ? 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) {