diff mbox series

[FFmpeg-devel,2/2] avcodec/mlpdec: add flush support

Message ID 20210828163938.25583-2-onemda@gmail.com
State Accepted
Commit 5673a4842556b79a92a1ede6e9696506fd4161ad
Headers show
Series [FFmpeg-devel,1/2] avcodec/mlpdec: reset lossless crc checking when stream ends | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Paul B Mahol Aug. 28, 2021, 4:39 p.m. UTC
Fixes spurious lossless check failures when seeking.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
---
 libavcodec/mlpdec.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
diff mbox series

Patch

diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c
index f4c7c6c320..08db5dc63c 100644
--- a/libavcodec/mlpdec.c
+++ b/libavcodec/mlpdec.c
@@ -1342,6 +1342,18 @@  error:
     return AVERROR_INVALIDDATA;
 }
 
+static void mlp_decode_flush(AVCodecContext *avctx)
+{
+    MLPDecodeContext *m = avctx->priv_data;
+
+    m->params_valid = 0;
+    for (int substr = 0; substr <= m->max_decoded_substream; substr++){
+        SubStream *s = &m->substream[substr];
+
+        s->lossless_check_data = 0xffffffff;
+    }
+}
+
 #if CONFIG_MLP_DECODER
 const AVCodec ff_mlp_decoder = {
     .name           = "mlp",
@@ -1351,6 +1363,7 @@  const AVCodec ff_mlp_decoder = {
     .priv_data_size = sizeof(MLPDecodeContext),
     .init           = mlp_decode_init,
     .decode         = read_access_unit,
+    .flush          = mlp_decode_flush,
     .capabilities   = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_CHANNEL_CONF,
     .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE,
 };
@@ -1364,6 +1377,7 @@  const AVCodec ff_truehd_decoder = {
     .priv_data_size = sizeof(MLPDecodeContext),
     .init           = mlp_decode_init,
     .decode         = read_access_unit,
+    .flush          = mlp_decode_flush,
     .capabilities   = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_CHANNEL_CONF,
     .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE,
 };