From 969bcc8df97393ad2ec3fc4c36eb8c5084973432 Mon Sep 17 00:00:00 2001 From: Christian Feldmann Date: Thu, 15 Oct 2020 09:40:42 +0200 Subject: [PATCH] Correctly remove frames --- YUViewLib/src/parser/parserAnnexBAVC.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/YUViewLib/src/parser/parserAnnexBAVC.cpp b/YUViewLib/src/parser/parserAnnexBAVC.cpp index 26fb5de62..3c47463fa 100644 --- a/YUViewLib/src/parser/parserAnnexBAVC.cpp +++ b/YUViewLib/src/parser/parserAnnexBAVC.cpp @@ -37,7 +37,7 @@ #include "parserAnnexBItuTT35.h" #include "common/parserMacros.h" -#define PARSER_AVC_DEBUG_OUTPUT 1 +#define PARSER_AVC_DEBUG_OUTPUT 0 #if PARSER_AVC_DEBUG_OUTPUT && !NDEBUG #include #define DEBUG_AVC(msg) qDebug() << msg @@ -2502,6 +2502,7 @@ QList parserAnnexBAVC::HRD::popRemoveFra { QList l; auto it = this->framesToRemove.begin(); + double t_r_previous = 0; while (it != this->framesToRemove.end()) { if ((*it).t_r < from) @@ -2510,8 +2511,15 @@ QList parserAnnexBAVC::HRD::popRemoveFra it = this->framesToRemove.erase(it); continue; } + if ((*it).t_r < t_r_previous) + { + DEBUG_AVC("Warning: Frame " << (*it).poc << " has a removal time (" << double((*it).t_r) << ") before the previous frame (" << t_r_previous << "). Dropping it now."); + it = this->framesToRemove.erase(it); + continue; + } if ((*it).t_r >= from && (*it).t_r < to) { + t_r_previous = (*it).t_r; l.push_back((*it)); it = this->framesToRemove.erase(it); continue;