diff --git a/.changeset/slow-walls-reply.md b/.changeset/slow-walls-reply.md new file mode 100644 index 00000000..c2b4b600 --- /dev/null +++ b/.changeset/slow-walls-reply.md @@ -0,0 +1,5 @@ +--- +'@webav/av-cliper': patch +--- + +fix: decoder queue size maybe too large diff --git a/packages/av-cliper/src/clips/mp4-clip.ts b/packages/av-cliper/src/clips/mp4-clip.ts index a8ccd09a..8f34e075 100644 --- a/packages/av-cliper/src/clips/mp4-clip.ts +++ b/packages/av-cliper/src/clips/mp4-clip.ts @@ -685,11 +685,13 @@ class VideoFrameFinder { #decoding = false; #startDecode = async (dec: VideoDecoder) => { - if (this.#decoding) return; - this.#decoding = true; + if (this.#decoding || dec.decodeQueueSize > 600) return; // 启动解码任务,然后重试 let endIdx = this.#videoDecCusorIdx + 1; + if (endIdx > this.samples.length) return; + + this.#decoding = true; // 该 GoP 时间区间有时间匹配,且未被删除的帧 let hasValidFrame = false; for (; endIdx < this.samples.length; endIdx++) {