@@ -658,20 +658,16 @@ VideoDecoder::getFramesInRange(int64_t start, int64_t stop, int64_t step) {
658658 return frameBatchOutput;
659659}
660660
661- VideoDecoder::FrameOutput VideoDecoder::getFramePlayedAt (
662- double seconds) {
663- for (auto & [streamIndex, streamInfo] : streamInfos_) {
664- double frameStartTime =
665- ptsToSeconds (streamInfo.currentPts , streamInfo.timeBase );
666- double frameEndTime = ptsToSeconds (
667- streamInfo.currentPts + streamInfo.currentDuration ,
668- streamInfo.timeBase );
669- if (seconds >= frameStartTime && seconds < frameEndTime) {
670- // We are in the same frame as the one we just returned. However, since we
671- // don't cache it locally, we have to rewind back.
672- seconds = frameStartTime;
673- break ;
674- }
661+ VideoDecoder::FrameOutput VideoDecoder::getFramePlayedAt (double seconds) {
662+ StreamInfo& streamInfo = streamInfos_[activeStreamIndex_];
663+ double frameStartTime =
664+ ptsToSeconds (streamInfo.currentPts , streamInfo.timeBase );
665+ double frameEndTime = ptsToSeconds (
666+ streamInfo.currentPts + streamInfo.currentDuration , streamInfo.timeBase );
667+ if (seconds >= frameStartTime && seconds < frameEndTime) {
668+ // We are in the same frame as the one we just returned. However, since we
669+ // don't cache it locally, we have to rewind back.
670+ seconds = frameStartTime;
675671 }
676672
677673 setCursorPtsInSeconds (seconds);
0 commit comments