[FFmpeg-devel] [PATCH 1/2] avcodec/mlpdec: reset lossless crc checking when stream ends

Paul B Mahol onemda at gmail.com
Sat Aug 28 03:02:25 EEST 2021


Fixes invalid reports of bad lossless crc.

Signed-off-by: Paul B Mahol <onemda at gmail.com>
---
 libavcodec/mlpdec.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c
index e4992550ee..f0012cbb05 100644
--- a/libavcodec/mlpdec.c
+++ b/libavcodec/mlpdec.c
@@ -1142,6 +1142,7 @@ static int read_access_unit(AVCodecContext *avctx, void* data,
     unsigned int substream_start;
     unsigned int header_size = 4;
     unsigned int substr_header_size = 0;
+    unsigned int end_of_stream = 0;
     uint8_t substream_parity_present[MAX_SUBSTREAMS];
     uint16_t substream_data_len[MAX_SUBSTREAMS];
     uint8_t parity_bits;
@@ -1286,8 +1287,10 @@ static int read_access_unit(AVCodecContext *avctx, void* data,
             else if (m->avctx->codec_id == AV_CODEC_ID_MLP    && shorten_by != 0xD234)
                 return AVERROR_INVALIDDATA;
 
-            if (substr == m->max_decoded_substream)
+            if (substr == m->max_decoded_substream) {
                 av_log(m->avctx, AV_LOG_INFO, "End of stream indicated.\n");
+                end_of_stream = 1;
+            }
         }
 
         if (substream_parity_present[substr]) {
@@ -1319,6 +1322,9 @@ next_substr:
     if ((ret = output_data(m, m->max_decoded_substream, data, got_frame_ptr)) < 0)
         return ret;
 
+    if (end_of_stream)
+        m->substream[m->max_decoded_substream].lossless_check_data = 0xffffffff;
+
     return length;
 
 substream_length_mismatch:
-- 
2.17.1



More information about the ffmpeg-devel mailing list