File tree Expand file tree Collapse file tree 2 files changed +4
-13
lines changed
src/torchcodec/decoders/_core Expand file tree Collapse file tree 2 files changed +4
-13
lines changed Original file line number Diff line number Diff line change @@ -550,14 +550,6 @@ torch::Tensor VideoDecoder::getKeyFrameIndices(int streamIndex) {
550550 return keyFrameIndices;
551551}
552552
553- int VideoDecoder::getKeyFrameIndexForPtsUsingEncoderIndex (
554- AVStream* stream,
555- int64_t pts) const {
556- int currentKeyFrameIndex =
557- av_index_search_timestamp (stream, pts, AVSEEK_FLAG_BACKWARD);
558- return currentKeyFrameIndex;
559- }
560-
561553int VideoDecoder::getKeyFrameIndexForPtsUsingScannedIndex (
562554 const std::vector<VideoDecoder::FrameInfo>& keyFrames,
563555 int64_t pts) const {
@@ -694,9 +686,11 @@ int VideoDecoder::getKeyFrameIndexForPts(
694686 const StreamInfo& streamInfo,
695687 int64_t pts) const {
696688 if (streamInfo.keyFrames .empty ()) {
697- return getKeyFrameIndexForPtsUsingEncoderIndex (streamInfo.stream , pts);
689+ return av_index_search_timestamp (
690+ streamInfo.stream , pts, AVSEEK_FLAG_BACKWARD);
691+ } else {
692+ return getKeyFrameIndexForPtsUsingScannedIndex (streamInfo.keyFrames , pts);
698693 }
699- return getKeyFrameIndexForPtsUsingScannedIndex (streamInfo.keyFrames , pts);
700694}
701695
702696/*
Original file line number Diff line number Diff line change @@ -423,9 +423,6 @@ class VideoDecoder {
423423 int getKeyFrameIndexForPtsUsingScannedIndex (
424424 const std::vector<VideoDecoder::FrameInfo>& keyFrames,
425425 int64_t pts) const ;
426- // Return key frame index, from FFmpeg. Potentially less accurate
427- int getKeyFrameIndexForPtsUsingEncoderIndex (AVStream* stream, int64_t pts)
428- const ;
429426
430427 int64_t secondsToIndexLowerBound (
431428 double seconds,
You can’t perform that action at this time.
0 commit comments