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) {
550
550
return keyFrameIndices;
551
551
}
552
552
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
-
561
553
int VideoDecoder::getKeyFrameIndexForPtsUsingScannedIndex (
562
554
const std::vector<VideoDecoder::FrameInfo>& keyFrames,
563
555
int64_t pts) const {
@@ -694,9 +686,11 @@ int VideoDecoder::getKeyFrameIndexForPts(
694
686
const StreamInfo& streamInfo,
695
687
int64_t pts) const {
696
688
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);
698
693
}
699
- return getKeyFrameIndexForPtsUsingScannedIndex (streamInfo.keyFrames , pts);
700
694
}
701
695
702
696
/*
Original file line number Diff line number Diff line change @@ -423,9 +423,6 @@ class VideoDecoder {
423
423
int getKeyFrameIndexForPtsUsingScannedIndex (
424
424
const std::vector<VideoDecoder::FrameInfo>& keyFrames,
425
425
int64_t pts) const ;
426
- // Return key frame index, from FFmpeg. Potentially less accurate
427
- int getKeyFrameIndexForPtsUsingEncoderIndex (AVStream* stream, int64_t pts)
428
- const ;
429
426
430
427
int64_t secondsToIndexLowerBound (
431
428
double seconds,
You can’t perform that action at this time.
0 commit comments