[FFmpeg-devel] [PATCH] avcodec/mpegaudiodec_template: skip first frame after seeking
Michael Niedermayer
michaelni at gmx.at
Fri Apr 17 19:04:02 CEST 2015
This could be made optional if preferred
---
libavcodec/mpegaudiodec_template.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/libavcodec/mpegaudiodec_template.c b/libavcodec/mpegaudiodec_template.c
index 2326a90..70c17a1 100644
--- a/libavcodec/mpegaudiodec_template.c
+++ b/libavcodec/mpegaudiodec_template.c
@@ -87,6 +87,7 @@ typedef struct MPADecodeContext {
MPADSPContext mpadsp;
AVFloatDSPContext *fdsp;
AVFrame *frame;
+ int flushed;
} MPADecodeContext;
#define HEADER_SIZE 4
@@ -1645,6 +1646,11 @@ static int mp_decode_frame(MPADecodeContext *s, OUT_INT **samples,
}
}
+ if (s->flushed) {
+ s->avctx->internal->skip_samples = FFMAX(s->avctx->internal->skip_samples, s->frame->nb_samples);
+ s->flushed = 0;
+ }
+
return nb_frames * 32 * sizeof(OUT_INT) * s->nb_channels;
}
@@ -1723,6 +1729,7 @@ static void mp_flush(MPADecodeContext *ctx)
memset(ctx->mdct_buf, 0, sizeof(ctx->mdct_buf));
ctx->last_buf_size = 0;
ctx->dither_state = 0;
+ ctx->flushed = 1;
}
static void flush(AVCodecContext *avctx)
--
1.7.9.5
More information about the ffmpeg-devel
mailing list