Skip to content

Commit

Permalink
fix: decoder queue size maybe too large
Browse files Browse the repository at this point in the history
  • Loading branch information
hughfenghen committed Jan 7, 2025
1 parent 95bb3cd commit 57b08dc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/slow-walls-reply.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@webav/av-cliper': patch
---

fix: decoder queue size maybe too large
6 changes: 4 additions & 2 deletions packages/av-cliper/src/clips/mp4-clip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down

0 comments on commit 57b08dc

Please sign in to comment.