@@ -845,9 +845,8 @@ I P P P I P P P I P P I P P I P
845845
846846(2) is more efficient than (1) if there is an I frame between x and y.
847847*/
848- bool VideoDecoder::canWeAvoidSeekingForStream (
849- int64_t currentPts,
850- int64_t targetPts) {
848+ bool VideoDecoder::canWeAvoidSeeking (int64_t currentPts, int64_t targetPts)
849+ const {
851850 if (targetPts < currentPts) {
852851 // We can never skip a seek if we are seeking backwards.
853852 return false ;
@@ -880,7 +879,7 @@ void VideoDecoder::maybeSeekToBeforeDesiredPts() {
880879 decodeStats_.numSeeksAttempted ++;
881880
882881 int64_t desiredPtsForStream = *desiredPtsSeconds_ * streamInfo.timeBase .den ;
883- if (canWeAvoidSeekingForStream (streamInfo.currentPts , desiredPtsForStream)) {
882+ if (canWeAvoidSeeking (streamInfo.currentPts , desiredPtsForStream)) {
884883 decodeStats_.numSeeksSkipped ++;
885884 return ;
886885 }
@@ -1472,8 +1471,8 @@ void VideoDecoder::createSwsContext(
14721471// PTS <-> INDEX CONVERSIONS
14731472// --------------------------------------------------------------------------
14741473
1475- int VideoDecoder::getKeyFrameIndexForPts (int64_t pts) {
1476- const StreamInfo& streamInfo = streamInfos_[ activeStreamIndex_] ;
1474+ int VideoDecoder::getKeyFrameIndexForPts (int64_t pts) const {
1475+ const StreamInfo& streamInfo = streamInfos_. at ( activeStreamIndex_) ;
14771476 if (streamInfo.keyFrames .empty ()) {
14781477 return av_index_search_timestamp (
14791478 streamInfo.stream , pts, AVSEEK_FLAG_BACKWARD);
@@ -1484,7 +1483,7 @@ int VideoDecoder::getKeyFrameIndexForPts(int64_t pts) {
14841483
14851484int VideoDecoder::getKeyFrameIndexForPtsUsingScannedIndex (
14861485 const std::vector<VideoDecoder::FrameInfo>& keyFrames,
1487- int64_t pts) {
1486+ int64_t pts) const {
14881487 auto upperBound = std::upper_bound (
14891488 keyFrames.begin (),
14901489 keyFrames.end (),
0 commit comments