Skip to content

Commit 86c6ffd

Browse files
committed
Try
1 parent 738a262 commit 86c6ffd

File tree

1 file changed

+1
-21
lines changed

1 file changed

+1
-21
lines changed

src/torchcodec/decoders/_core/VideoDecoder.cpp

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,27 +1079,7 @@ VideoDecoder::FrameOutput VideoDecoder::getFramePlayedAtNoDemux(
10791079
}
10801080

10811081
setCursorPtsInSeconds(seconds);
1082-
AVFrameStream avFrameStream = getAVFrameUsingFilterFunction(
1083-
[seconds, this](int frameStreamIndex, AVFrame* avFrame) {
1084-
StreamInfo& streamInfo = streamInfos_[frameStreamIndex];
1085-
double frameStartTime = ptsToSeconds(avFrame->pts, streamInfo.timeBase);
1086-
double frameEndTime = ptsToSeconds(
1087-
avFrame->pts + getDuration(avFrame), streamInfo.timeBase);
1088-
if (frameStartTime > seconds) {
1089-
// FFMPEG seeked past the frame we are looking for even though we
1090-
// set max_ts to be our needed timestamp in avformat_seek_file()
1091-
// in maybeSeekToBeforeDesiredPts().
1092-
// This could be a bug in FFMPEG: https://trac.ffmpeg.org/ticket/11137
1093-
// In this case we return the very next frame instead of throwing an
1094-
// exception.
1095-
// TODO: Maybe log to stderr for Debug builds?
1096-
return true;
1097-
}
1098-
return seconds >= frameStartTime && seconds < frameEndTime;
1099-
});
1100-
1101-
// Convert the frame to tensor.
1102-
FrameOutput frameOutput = convertAVFrameToFrameOutput(avFrameStream);
1082+
FrameOutput frameOutput = getNextFrameNoDemuxInternal();
11031083
frameOutput.data =
11041084
maybePermuteHWC2CHW(frameOutput.streamIndex, frameOutput.data);
11051085
return frameOutput;

0 commit comments

Comments
 (0)