[FFmpeg-devel] [PATCH 1/1] avcodec/dolby_e: Add error recovery when parse_mantissas run out of bits

Tomas Härdin git at haerdin.se
Mon Mar 13 15:05:12 EET 2023


fre 2023-03-10 klockan 10:17 +0100 skrev Nicolas Gaullier:
> +                if (i == c->nb_groups - 1
> +                    && count * size1 > get_bits_left(&s->gb)
> +                    && get_bits_left(&s->gb) >= 0
> +                    && (int)(mnt - c->mantissas) >= MIN_MANTISSAS) {
> +                    av_log(s->avctx, AV_LOG_WARNING, "Truncated
> mantissas @%d, "
> +                        "highest frequencies not recoverable\n",
> (int)(mnt - c->mantissas));
> +                    break;
> +                }

Surely there's a proper way to fix this rather than having an arbitrary
threshold. At the very least the get_bits_left() check could be moved
to before parse_mantissas(). If get_bits_left() is < 0 after
parse_mantissas() then a warning could be issued instead of erroring
out, which should have an effect similar to this.

Is there a spec saying what to do with truncated packets? Since this is
Dolby-E I suspect the answer is "no".

/Tomas



More information about the ffmpeg-devel mailing list