From 557db18e97bbe593af9e1236badcd72233cd8a1a Mon Sep 17 00:00:00 2001 From: Scott Schneider Date: Thu, 15 May 2025 08:50:19 -0700 Subject: [PATCH] Avoid shadowing local variables --- src/torchcodec/_core/SingleStreamDecoder.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/torchcodec/_core/SingleStreamDecoder.cpp b/src/torchcodec/_core/SingleStreamDecoder.cpp index b73f7038..b21977c9 100644 --- a/src/torchcodec/_core/SingleStreamDecoder.cpp +++ b/src/torchcodec/_core/SingleStreamDecoder.cpp @@ -630,15 +630,15 @@ FrameBatchOutput SingleStreamDecoder::getFramesInRange( FrameOutput SingleStreamDecoder::getFramePlayedAt(double seconds) { validateActiveStream(AVMEDIA_TYPE_VIDEO); StreamInfo& streamInfo = streamInfos_[activeStreamIndex_]; - double frameStartTime = + double lastDecodedStartTime = ptsToSeconds(streamInfo.lastDecodedAvFramePts, streamInfo.timeBase); - double frameEndTime = ptsToSeconds( + double lastDecodedEndTime = ptsToSeconds( streamInfo.lastDecodedAvFramePts + streamInfo.lastDecodedAvFrameDuration, streamInfo.timeBase); - if (seconds >= frameStartTime && seconds < frameEndTime) { + if (seconds >= lastDecodedStartTime && seconds < lastDecodedEndTime) { // We are in the same frame as the one we just returned. However, since we // don't cache it locally, we have to rewind back. - seconds = frameStartTime; + seconds = lastDecodedStartTime; } setCursorPtsInSeconds(seconds);