Skip to content

Commit 57b08dc

Browse files
committed
fix: decoder queue size maybe too large
1 parent 95bb3cd commit 57b08dc

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

.changeset/slow-walls-reply.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@webav/av-cliper': patch
3+
---
4+
5+
fix: decoder queue size maybe too large

packages/av-cliper/src/clips/mp4-clip.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -685,11 +685,13 @@ class VideoFrameFinder {
685685

686686
#decoding = false;
687687
#startDecode = async (dec: VideoDecoder) => {
688-
if (this.#decoding) return;
689-
this.#decoding = true;
688+
if (this.#decoding || dec.decodeQueueSize > 600) return;
690689

691690
// 启动解码任务,然后重试
692691
let endIdx = this.#videoDecCusorIdx + 1;
692+
if (endIdx > this.samples.length) return;
693+
694+
this.#decoding = true;
693695
// 该 GoP 时间区间有时间匹配,且未被删除的帧
694696
let hasValidFrame = false;
695697
for (; endIdx < this.samples.length; endIdx++) {

0 commit comments

Comments
 (0)