Closed Bug 929969 Opened 6 years ago Closed 6 years ago

decodeAudioData on MP3 files fails with 'The buffer passed to decodeAudioData contains invalid content which cannot be decoded successfully' on Windows

Categories

(Core :: Web Audio, defect, P2)

x86_64
Windows 7
defect

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: kael, Unassigned)

References

()

Details

New variant of bug #865553, I think.

With Web Audio rolled out, JSIL samples use it to play back audio. They contain mp3 and ogg versions of all audio, and pick the first one in the manifest the browser says it can play - in this case, that happens to be mp3.

According to padenot these samples work fine on Linux; the problem seems to be related to Windows MP3 decoders again. I've tested this on my Windows 7 x64 machine and my Windows 8.1 x64 tablet - same error in both cases.

The decoding failure happens pretty late. Since it seems like Windows audio decoders are unreliable, should audio implementations like mine bias towards OGG in Gecko in all circumstances? Or perhaps only on Windows? I don't see a clean way to work around this on my end, but if MP3's not gonna work for end-users I definitely don't want to try and play it.
Some last-minute details, because I'm forgetful:
The MP3 files in these samples are all encoded by a stock build of LAME with default settings.
You can tell if it's failing because you see decodeAudioData errors dumped to the JS console, and sound effects don't play anywhere in the sample (the music probably will play, though, because I think I fall back to <audio> to stream large audio files.)
Chris, could you try this on Windows? It might be related to wmf of directshow. It works on Linux, but I don't have a windows machine handy to test myself, sorry.
Flags: needinfo?(cpearce)
(Regardless of the outcome of this bug, we use the same OGG/Vorbis decoders on all platforms, so at least you wouldn't get platform specific bugs like this.  Oh, and also remember that we don't have MP3 support on Mac yet.)
What do you mean a decoding failure exactly? What happens? I can't figure out how to play that game to repro the bug. Can you provide steps to reproduce? Or provide a reduce testcase? I keep getting stuck on talk screens in game, and the only sound I can hear is the music, which plays fine for me.

We have MP3 support on Mac in Firefox 26 and onwards by the way. We switched on Windows in Firefox 26 to use DirectShow rather than WMF for MP3 decoding, so it would be good if you could specify what version of Firefox you're using.
Flags: needinfo?(cpearce)
Like I said:

You can tell if it's failing because you see decodeAudioData errors dumped to the JS console, and sound effects don't play anywhere in the sample (the music probably will play, though, because I think I fall back to <audio> to stream large audio files.)

If you only hear music, then it's failing.
I don't see errors in the JS log when I play the game. Can you provide a reduced testcase please, that will really help us diagnose this.
Also it would be helpful if you could tell me whether the bug reproduces for you in Firefox 26 (current Aurora build) and in Firefox 27 (current Nightly build). Firefox 27 uses Windows Media Foundation for MP3 playback on Vista and later, and Firefox 26 uses DirectShow. I'm going to switch 26 back to Windows Media Foundation once bug 930372 gets aurora approval, hopefully in the next few days. We've had problems with WMF on Win7 when there's a lot of decoders running (bug 882537), so maybe using DirectShow will work around this issue.
Same failure in Aurora on my Win7 machine.
There's a similar bug filed, bug 936796, and I was able to reproduce that on my Win7 machine. That bug was fixed by switching MP3 decoding from WMF to DirectShow. WebAudio uses the same decoders as <audio> underneath, so I would expect this bug to be fixed when we re-enable MP3 via DirectShow on Windows. Edwin is working to fix the last bug in bug 918135 before we can re-enable DirectShow on all Windows versions. We should get to this in Firefox 28, possibly we can get it uplifted to Aurora if the fix is simple enough.
Depends on: 918135
I'm also have the problems with decodeAudioData for mp3 files in Firefox 26.0 for Mac. I see error in console: "The buffer passed to decodeAudioData contains invalid content which cannot be decoded successfully". And sound never played.
It worked perfectly in Firefox 25.1.
Was this bug fixed by re-enabling MP3 via DirectShow? (See bug 945947)
Flags: needinfo?(kg)
(In reply to Vadim from comment #10)
> I'm also have the problems with decodeAudioData for mp3 files in Firefox
> 26.0 for Mac. I see error in console: "The buffer passed to decodeAudioData
> contains invalid content which cannot be decoded successfully". And sound
> never played.
> It worked perfectly in Firefox 25.1.

This sounds like a different bug.  Can you file a new bug in bugzilla for the Mac problem?
Flags: needinfo?(vadim.bulochnik)
Priority: -- → P2
I'm not seeing decode errors in the log in Nightly, and sound effects/music are working. Looks fixed.
Flags: needinfo?(kg)
(In reply to K. Gadd (:kael) from comment #13)
> I'm not seeing decode errors in the log in Nightly, and sound effects/music
> are working. Looks fixed.

Excellent, I'm going to resolve this as worksforme.

Vadim -- If you're still having problems on Mac using Nightly, please file a new bug as soon as you can.  Thanks!
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WORKSFORME
Flags: needinfo?(vadim.bulochnik)
(In reply to Maire Reavy [:mreavy] from comment #14)
> (In reply to K. Gadd (:kael) from comment #13)
> > I'm not seeing decode errors in the log in Nightly, and sound effects/music
> > are working. Looks fixed.
> 
> Excellent, I'm going to resolve this as worksforme.
> 
> Vadim -- If you're still having problems on Mac using Nightly, please file a
> new bug as soon as you can.  Thanks!

I've posted new bug 950023 - https://bugzilla.mozilla.org/show_bug.cgi?id=950023
You need to log in before you can comment on or make changes to this bug.