Skip to content

Commit b3dc451

Browse files
authored
Rename maybeDesiredPts_ into desiredPts_ (#471)
1 parent 0048f01 commit b3dc451

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/torchcodec/decoders/_core/VideoDecoder.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,7 @@ void VideoDecoder::maybeSeekToBeforeDesiredPts() {
746746
for (int streamIndex : activeStreamIndices_) {
747747
StreamInfo& streamInfo = streamInfos_[streamIndex];
748748
// clang-format off: clang format clashes
749-
streamInfo.discardFramesBeforePts = secondsToClosestPts(*maybeDesiredPts_, streamInfo.timeBase);
749+
streamInfo.discardFramesBeforePts = secondsToClosestPts(*desiredPtsSeconds_, streamInfo.timeBase);
750750
// clang-format on
751751
}
752752

@@ -756,7 +756,7 @@ void VideoDecoder::maybeSeekToBeforeDesiredPts() {
756756
bool mustSeek = false;
757757
for (int streamIndex : activeStreamIndices_) {
758758
StreamInfo& streamInfo = streamInfos_[streamIndex];
759-
int64_t desiredPtsForStream = *maybeDesiredPts_ * streamInfo.timeBase.den;
759+
int64_t desiredPtsForStream = *desiredPtsSeconds_ * streamInfo.timeBase.den;
760760
if (!canWeAvoidSeekingForStream(
761761
streamInfo, streamInfo.currentPts, desiredPtsForStream)) {
762762
mustSeek = true;
@@ -770,7 +770,7 @@ void VideoDecoder::maybeSeekToBeforeDesiredPts() {
770770
int firstActiveStreamIndex = *activeStreamIndices_.begin();
771771
const auto& firstStreamInfo = streamInfos_[firstActiveStreamIndex];
772772
int64_t desiredPts =
773-
secondsToClosestPts(*maybeDesiredPts_, firstStreamInfo.timeBase);
773+
secondsToClosestPts(*desiredPtsSeconds_, firstStreamInfo.timeBase);
774774

775775
// For some encodings like H265, FFMPEG sometimes seeks past the point we
776776
// set as the max_ts. So we use our own index to give it the exact pts of
@@ -809,9 +809,9 @@ VideoDecoder::RawDecodedOutput VideoDecoder::getDecodedOutputWithFilter(
809809
throw std::runtime_error("No active streams configured.");
810810
}
811811
resetDecodeStats();
812-
if (maybeDesiredPts_.has_value()) {
812+
if (desiredPtsSeconds_.has_value()) {
813813
maybeSeekToBeforeDesiredPts();
814-
maybeDesiredPts_ = std::nullopt;
814+
desiredPtsSeconds_ = std::nullopt;
815815
}
816816
// Need to get the next frame or error from PopFrame.
817817
UniqueAVFrame avFrame(av_frame_alloc());
@@ -1487,7 +1487,7 @@ VideoDecoder::DecodedOutput VideoDecoder::getNextFrameNoDemuxInternal(
14871487
}
14881488

14891489
void VideoDecoder::setCursorPtsInSeconds(double seconds) {
1490-
maybeDesiredPts_ = seconds;
1490+
desiredPtsSeconds_ = seconds;
14911491
}
14921492

14931493
VideoDecoder::DecodeStats VideoDecoder::getDecodeStats() const {

src/torchcodec/decoders/_core/VideoDecoder.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ class VideoDecoder {
438438
std::set<int> activeStreamIndices_;
439439
// Set when the user wants to seek and stores the desired pts that the user
440440
// wants to seek to.
441-
std::optional<double> maybeDesiredPts_;
441+
std::optional<double> desiredPtsSeconds_;
442442

443443
// Stores various internal decoding stats.
444444
DecodeStats decodeStats_;

0 commit comments

Comments
 (0)