diff --git a/tools/replay/framereader.cc b/tools/replay/framereader.cc index 28d9a75f7d9b1a..a5a8bcbd37b961 100644 --- a/tools/replay/framereader.cc +++ b/tools/replay/framereader.cc @@ -177,8 +177,10 @@ bool VideoDecoder::decode(FrameReader *reader, int idx, VisionBuf *buf) { break; } } - avio_seek(reader->input_ctx->pb, reader->packets_info[from_idx].pos, SEEK_SET); - avcodec_flush_buffers(decoder_ctx); + 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); + } } reader->prev_idx = idx;