@@ -703,7 +703,6 @@ VideoDecoder::FrameBatchOutput VideoDecoder::getFramesPlayedAt(
703703
704704 const auto & streamMetadata =
705705 containerMetadata_.allStreamMetadata [activeStreamIndex_];
706- const auto & streamInfo = streamInfos_[activeStreamIndex_];
707706
708707 double minSeconds = getMinSeconds (streamMetadata);
709708 double maxSeconds = getMaxSeconds (streamMetadata);
@@ -723,7 +722,7 @@ VideoDecoder::FrameBatchOutput VideoDecoder::getFramesPlayedAt(
723722 std::to_string (maxSeconds) + " )." );
724723
725724 frameIndices[i] =
726- secondsToIndexLowerBound (frameSeconds, streamInfo, streamMetadata );
725+ secondsToIndexLowerBound (frameSeconds);
727726 }
728727
729728 return getFramesAtIndices (frameIndices);
@@ -795,7 +794,7 @@ VideoDecoder::FrameBatchOutput VideoDecoder::getFramesPlayedInRange(
795794 // frame's pts, but before the next frames's pts.
796795
797796 int64_t startFrameIndex =
798- secondsToIndexLowerBound (startSeconds, streamInfo, streamMetadata );
797+ secondsToIndexLowerBound (startSeconds);
799798 int64_t stopFrameIndex =
800799 secondsToIndexUpperBound (stopSeconds, streamInfo, streamMetadata);
801800 int64_t numFrames = stopFrameIndex - startFrameIndex;
@@ -1499,10 +1498,8 @@ int VideoDecoder::getKeyFrameIndexForPtsUsingScannedIndex(
14991498 return upperBound - 1 - keyFrames.begin ();
15001499}
15011500
1502- int64_t VideoDecoder::secondsToIndexLowerBound (
1503- double seconds,
1504- const StreamInfo& streamInfo,
1505- const StreamMetadata& streamMetadata) {
1501+ int64_t VideoDecoder::secondsToIndexLowerBound (double seconds) {
1502+ auto & streamInfo = streamInfos_[activeStreamIndex_];
15061503 switch (seekMode_) {
15071504 case SeekMode::exact: {
15081505 auto frame = std::lower_bound (
@@ -1515,8 +1512,10 @@ int64_t VideoDecoder::secondsToIndexLowerBound(
15151512
15161513 return frame - streamInfo.allFrames .begin ();
15171514 }
1518- case SeekMode::approximate:
1515+ case SeekMode::approximate: {
1516+ auto & streamMetadata = containerMetadata_.allStreamMetadata [activeStreamIndex_];
15191517 return std::floor (seconds * streamMetadata.averageFps .value ());
1518+ }
15201519 default :
15211520 throw std::runtime_error (" Unknown SeekMode" );
15221521 }
0 commit comments