Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Enable software mp3 decoding in Geckoview. #709

Closed
joshmarinacci opened this issue Nov 2, 2018 · 18 comments
Closed

Enable software mp3 decoding in Geckoview. #709

joshmarinacci opened this issue Nov 2, 2018 · 18 comments
Labels
bug This issue is a software or functional defect Bugzilla Main activity on this bug is in Bugzilla compatibility Web content compatibility issues perf Performance size: 1
Milestone

Comments

@joshmarinacci
Copy link

Hardware

Oculus Go

Steps to Reproduce

  1. Load My VR game with music disabled and click play. The game will run ~30fps. https://vr.josh.earth/webxr-experiments/halloween/v2.html
  2. Load My VR game with music enabled and click play. The game will run at ~1fps. https://vr.josh.earth/webxr-experiments/halloween/v2_music.html

Current Behavior

The game is super slow with music turned on. Even if I disable playing the music, the act of loading MP3s into Three.Audio() seems to trigger the bug.

Expected Behavior

The game should run at the same speed with and without audio.

Possible Solution

Context

Error Logs and Stack Traces

@caseyyee caseyyee added the compatibility Web content compatibility issues label Nov 27, 2018
@joshmarinacci
Copy link
Author

I can confirm that this still happens. It also happens with my new app, Jingle Smash.

https://vr.josh.earth/webxr-experiments/physics/player.html

In both cases everything slows down for about the first minute, then finally comes back to normal speed once the music begins playing.

@larsbergstrom
Copy link

I recall @snorp mentioning this issue, too, back when we were first trying to A-Blast working even in 2D on an android phone. All of the related bugzilla bugs around WebAudio performance have either been resolved or closed as invalid, though, so it's probably worth taking a perf trace (especially if this repros in 2D in normal geckoview on android) and opening a bug.

@snorp
Copy link
Contributor

snorp commented Dec 20, 2018

It seems to run fine here on my phone (not in VR). Can you grab a profile? There are some instructions here: https://perf-html.io/docs/#/./guide-remote-profiling

I'm not sure how to enable the devtools from FxR, but maybe @larsbergstrom or @bluemarvin can help with that. I think it's in the settings?

@cvan
Copy link
Contributor

cvan commented Dec 20, 2018

Settings > Remote Debugging turn On. Thanks for the profiling instructions!

@joshmarinacci
Copy link
Author

The WebIDE doesn't have a performance section anymore like in the screenshots, but the connected console view does. I'm assuming it just moved (I'm using Nightly on desktop). I took a profile though it never ended when I pressed the end button. Still I was able to save it. Attached JSON file. (zipped because Github won't let you paste in JSON files).

I can confirm that disabling all audio greatly reduces the initial slowdown.

profile.json.zip

@bluemarvin
Copy link
Contributor

You should be able to share the perf.io link that has the profile data.

@joshmarinacci
Copy link
Author

Oh, was this supposed to record and send it to a website? No, it didn't do that.

@joshmarinacci
Copy link
Author

Perhaps I'm recording it wrong. Here is the demo with audio on

https://vr.josh.earth/webxr-experiments/physics/player.html?AUDIO=true

and with it turned off

https://vr.josh.earth/webxr-experiments/physics/player.html?AUDIO=false

@MortimerGoro MortimerGoro added the Needs Profiling We need to measure the impact on different engines label Feb 13, 2019
@joshmarinacci
Copy link
Author

I modified the halloween game to show the problem. https://vr.josh.earth/webxr-experiments/halloween/v2_linear.html

Now it loads the MP3s one at a time. It actually makes the problem worse. Inside the handlers for each MP3 is a console.log that looks like ‘=== 1’, ‘=== 2’, etc. It takes about 2 minutes for four MP3s to be loaded and ready to play. if you load the page look at the ‘how to play’ button. It will change to ‘done’ when the mp3s are done loading. during the load time the Oculus Go feels sluggish. So the real question is: what is involved with loading an MP3 on Android / Oculus Go. I’m assuming we have to decompress the whole file into a buffer before it’s ready to play, but why is that so rough? These aren’t long MP3s. Shouldn't take 2 min.

@MozillaReality MozillaReality deleted a comment from joshmarinacci Feb 21, 2019
@philip-lamb philip-lamb added Bugzilla Main activity on this bug is in Bugzilla perf Performance labels Mar 4, 2019
@philip-lamb
Copy link
Contributor

@philip-lamb philip-lamb added this to the v1.x milestone Mar 4, 2019
@philip-lamb philip-lamb added P2 Fix in the next development iteration and removed backlog labels Apr 4, 2019
@philip-lamb philip-lamb modified the milestones: v1.x, v1.2 Apr 4, 2019
@philip-lamb philip-lamb added the invalid resolved: not a Mozilla bug or the issue is intended behavior label May 8, 2019
@philip-lamb philip-lamb removed the P2 Fix in the next development iteration label May 8, 2019
@philip-lamb
Copy link
Contributor

Media team has now enabled ffmpeg's mp3 decoder. Last piece of that work (disabling the Android HW decoder) is tracked in bug https://bugzilla.mozilla.org/show_bug.cgi?id=1583997

@philip-lamb philip-lamb reopened this Oct 2, 2019
@philip-lamb philip-lamb added bug This issue is a software or functional defect P3 Backlog and removed Needs Profiling We need to measure the impact on different engines invalid resolved: not a Mozilla bug or the issue is intended behavior labels Oct 2, 2019
@philip-lamb philip-lamb modified the milestones: v1.2, #6 features Oct 2, 2019
@philip-lamb philip-lamb changed the title Music thrashes browser, 1fps Enable software mp3 decoding in Geckoview. Oct 2, 2019
@philip-lamb philip-lamb self-assigned this Oct 2, 2019
@philip-lamb
Copy link
Contributor

@joshmarinacci When this work lands, I'll get you to test against Jingle Smash.

@MortimerGoro
Copy link
Contributor

@joshmarinacci ready for testing on feature/v6 branch

@joshmarinacci
Copy link
Author

Is this branch built on taskcluster?

@MortimerGoro
Copy link
Contributor

@joshmarinacci
Copy link
Author

It looks like only master is being built on taskcluster. how do I get branch builds?
https://tools.taskcluster.net/groups/HZXKx5tlQvqg17tCUqx-Qg

@MortimerGoro
Copy link
Contributor

Did you click on the green checkmark icon on the commit?

I see the builds from the commit here: https://tools.taskcluster.net/groups/IxLuQeC5SdOcFRW4E4QHng/tasks/IxLuQeC5SdOcFRW4E4QHng/runs/0/artifacts

@joshmarinacci
Copy link
Author

The performance is better now. Thank you.

@philip-lamb philip-lamb removed the P3 Backlog label Oct 14, 2019
@philip-lamb philip-lamb removed their assignment Oct 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug This issue is a software or functional defect Bugzilla Main activity on this bug is in Bugzilla compatibility Web content compatibility issues perf Performance size: 1
Projects
None yet
Development

No branches or pull requests

10 participants