diff options
author | Sasi Inguva <isasi-at-google.com@ffmpeg.org> | 2016-09-18 22:09:03 -0700 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2016-09-19 19:51:13 +0200 |
commit | a53201879ca36af6fcc8a0d4bcc1fa6d759b67ec (patch) | |
tree | 5d3cc4f9292cb9986a4d38c844364bfff553f33c | |
parent | b518d809f16359945eded03c2504641a7f497532 (diff) | |
download | ffmpeg-a53201879ca36af6fcc8a0d4bcc1fa6d759b67ec.tar.gz |
avcodec/utils: If using discard frame flag, ignore skip_samples set by the decoder
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/utils.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 4734a70ae2..b0345b63af 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -2320,6 +2320,7 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx, uint32_t discard_padding = 0; uint8_t skip_reason = 0; uint8_t discard_reason = 0; + int demuxer_skip_samples = 0; // copy to ensure we do not change avpkt AVPacket tmp = *avpkt; int did_split = av_packet_split_side_data(&tmp); @@ -2327,6 +2328,7 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx, if (ret < 0) goto fail; + demuxer_skip_samples = avctx->internal->skip_samples; avctx->internal->pkt = &tmp; if (HAVE_THREADS && avctx->active_thread_type & FF_THREAD_FRAME) ret = ff_thread_decode_frame(avctx, frame, got_frame_ptr, &tmp); @@ -2353,6 +2355,8 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx, if (frame->flags & AV_FRAME_FLAG_DISCARD) { + // If using discard frame flag, ignore skip_samples set by the decoder. + avctx->internal->skip_samples = demuxer_skip_samples; *got_frame_ptr = 0; } |