Skip to content

Commit bd7c6ae

Browse files
committed
Fix implicit int64 to double conversion in audio seeks
1 parent 57899ee commit bd7c6ae

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/torchcodec/decoders/_core/VideoDecoder.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -912,7 +912,7 @@ VideoDecoder::AudioFramesOutput VideoDecoder::getFramesPlayedInRangeAudio(
912912
// If we need to seek backwards, then we have to seek back to the beginning
913913
// of the stream.
914914
// See [Audio Decoding Design].
915-
setCursorPtsInSecondsInternal(INT64_MIN);
915+
setCursor(INT64_MIN);
916916
}
917917

918918
// TODO-AUDIO Pre-allocate a long-enough tensor instead of creating a vec +
@@ -971,13 +971,13 @@ void VideoDecoder::setCursorPtsInSeconds(double seconds) {
971971
// We don't allow public audio decoding APIs to seek, see [Audio Decoding
972972
// Design]
973973
validateActiveStream(AVMEDIA_TYPE_VIDEO);
974-
setCursorPtsInSecondsInternal(seconds);
974+
setCursor(
975+
secondsToClosestPts(seconds, streamInfos_[activeStreamIndex_].timeBase));
975976
}
976977

977-
void VideoDecoder::setCursorPtsInSecondsInternal(double seconds) {
978+
void VideoDecoder::setCursor(int64_t pts) {
978979
cursorWasJustSet_ = true;
979-
cursor_ =
980-
secondsToClosestPts(seconds, streamInfos_[activeStreamIndex_].timeBase);
980+
cursor_ = pts;
981981
}
982982

983983
/*

src/torchcodec/decoders/_core/VideoDecoder.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ class VideoDecoder {
367367
// DECODING APIS AND RELATED UTILS
368368
// --------------------------------------------------------------------------
369369

370-
void setCursorPtsInSecondsInternal(double seconds);
370+
void setCursor(int64_t pts);
371371
bool canWeAvoidSeeking() const;
372372

373373
void maybeSeekToBeforeDesiredPts();

0 commit comments

Comments
 (0)