[FFmpeg-devel] [PATCH] avformat/movenc: fix size calculation in mov_write_eac3_tag()

Tomas Härdin tjoppen at acc.umu.se
Wed Nov 21 12:57:53 EET 2018


ons 2018-11-21 klockan 11:46 +0100 skrev Paul B Mahol:
> Signed-off-by: Paul B Mahol <onemda at gmail.com>
> ---
>  libavformat/movenc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavformat/movenc.c b/libavformat/movenc.c
> index 33978ee1b0..bee8e89760 100644
> --- a/libavformat/movenc.c
> +++ b/libavformat/movenc.c
> @@ -541,7 +541,7 @@ static int mov_write_eac3_tag(AVIOContext *pb,
> MOVTrack *track)
>          return AVERROR(EINVAL);
>  
>      info = track->eac3_priv;
> -    size = 2 + 4 * (info->num_ind_sub + 1);
> +    size = 2 + ((34 * (info->num_ind_sub + 1) + 7) >> 3);

Having to round like this looks like something the put_bits stuff could
maybe take care of. Not that that needs to hold this patch back of
course

I took a look at the surrounding code, and this patch looks OK. The
info->substream[i].num_dep_sub stuff modifying size looks a bit hacky
compared to computing the proper size

/Tomas


More information about the ffmpeg-devel mailing list