From 6c753b6b53019ba73f27b7b923e8ad617db35338 Mon Sep 17 00:00:00 2001 From: Scott Schneider Date: Thu, 6 Mar 2025 07:21:52 -0800 Subject: [PATCH] Status refactor stragglers --- src/torchcodec/decoders/_core/VideoDecoder.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/torchcodec/decoders/_core/VideoDecoder.cpp b/src/torchcodec/decoders/_core/VideoDecoder.cpp index 3f064b81e..7797be2ba 100644 --- a/src/torchcodec/decoders/_core/VideoDecoder.cpp +++ b/src/torchcodec/decoders/_core/VideoDecoder.cpp @@ -289,12 +289,11 @@ void VideoDecoder::scanFileAndUpdateMetadataAndIndex() { } // Reset the seek-cursor back to the beginning. - int ffmepgStatus = - avformat_seek_file(formatContext_.get(), 0, INT64_MIN, 0, 0, 0); - if (ffmepgStatus < 0) { + int status = avformat_seek_file(formatContext_.get(), 0, INT64_MIN, 0, 0, 0); + if (status < 0) { throw std::runtime_error( "Could not seek file to pts=0: " + - getFFMPEGErrorStringFromErrorCode(ffmepgStatus)); + getFFMPEGErrorStringFromErrorCode(status)); } // Sort all frames by their pts. @@ -923,17 +922,17 @@ void VideoDecoder::maybeSeekToBeforeDesiredPts() { desiredPts = streamInfo.keyFrames[desiredKeyFrameIndex].pts; } - int ffmepgStatus = avformat_seek_file( + int status = avformat_seek_file( formatContext_.get(), streamInfo.streamIndex, INT64_MIN, desiredPts, desiredPts, 0); - if (ffmepgStatus < 0) { + if (status < 0) { throw std::runtime_error( "Could not seek file to pts=" + std::to_string(desiredPts) + ": " + - getFFMPEGErrorStringFromErrorCode(ffmepgStatus)); + getFFMPEGErrorStringFromErrorCode(status)); } decodeStats_.numFlushes++; avcodec_flush_buffers(streamInfo.codecContext.get());