[FFmpeg-devel] [PATCH] lavc/utils.c: Make sure skip_samples never goes negative.
Hendrik Leppkes
h.leppkes at gmail.com
Fri Nov 4 00:41:19 EET 2016
On Thu, Nov 3, 2016 at 11:31 PM, Sasi Inguva
<isasi-at-google.com at ffmpeg.org> wrote:
> Signed-off-by: Sasi Inguva <isasi at google.com>
> ---
> libavcodec/utils.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/libavcodec/utils.c b/libavcodec/utils.c
> index 87de15f..a33afaa 100644
> --- a/libavcodec/utils.c
> +++ b/libavcodec/utils.c
> @@ -2391,7 +2391,9 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx,
>
> if ((frame->flags & AV_FRAME_FLAG_DISCARD) && *got_frame_ptr &&
> !(avctx->flags2 & AV_CODEC_FLAG2_SKIP_MANUAL)) {
> - avctx->internal->skip_samples -= frame->nb_samples;
> + if (avctx->internal->skip_samples >= frame->nb_samples) {
> + avctx->internal->skip_samples -= frame->nb_samples;
> + }
> *got_frame_ptr = 0;
> }
>
Shouldnt skip samples be zeroed then?
Maybe something like:
avctx->internal->skip_samples -= FFMAX(frame->nb_samples,
avctx->internal->skip_samples);
- Hendrik
More information about the ffmpeg-devel
mailing list