Skip to content

Commit 9acc148

Browse files
committed
Merge branch 'main' of github.com:pytorch/torchcodec into avoid_seeking_checks
2 parents 42409a9 + 982102b commit 9acc148

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/torchcodec/_core/SingleStreamDecoder.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,7 +1116,11 @@ bool SingleStreamDecoder::canWeAvoidSeeking() const {
11161116
// within getFramesPlayedInRangeAudio(), when setCursorPtsInSeconds() was
11171117
// called. For more context, see [Audio Decoding Design]
11181118
return !cursorWasJustSet_;
1119+
} else if (!cursorWasJustSet_) {
1120+
// For videos, when decoding consecutive frames, we don't need to seek.
1121+
return true;
11191122
}
1123+
11201124
if (cursor_ < lastDecodedAvFramePts_) {
11211125
// We can never skip a seek if we are seeking backwards.
11221126
return false;

0 commit comments

Comments
 (0)