openh264 icon indicating copy to clipboard operation
openh264 copied to clipboard

Another frame decode error.

Open tyan0 opened this issue 2 years ago • 1 comments

Openh264 fails to decode mp4 file: https://tyan0.yr32.net/openh264/decode_frame_error2.mp4 with error.

I am not sure this is the right thing, however, the following patch solves the issue.

diff --git a/codec/decoder/core/src/decoder.cpp b/codec/decoder/core/src/decoder.cpp
index dba6711b..9270b61a 100644
--- a/codec/decoder/core/src/decoder.cpp
+++ b/codec/decoder/core/src/decoder.cpp
@@ -796,14 +796,13 @@ int32_t WelsDecodeBs (PWelsDecoderContext pCtx, const uint8_t* kpBsBuf, const in
           bNalStartBytes = true;
         } else if (pSrcNal[2 + iSrcIdx] == 0x03) {
           if ((3 + iSrcConsumed < iSrcLength) && pSrcNal[3 + iSrcIdx] > 0x03) {
-            pCtx->iErrorCode |= dsBitstreamError;
-            return pCtx->iErrorCode;
+            /* Just skip */
           } else {
             ST16 (pDstNal + iDstIdx, 0);
             iDstIdx      += 2;
-            iSrcIdx      += 3;
-            iSrcConsumed += 3;
           }
+          iSrcIdx      += 3;
+          iSrcConsumed += 3;
         } else { // 0x01
           bNalStartBytes = false;
 

Could maintainer please have a look?

tyan0 avatar Dec 10 '23 11:12 tyan0

This errror handling was added by the commit https://github.com/cisco/openh264/commit/e90068c234a8f93df01b30b0d3de9ca8d8915c1d mearged from PR https://github.com/cisco/openh264/pull/2070. What situation is this necessary? And does the above code change break this fix?

tyan0 avatar Dec 10 '23 12:12 tyan0