From d764a62aa2a73e25bc70704206b0ec32a0d12f7c Mon Sep 17 00:00:00 2001 From: Gabriel Hege Date: Tue, 5 Nov 2024 12:23:08 +0100 Subject: [PATCH 1/2] fix implicit downcasting to Exception closes #216 --- source/Lib/CommonLib/TypeDef.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index 1cda5b00..782b2519 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -743,8 +743,10 @@ class Exception : public std::exception virtual ~Exception() noexcept = default; CLASS_COPY_MOVE_DEFAULT( Exception ) - virtual const char* what() const noexcept { return m_str.c_str(); } - template Exception& operator<<( const T& t ) { std::ostringstream oss; oss << t; m_str += oss.str(); return *this; } + virtual const char* what() const noexcept { return m_str.c_str(); } + template + inline Exception& operator<<( const T& t ) { std::ostringstream oss; oss << t; m_str += oss.str(); return *this; } + private: std::string m_str; }; @@ -755,6 +757,9 @@ class RecoverableException : public Exception explicit RecoverableException( const std::string& _s ) : Exception( _s ) {} virtual ~RecoverableException() noexcept = default; CLASS_COPY_MOVE_DEFAULT( RecoverableException ) + + template + inline RecoverableException& operator<<( const T& t ) { static_cast( *this ) << t; return *this; } }; class UnsupportedFeatureException : public Exception @@ -763,6 +768,9 @@ class UnsupportedFeatureException : public Exception explicit UnsupportedFeatureException( const std::string& _s ) : Exception( _s ) {} virtual ~UnsupportedFeatureException() noexcept = default; CLASS_COPY_MOVE_DEFAULT( UnsupportedFeatureException ) + + template + inline UnsupportedFeatureException& operator<<( const T& t ) { static_cast( *this ) << t; return *this; } }; #if defined( __MINGW32__ ) && !defined( __MINGW64__ ) From 9bc074175a4b2c772a7d49aaface40d57c9fb1df Mon Sep 17 00:00:00 2001 From: Gabriel Hege Date: Thu, 7 Nov 2024 15:24:00 +0100 Subject: [PATCH 2/2] fix deadlock after parse errors, when running with parseDelay = 0 --- source/Lib/DecoderLib/DecLibParser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/Lib/DecoderLib/DecLibParser.cpp b/source/Lib/DecoderLib/DecLibParser.cpp index 2f893d7e..2fff9b86 100644 --- a/source/Lib/DecoderLib/DecLibParser.cpp +++ b/source/Lib/DecoderLib/DecLibParser.cpp @@ -247,7 +247,7 @@ bool DecLibParser::parse( InputNALUnit& nalu ) const VPS* vps = m_parameterSetManager.getVPS( sps->getVPSId() ); m_seiReader.parseSEImessage( &( nalu.getBitstream() ), m_pcParsePic->seiMessageList, nalu.m_nalUnitType, nalu.m_nuhLayerId, nalu.m_temporalId, vps, sps, m_HRD, m_pDecodedSEIOutputStream ); - if( m_parseFrameDelay == 0 ) // else it has to be done in finishPicture() + if( m_parseFrameDelay == 0 && !m_pcParsePic->error ) // if m_parseFrameDelay > 0, it has to be done in finishPicture() { // if parallel parsing is disabled, wait for the picture to finish if( m_threadPool->numThreads() == 0 )