Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions src/torchcodec/decoders/_core/VideoDecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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());
Expand Down
Loading