Closed Bug 1656847 Opened 4 years ago Closed 4 years ago

decodeAudioData Promise is never fullfilled

Categories

(Core :: Web Audio, defect)

80 Branch
defect

Tracking

()

RESOLVED DUPLICATE of bug 1653638

People

(Reporter: francexi, Unassigned)

References

(Regression)

Details

(Keywords: regression)

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:80.0) Gecko/20100101 Firefox/80.0

Steps to reproduce:

load an OGG Vorbis file using Fetch API as ArrayBuffer, then try to decode it using decodeAudioData() from a valid AudioContext

Here the code I use:

let myRequest = new Request(url);

fetch(myRequest).then(function(response) {
return response.arrayBuffer();
}).then(function(data) {
const promise1 = audioCtx.decodeAudioData(data)
promises.push(promise1); //here to check later the promise
promise1.then(function(buffer) {
/* do stuff */
});
});

Actual results:

The Promise returned from decodeAudioData is always into the state "pending" and never goes into fullfilled.

If you set some callback functions, they are never called, both the succesful and the error one

Expected results:

Promise goes fullfilled when the decoding is finished and/or callback function is called

Bugbug thinks this bug should belong to this component, but please revert this change in case of error.

Component: Untriaged → Web Audio
Product: Firefox → Core

This works well here in Firefox Nightly on macOS, and is tested, and tests are passing.

Please provide a copy of about:support (copy raw data), and the exact code you're testing with (i.e. a working example).

Flags: needinfo?(francexi)

on https://spy-cards.lubar.me (none of the code on the page is required for this snippet to run, just the relative URL)

buzzer = await (await fetch("audio/Buzzer.opus")).arrayBuffer();
actx = new AudioContext();
await actx.decodeAudioData(buzzer, function(x){debugger}, function(y){debugger});

the promise does not resolve or reject, and the debugger statements are not reached.

without the callback functions, the behavior is the same (the promise never resolves or rejects).

i found a little workaround. Putting this line before the decodeAudioData makes it work:
if(audioCtx.state === "suspended") await audioCtx.resume();

I noticed console logging the context before calling decodeAudioData that its state was suspended, resuming it did the trick. Anyway the bug seems to be that if decodeAudioData is called while the context is suspended, it will never be fullfilled, even if the context resumes later. I'm also kinda positive that the audio context should not be suspended at initizialization time.

Tried the code without the workaround on Chromium, there works properly

Flags: needinfo?(francexi)

Additional information:

Additional informations:

  • Firefox Developer Edition on Slackware64 current
  • The code worked perfectly on Firefox 79

This appears to be fixed for spy-cards.lubar.me on my machine in Firefox Developer Edition 80.0b5, which would explain why it wasn't showing up on Nightly.

  1. Load https://spy-cards.lubar.me/?audioDebug
    Optional 2. Ctrl+Shift+k to show Web Console
  2. Click "Enable Audio".
  3. Wait 1 second

Expect:
sound
AUDIO: decoded audio: Inside2
AUDIO: decoded audio: Miniboss
Actual:
no sound
decoding still pending

Good 732d6918f5bbd8578d623e07c643512296ea4706 20200710094819
Bad f3ab1da2cea8d35101840daed1b94e35e07782d5

https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=732d6918f5bbd8578d623e07c643512296ea4706&tochange=f3ab1da2cea8d35101840daed1b94e35e07782d5

Status: UNCONFIRMED → RESOLVED
Closed: 4 years ago
Regressed by: 1650996
Resolution: --- → DUPLICATE
Has Regression Range: --- → yes
Keywords: regression
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: