[FFmpeg-devel] [PATCH] lavc/utils.c: Make sure skip_samples never goes negative.

Sasi Inguva isasi at google.com
Fri Nov 4 00:31:14 EET 2016


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;
         }
 
-- 
2.8.0.rc3.226.g39d4020



More information about the ffmpeg-devel mailing list