Skip to content

Commit 8dd9b0a

Browse files
committed
Address comments
1 parent d43dd91 commit 8dd9b0a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/torchcodec/decoders/_core/VideoDecoder.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,6 +1100,8 @@ VideoDecoder::BatchDecodedOutput VideoDecoder::getFramesDisplayedByTimestamps(
11001100
// eps` are probably the same frame, with the same index. The easiest way to
11011101
// avoid decoding that unique frame twice is to convert the input timestamps
11021102
// to indices, and leverage the de-duplication logic of getFramesAtIndices.
1103+
// This means this function requires a scan.
1104+
// TODO: longer term, we should implement this without requiring a scan
11031105

11041106
const auto& streamMetadata = containerMetadata_.streams[streamIndex];
11051107
const auto& stream = streams_[streamIndex];
@@ -1119,8 +1121,8 @@ VideoDecoder::BatchDecodedOutput VideoDecoder::getFramesDisplayedByTimestamps(
11191121
stream.allFrames.begin(),
11201122
stream.allFrames.end() - 1,
11211123
framePts,
1122-
[&stream](const FrameInfo& info, double start) {
1123-
return ptsToSeconds(info.nextPts, stream.timeBase) <= start;
1124+
[&stream](const FrameInfo& info, double framePts) {
1125+
return ptsToSeconds(info.nextPts, stream.timeBase) <= framePts;
11241126
});
11251127
int64_t frameIndex = it - stream.allFrames.begin();
11261128
frameIndices[i] = frameIndex;

0 commit comments

Comments
 (0)