Closed Bug 815569 Opened 8 years ago Closed 7 years ago

[Audio] Audio Competing Policy Should Pause Low Priority Streams not Mute


(Firefox OS Graveyard :: General, defect)

Gonk (Firefox OS)
Not set


(blocking-kilimanjaro:+, blocking-basecamp:+, firefox19 fixed, firefox20 fixed, b2g18 fixed)

blocking-kilimanjaro +
blocking-basecamp +
Tracking Status
firefox19 --- fixed
firefox20 --- fixed
b2g18 --- fixed


(Reporter: mchen, Assigned: kinetik)




(1 file, 2 obsolete files)

Following the bug 805333 which version is implemented as "mute" first. But according the meeting including Andreas, Jonas and Robert, the conclusion is to "pause".

The main reason for pausing not muting is the concern on power consumption.
Marco: Do you think we need to block on this? It seems like we might get away without blocking for this, but battery consumption will be higher, though only for short periods of time.
blocking-basecamp: --- → ?
If we ignore the power consumption first then the only concern is on bug 796333.

Ex: 1. A game is on playing
    2. Another App is launched and game falls to background.
    3. The audio stream from game is muted now.

If user presses the power key for suspend, then screen will be off and no sound appeared too.
But actually the device doesn't go into suspend but screen_off only because the wakelock from audio driver.

So maybe the patch on 796333 can be evaluated to commit for pausing the normal channel in background. Then this bug can be non blocking-basecamp from my point of view.
Would that let us still play audio from the "content" channel when the user presses the power key?
1. The default channel on media element is normal not content and content needs permission.
   So the existing game or web content will be on normal channel.
2. And we expect that sound from game and a web content from browser tab should not be hear 
   while they are in background.
This seems like it would be a lot of work.  We discussed it during triage and decided we can't block on it.  Please re-nom if you disagree.
blocking-basecamp: ? → -
blocking-kilimanjaro: --- → +
We talked through it some more and decided that we need to either fix this bug or bug 796333. We should fix whichever one is easier. So if we decide that fixing this one is easier just renominate and then start hacking, no need to wait for a plus.
I think we should fix this. I don't think it should be a lot of work.
Taking this.  The fix for this will address bug 796333 too once bug 819836 is fixed.
Assignee: nobody → kinetik
Attached patch patch v0 (obsolete) — Splinter Review
This needs more testing (I've only managed to test it on desktop with the MOZ_B2G ifdefs removed), so only requesting feedback to ensure the approach makes sense.  Similar to my simple patch from bug 796333, but this uses the audio channel service for determining the suspend state (rather than testing the channel type directly), and addresses roc's comment in bug 796333 comment 56.
Attachment #690652 - Flags: feedback?(roc)
Comment on attachment 690652 [details] [diff] [review]
patch v0

Review of attachment 690652 [details] [diff] [review]:

Can you change the name of mPausedForInactiveDocument to cover the audiochannel case? I can't think of a good name though :-(

Attachment #690652 - Flags: feedback?(roc) → review+
Blocks: 819873
Re-nom because this blocks a blocking bug which cannot be fixed in Gaia.
Blocks: 819852
blocking-basecamp: - → ?
Triage: Blocks a blocker.
blocking-basecamp: ? → +
I'm not convinced bug 819873 is a blocker. And so there's no blockers depending on this right now.
blocking-basecamp: + → ?
Due to the power consumption concern and the fact that bug 796333 will likely fix this (and has an r+'d patch), we decided during triage to block on this.
Blocks: 796333
blocking-basecamp: ? → +
Attached patch patch v1 (obsolete) — Splinter Review
Address review comments.  Passes local desktop tests, try push:
Attachment #690652 - Attachment is obsolete: true
One test failure so far:

###!!! ASSERTION: Should not have pending events: 'mPendingEvents.IsEmpty()', file e:/builds/moz2_slave/try-w32-dbg/build/content/html/content/src/nsHTMLMediaElement.cpp, line 2308
REFTEST TEST-UNEXPECTED-FAIL | file:///C:/talos-slave/test/build/reftest/tests/content/media/test/crashtests/459439-1.html | assertion count 1 is more than expected 0 assertions

I'll remove the assertion and clear mPendingEvents at the same location, that seems to be the correct solution.
Attachment #691067 - Attachment is obsolete: true
Attached patch patch v2Splinter Review
Remove the mPendingEvents assertion and clear mPendingEvents when resetting mSuspendEvents.  Also move the UpdateAudioChannelPlayingState call in ChangeReadyState to avoid calling it when the ready state has not changed.

Try push:
Attachment #691210 - Flags: review?(roc)
(In reply to Jonas Sicking (:sicking) from comment #13)
> I'm not convinced bug 819873 is a blocker. And so there's no blockers
> depending on this right now.

Jonas, please see bug 819873 comment 5.
Closed: 7 years ago
Resolution: --- → FIXED
I missed the news about beta and b2g18.  Backed out on beta:

I'll land it on b2g18 once my clone finishes.
And landed on b2g18:
Whiteboard: [status-b2g18:fixed]
Whiteboard: [status-b2g18:fixed]
FYI, I wouldn't lose too much sleep over landing it on beta in the future. The plan is to be merging beta to b2g18 regularly anyway.
Depends on: 822647
You need to log in before you can comment on or make changes to this bug.