On Tue, Oct 12, 2021 at 02:50:40PM +0100, Derek Buitenhuis wrote:
> bit_rate is not a critical field, and we shouln't hard fail if we
> can't caluclate it due to a large timebase - it needlessly breaks
> valid files.
> 
> Signed-off-by: Derek Buitenhuis <derek.buitenh...@gmail.com>
> ---
>  libavformat/mov.c | 20 +++++++++++---------
>  1 file changed, 11 insertions(+), 9 deletions(-)
> 
> diff --git a/libavformat/mov.c b/libavformat/mov.c
> index d0b8b2595b..99d10c2b33 100644
> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c
> @@ -7666,11 +7666,12 @@ static int mov_read_header(AVFormatContext *s)
>              MOVStreamContext *sc = st->priv_data;
>              if (st->duration > 0) {
>                  if (sc->data_size > INT64_MAX / sc->time_scale / 8) {
> -                    av_log(s, AV_LOG_ERROR, "Overflow during bit rate 
> calculation %"PRId64" * 8 * %d\n",
> +                    av_log(s, AV_LOG_WARNING, "Overflow during bit rate 
> calculation %"PRId64" * 8 * %d\n",
>                             sc->data_size, sc->time_scale);
> -                    return AVERROR_INVALIDDATA;
> -                }
> -                st->codecpar->bit_rate = sc->data_size * 8 * sc->time_scale 
> / st->duration;
> +                    if (s->error_recognition & AV_EF_EXPLODE)
> +                        return AVERROR_INVALIDDATA;
> +                } else
> +                    st->codecpar->bit_rate = sc->data_size * 8 * 
> sc->time_scale / st->duration;
>              }

this should be using av_rescale() i think

thx


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I know you won't believe me, but the highest form of Human Excellence is
to question oneself and others. -- Socrates

Attachment: signature.asc
Description: PGP signature

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to