From 02f05b5d81597bacc28b9b400f4aa262856a7a2e Mon Sep 17 00:00:00 2001
From: Paul B Mahol <onemda@gmail.com>
Date: Sat, 21 Jan 2023 14:07:48 +0100
Subject: [PATCH 3/3] avcodec/dpcm: add .flush
Otherwise after seek, DC offset for audio samples might be big.
Signed-off-by: Paul B Mahol <onemda@gmail.com>
---
libavcodec/dpcm.c | 8 ++++++++
1 file changed, 8 insertions(+)
@@ -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), \
}
--
2.39.1