From c6078afc24bd383e2cf35b09eadd96b12bac9954 Mon Sep 17 00:00:00 2001 From: Thulinma Date: Fri, 12 Jul 2024 13:04:25 +0200 Subject: [PATCH] Fix track dropping code not always dropping the userSelect when it should/could --- src/output/output.cpp | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/output/output.cpp b/src/output/output.cpp index a7da7280..b42e7ce1 100644 --- a/src/output/output.cpp +++ b/src/output/output.cpp @@ -2015,12 +2015,10 @@ namespace Mist{ // depending on whether this is probably bad and the current debug level, print a message size_t printLevel = (probablyBad ? DLVL_WARN : DLVL_INFO); //The rest of the operations depends on userSelect, so we ignore it if it doesn't exist. - if (!M || !M.getValidTracks().count(trackId)){ - DEBUG_MSG(printLevel, "Dropping invalid track %zu: %s", trackId, reason.c_str()); - return; - } if (!userSelect.count(trackId)){ - if (M.hasEmbeddedFrames(trackId)){ + if (!M || !M.getValidTracks().count(trackId)){ + DEBUG_MSG(printLevel, "Dropping invalid track %zu: %s", trackId, reason.c_str()); + }else if (M.hasEmbeddedFrames(trackId)){ DEBUG_MSG(printLevel, "Dropping %s track %zu (raw): %s", meta.getCodec(trackId).c_str(), trackId, reason.c_str()); }else{ DEBUG_MSG(printLevel, "Dropping %s track %zu (lastP=%" PRIu64 "): %s", @@ -2033,12 +2031,20 @@ namespace Mist{ DEBUG_MSG(printLevel, "Dropping %s track %zu (raw): %s", meta.getCodec(trackId).c_str(), trackId, reason.c_str()); }else{ if (!usr){ - DEBUG_MSG(printLevel, "Dropping %s track %zu (lastP=%" PRIu64 "): %s", - meta.getCodec(trackId).c_str(), trackId, pageNumMax(trackId), reason.c_str()); + if (!M || !M.getValidTracks().count(trackId)){ + DEBUG_MSG(printLevel, "Dropping invalid track %zu: %s", trackId, reason.c_str()); + }else{ + DEBUG_MSG(printLevel, "Dropping %s track %zu (lastP=%" PRIu64 "): %s", + meta.getCodec(trackId).c_str(), trackId, pageNumMax(trackId), reason.c_str()); + } }else{ - DEBUG_MSG(printLevel, "Dropping %s track %zu@k%zu (nextP=%" PRIu64 ", lastP=%" PRIu64 "): %s", - meta.getCodec(trackId).c_str(), trackId, usr.getKeyNum() + 1, - pageNumForKey(trackId, usr.getKeyNum() + 1), pageNumMax(trackId), reason.c_str()); + if (!M || !M.getValidTracks().count(trackId)){ + DEBUG_MSG(printLevel, "Dropping invalid track %zu: %s", trackId, reason.c_str()); + }else{ + DEBUG_MSG(printLevel, "Dropping %s track %zu@k%zu (nextP=%" PRIu64 ", lastP=%" PRIu64 "): %s", + meta.getCodec(trackId).c_str(), trackId, usr.getKeyNum() + 1, + pageNumForKey(trackId, usr.getKeyNum() + 1), pageNumMax(trackId), reason.c_str()); + } } } userSelect.erase(trackId);