From 4c173552bd076b15799a9787eb38062a009f57b8 Mon Sep 17 00:00:00 2001 From: arch1t3cht Date: Thu, 23 Apr 2026 18:00:27 +0200 Subject: [PATCH 1/2] Fix flag comparisons in FindPacket This did not actually break any samples because even the PTS + Pos combination was enough to uniquely identify all packets in the test files, but before this commit the Hidden comparison was broken on packets that had a Hidden flag set. After this commit, all FindPacket calls in all test cases find the packet using the first check (comparing all fields) or not at all. --- src/core/track.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/track.cpp b/src/core/track.cpp index 18f948bca2..c129ebaa7b 100644 --- a/src/core/track.cpp +++ b/src/core/track.cpp @@ -213,9 +213,9 @@ int FFMS_Track::FindPacket(const AVPacket &packet) const { case AVPacketProp::Pos: return it->FilePos == packet.pos; case AVPacketProp::Hidden: - return it->MarkedHidden == (packet.flags & AV_PKT_FLAG_DISCARD); + return it->MarkedHidden == !!(packet.flags & AV_PKT_FLAG_DISCARD); case AVPacketProp::Key: - return it->KeyFrame == (packet.flags & AV_PKT_FLAG_KEY); + return it->KeyFrame == !!(packet.flags & AV_PKT_FLAG_KEY); } return false; }); From ed80530ed566aaa0d936eb97b4c7ca2ea0a70cce Mon Sep 17 00:00:00 2001 From: arch1t3cht Date: Thu, 23 Apr 2026 18:27:24 +0200 Subject: [PATCH 2/2] Don't try to find EOF packets in FindPacket Apart from being a tiny optimization this makes it easier to check for which sample files there are packets are not being found. --- src/core/track.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/core/track.cpp b/src/core/track.cpp index c129ebaa7b..4c89cef521 100644 --- a/src/core/track.cpp +++ b/src/core/track.cpp @@ -185,6 +185,11 @@ const std::array, 5> FindPacketCheckSequence = {{ // If examples come up where this fallback sequence becomes relevant, it can // be adjusted. int FFMS_Track::FindPacket(const AVPacket &packet) const { + if (!packet.data && !packet.side_data_elems) { + // Empty packet signaling EOF + return -1; + } + FrameInfo F; F.PTS = UseDTS ? packet.dts : packet.pts;