From a148a82fe7ad005a6b978744383bd4c488cbf06d Mon Sep 17 00:00:00 2001 From: deanlee Date: Wed, 11 Dec 2024 20:00:18 +0800 Subject: [PATCH] replace avio_seek with the higher-level avformat_seek_file --- tools/replay/framereader.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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;