File tree Expand file tree Collapse file tree 1 file changed +3
-18
lines changed
src/torchcodec/decoders/_core Expand file tree Collapse file tree 1 file changed +3
-18
lines changed Original file line number Diff line number Diff line change @@ -698,24 +698,9 @@ VideoDecoder::FrameOutput VideoDecoder::getFramePlayedAt(double seconds) {
698698 }
699699
700700 setCursorPtsInSeconds (seconds);
701- AVFrameStream avFrameStream =
702- decodeAVFrame ([seconds, this ](AVFrame* avFrame) {
703- StreamInfo& streamInfo = streamInfos_[activeStreamIndex_];
704- double frameStartTime = ptsToSeconds (avFrame->pts , streamInfo.timeBase );
705- double frameEndTime = ptsToSeconds (
706- avFrame->pts + getDuration (avFrame), streamInfo.timeBase );
707- if (frameStartTime > seconds) {
708- // FFMPEG seeked past the frame we are looking for even though we
709- // set max_ts to be our needed timestamp in avformat_seek_file()
710- // in maybeSeekToBeforeDesiredPts().
711- // This could be a bug in FFMPEG: https://trac.ffmpeg.org/ticket/11137
712- // In this case we return the very next frame instead of throwing an
713- // exception.
714- // TODO: Maybe log to stderr for Debug builds?
715- return true ;
716- }
717- return seconds >= frameStartTime && seconds < frameEndTime;
718- });
701+ AVFrameStream avFrameStream = decodeAVFrame ([this ](AVFrame* avFrame) {
702+ return cursor_ < avFrame->pts + getDuration (avFrame);
703+ });
719704
720705 // Convert the frame to tensor.
721706 FrameOutput frameOutput = convertAVFrameToFrameOutput (avFrameStream);
You can’t perform that action at this time.
0 commit comments