diff mbox series

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

Message ID 20210828163938.25583-1-onemda@gmail.com
State Accepted
Commit 034133a0df5f327aba36ee25db9452cda9e1a62b
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 invalid reports of bad lossless crc.
While here make end of stream message into debug level as it is
not really important to user.
Also wait for new major sync frame as invalid concating of files
may produce invalid files, which cause various errors.

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

Patch

diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c
index e4992550ee..f4c7c6c320 100644
--- a/libavcodec/mlpdec.c
+++ b/libavcodec/mlpdec.c
@@ -53,6 +53,8 @@ 
 typedef struct SubStream {
     /// Set if a valid restart header has been read. Otherwise the substream cannot be decoded.
     uint8_t     restart_seen;
+    /// Set if end of stream is encountered
+    uint8_t     end_of_stream;
 
     //@{
     /** restart header data */
@@ -1286,8 +1288,8 @@  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)
-                av_log(m->avctx, AV_LOG_INFO, "End of stream indicated.\n");
+            av_log(m->avctx, AV_LOG_DEBUG, "End of stream indicated.\n");
+            s->end_of_stream = 1;
         }
 
         if (substream_parity_present[substr]) {
@@ -1319,6 +1321,16 @@  next_substr:
     if ((ret = output_data(m, m->max_decoded_substream, data, got_frame_ptr)) < 0)
         return ret;
 
+    for (substr = 0; substr <= m->max_decoded_substream; substr++){
+        SubStream *s = &m->substream[substr];
+
+        if (s->end_of_stream) {
+            s->lossless_check_data = 0xffffffff;
+            s->end_of_stream = 0;
+            m->params_valid = 0;
+        }
+    }
+
     return length;
 
 substream_length_mismatch: