Skip to content

Commit

Permalink
exit early
Browse files Browse the repository at this point in the history
  • Loading branch information
deanlee committed Dec 16, 2024
1 parent 485ab21 commit 70b3037
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tools/replay/framereader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,14 @@ bool VideoDecoder::decode(FrameReader *reader, int idx, VisionBuf *buf) {
break;
}
}

auto pos = reader->packets_info[from_idx].pos;
if (avformat_seek_file(reader->input_ctx, 0, pos, pos, pos, AVSEEK_FLAG_BYTE) >= 0) {
avcodec_flush_buffers(decoder_ctx);
int ret = avformat_seek_file(reader->input_ctx, 0, pos, pos, pos, AVSEEK_FLAG_BYTE);
if (ret < 0) {
rError("Failed to seek to byte position %lld: %d", pos, AVERROR(ret));
return false;
}
avcodec_flush_buffers(decoder_ctx);
}
reader->prev_idx = idx;

Expand Down

0 comments on commit 70b3037

Please sign in to comment.