summaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorSasi Inguva <isasi-at-google.com@ffmpeg.org>2016-09-26 18:41:01 -0700
committerMichael Niedermayer <michael@niedermayer.cc>2016-09-29 02:25:41 +0200
commit7e0235bdb145cf7975bda240acb629991c4b7048 (patch)
tree6c546bf6fb5100601bf9eca2c0e500a00eca59e9 /libavcodec
parent1846a3eac854799fbffc9669dcf4de558b917957 (diff)
downloadffmpeg-streaming-7e0235bdb145cf7975bda240acb629991c4b7048.zip
ffmpeg-streaming-7e0235bdb145cf7975bda240acb629991c4b7048.tar.gz
lavc/utils.c: Subtract skip_samples when frame is DISCARDed.
Signed-off-by: Sasi Inguva <isasi@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/utils.c16
-rw-r--r--libavcodec/version.h2
2 files changed, 8 insertions, 10 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 0d78f0b..cf85300 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -2335,7 +2335,6 @@ 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);
@@ -2343,7 +2342,6 @@ 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);
@@ -2368,13 +2366,6 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx,
frame->sample_rate = avctx->sample_rate;
}
-
- 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;
- }
-
side= av_packet_get_side_data(avctx->internal->pkt, AV_PKT_DATA_SKIP_SAMPLES, &side_size);
if(side && side_size>=10) {
avctx->internal->skip_samples = AV_RL32(side);
@@ -2384,6 +2375,13 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx,
skip_reason = AV_RL8(side + 8);
discard_reason = AV_RL8(side + 9);
}
+
+ if ((frame->flags & AV_FRAME_FLAG_DISCARD) && *got_frame_ptr &&
+ !(avctx->flags2 & AV_CODEC_FLAG2_SKIP_MANUAL)) {
+ avctx->internal->skip_samples -= frame->nb_samples;
+ *got_frame_ptr = 0;
+ }
+
if (avctx->internal->skip_samples > 0 && *got_frame_ptr &&
!(avctx->flags2 & AV_CODEC_FLAG2_SKIP_MANUAL)) {
if(frame->nb_samples <= avctx->internal->skip_samples){
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 71dac40..91abd31 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -28,7 +28,7 @@
#include "libavutil/version.h"
#define LIBAVCODEC_VERSION_MAJOR 57
-#define LIBAVCODEC_VERSION_MINOR 59
+#define LIBAVCODEC_VERSION_MINOR 60
#define LIBAVCODEC_VERSION_MICRO 100
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
OpenPOWER on IntegriCloud