lavc/utils.c: Make sure skip_samples never goes negative.
authorSasi Inguva <isasi-at-google.com@ffmpeg.org>
Fri, 4 Nov 2016 22:31:58 +0000 (15:31 -0700)
committerMichael Niedermayer <michael@niedermayer.cc>
Thu, 10 Nov 2016 16:44:47 +0000 (17:44 +0100)
Signed-off-by: Sasi Inguva <isasi@google.com>
Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/utils.c

index 87de15f..d6dca18 100644 (file)
@@ -2391,7 +2391,7 @@ 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;
+            avctx->internal->skip_samples = FFMAX(0, avctx->internal->skip_samples - frame->nb_samples);
             *got_frame_ptr = 0;
         }