[FFmpeg-cvslog] avcodec/dpcm: add .flush
Paul B Mahol
git at videolan.org
Tue Jan 24 17:56:37 EET 2023
ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sat Jan 21 14:07:48 2023 +0100| [3110e2845636aaab32c426c25790c7ead2878fde] | committer: Paul B Mahol
avcodec/dpcm: add .flush
Otherwise after seek, DC offset for audio samples might be big.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3110e2845636aaab32c426c25790c7ead2878fde
---
libavcodec/dpcm.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/libavcodec/dpcm.c b/libavcodec/dpcm.c
index 2420647bc0..86cb9134f8 100644
--- a/libavcodec/dpcm.c
+++ b/libavcodec/dpcm.c
@@ -448,6 +448,13 @@ static int dpcm_decode_frame(AVCodecContext *avctx, AVFrame *frame,
return avpkt->size;
}
+static void dpcm_flush(AVCodecContext *avctx)
+{
+ DPCMContext *s = avctx->priv_data;
+
+ s->sample[0] = s->sample[1] = 0;
+}
+
#define DPCM_DECODER(id_, name_, long_name_) \
const FFCodec ff_ ## name_ ## _decoder = { \
.p.name = #name_, \
@@ -457,6 +464,7 @@ const FFCodec ff_ ## name_ ## _decoder = { \
.p.capabilities = AV_CODEC_CAP_DR1, \
.priv_data_size = sizeof(DPCMContext), \
.init = dpcm_decode_init, \
+ .flush = dpcm_flush, \
FF_CODEC_DECODE_CB(dpcm_decode_frame), \
}
More information about the ffmpeg-cvslog
mailing list