Skip to content

Commit 3a8839d

Browse files
committed
Better fix
1 parent 7d26623 commit 3a8839d

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/torchcodec/decoders/_core/VideoDecoder.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1117,13 +1117,12 @@ VideoDecoder::BatchDecodedOutput VideoDecoder::getFramesDisplayedByTimestamps(
11171117

11181118
auto it = std::lower_bound(
11191119
stream.allFrames.begin(),
1120-
stream.allFrames.end(),
1120+
stream.allFrames.end() - 1,
11211121
framePts,
11221122
[&stream](const FrameInfo& info, double start) {
11231123
return ptsToSeconds(info.nextPts, stream.timeBase) <= start;
11241124
});
11251125
int64_t frameIndex = it - stream.allFrames.begin();
1126-
frameIndex = std::min(frameIndex, (int64_t)stream.allFrames.size() - 1);
11271126
frameIndices[i] = frameIndex;
11281127
}
11291128

0 commit comments

Comments
 (0)