Skip to content

Commit

Permalink
fix(avrender): 修复 audioContext 处于 suspended 状态时无法完成 stop 调用
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaohappy committed Nov 23, 2024
1 parent 187ce78 commit 34d3cb5
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion dist/avplayer-ui/118.avplayer.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/avplayer-ui/avplayer.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/avplayer/118.avplayer.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/avplayer/avplayer.js

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions src/avpipeline/AudioRenderPipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,10 @@ export default class AudioRenderPipeline extends Pipeline {
public async unregisterTask(taskId: string): Promise<void> {
const task = this.tasks.get(taskId)
if (task) {
if (task.fakePlayTimer) {
clearTimeout(task.fakePlayTimer)
task.fakePlayTimer = null
}
if (task.resampler) {
task.resampler.close()
}
Expand Down
2 changes: 1 addition & 1 deletion src/avrender/pcm/AudioSourceWorkletProcessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export default class AudioSourceWorkletProcessor extends AudioWorkletProcessorBa

case 'stop': {

if (!this.ended && !this.pause) {
if (!this.ended && !this.pause && !this.frontBuffered) {
await new Promise<void>((resolve) => {
this.afterPullResolve = resolve
})
Expand Down
2 changes: 1 addition & 1 deletion src/avrender/pcm/AudioSourceWorkletProcessor2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export default class AudioSourceWorkletProcessor2 extends AudioWorkletProcessorB

case 'stop': {

if (!this.ended && !this.pause) {
if (!this.ended && !this.pause && !this.frontBuffered) {
await new Promise<void>((resolve) => {
this.afterPullResolve = resolve
})
Expand Down
2 changes: 1 addition & 1 deletion src/avrender/pcm/AudioSourceWorkletProcessor2_.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/avrender/pcm/AudioSourceWorkletProcessor_.js

Large diffs are not rendered by default.

0 comments on commit 34d3cb5

Please sign in to comment.