Skip to content

Commit bc10db8

Browse files
committed
Tweak FrameInfo struct initialization
1 parent 8ed3c5e commit bc10db8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/torchcodec/decoders/_core/VideoDecoder.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,9 @@ void VideoDecoder::scanFileAndUpdateMetadataAndIndex() {
600600
streamMetadata.maxPtsFromScan.value_or(INT64_MIN),
601601
packet->pts + packet->duration);
602602

603-
FrameInfo frameInfo{.pts = packet->pts};
603+
// Note that we set the other value in this struct, nextPts, only after
604+
// we have scanned all packets and sorted by pts.
605+
FrameInfo frameInfo = {.pts = packet->pts};
604606
if (packet->flags & AV_PKT_FLAG_KEY) {
605607
streams_[streamIndex].keyFrames.push_back(frameInfo);
606608
}

0 commit comments

Comments
 (0)