From 54a6569ab398906ecf0923835454e0c7319ac4fe Mon Sep 17 00:00:00 2001
From: Remy Foray <remy.foray@allegrodvt.com>
Date: Wed, 7 Oct 2020 12:29:58 +0200
Subject: [PATCH] Fix output picture present in bistream checking

Update of outputPicturePresentInBitstream shall be done before all
xWriteOutput(), else picture might be outputed without this flag set.
---
 source/App/DecoderApp/DecApp.cpp | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/source/App/DecoderApp/DecApp.cpp b/source/App/DecoderApp/DecApp.cpp
index fba0ff3ef..aafdd465a 100644
--- a/source/App/DecoderApp/DecApp.cpp
+++ b/source/App/DecoderApp/DecApp.cpp
@@ -329,6 +329,9 @@ uint32_t DecApp::decode()
       }
       if (nalu.m_nalUnitType == NAL_UNIT_EOS)
       {
+#if JVET_S0202_AT_LEAST_ONE_OUTPUT_PICTURE
+        setOutputPicturePresentInStream();
+#endif
         xWriteOutput( pcListPic, nalu.m_temporalId );
         m_cDecLib.setFirstSliceInPicture (false);
       }
@@ -336,6 +339,9 @@ uint32_t DecApp::decode()
       if (!bNewPicture && ((nalu.m_nalUnitType >= NAL_UNIT_CODED_SLICE_TRAIL && nalu.m_nalUnitType <= NAL_UNIT_RESERVED_IRAP_VCL_12)
         || (nalu.m_nalUnitType >= NAL_UNIT_CODED_SLICE_IDR_W_RADL && nalu.m_nalUnitType <= NAL_UNIT_CODED_SLICE_GDR)))
       {
+#if JVET_S0202_AT_LEAST_ONE_OUTPUT_PICTURE
+        setOutputPicturePresentInStream();
+#endif
         xWriteOutput( pcListPic, nalu.m_temporalId );
       }
     }
-- 
GitLab