[FFmpeg-devel] [PATCH]lavf/riffenc: Set correct block align for mp2

Michael Niedermayer michaelni at gmx.at
Wed May 27 01:39:49 CEST 2015


On Tue, May 26, 2015 at 11:26:25PM +0200, Carl Eugen Hoyos wrote:
> Hi!
> 
> Attached patch from 2002 fixes ticket #4565.
> Michael added a comment in 359fa0fe that some demuxers 
> may not like it though.
> 
> Please comment, Carl Eugen

[...]
> diff --git a/libavformat/riffenc.c b/libavformat/riffenc.c
> index d429df0..8373f0b 100644
> --- a/libavformat/riffenc.c
> +++ b/libavformat/riffenc.c
> @@ -103,7 +103,7 @@ int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc, int flags)
>      }
>  
>      if (enc->codec_id == AV_CODEC_ID_MP2) {
> -        blkalign = frame_size;
> +        blkalign = 144 * enc->bit_rate/enc->sample_rate;

this must be rounded up when its not exact
this might work: (144 * enc->bit_rate - 1)/enc->sample_rate + 1;

also fate tests need to be updated


[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

There will always be a question for which you do not know the correct answer.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150527/c5a06e5b/attachment.asc>


More information about the ffmpeg-devel mailing list