New issue
Advanced search Search tips

Issue 777342 link

Starred by 8 users

Issue metadata

Status: Verified
Owner:
Closed: Jan 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Mac
Pri: 2
Type: Bug



Sign in to add a comment

Feature request: Allow to have more than 6 audio contexts

Reported by seba.ker...@gmail.com, Oct 23 2017

Issue description

UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.86 Safari/537.36

Steps to reproduce the problem:
I have a use case where we use chrome to create multiple audio mixes of a bunch of incoming WebRTC streams. E.g. We receive 10 streams and have to create 10 different audio mixes of those 10 streams (and then stream these back out). This means I need 10 audio contexts (one for each mix).
Currently Chrome limits this to 6, which AFAIK is a quite random chosen number that's only there in order to limit CPU usage of one tab.
In our case this is not really a concern since we fully control chrome and run it on heavy servers.

It would be nice to have a flag to increase/disable this limit (or any other means to achieve this), so we don't have to compile chrome ourselves only to change this limit.

What is the expected behavior?
A flag or something to increase/disable this limit.

What went wrong?
Chrome limits number of audio contexts.

Did this work before? No 

Does this work in other browsers? N/A

Chrome version: 59.0.3071.86  Channel: n/a
OS Version: ubuntu 16.04
Flash Version:
 
Components: -Blink>Media Blink>WebRTC

Comment 2 by guidou@chromium.org, Oct 23 2017

Components: -Blink>WebRTC Blink>WebAudio
Labels: OS-Mac OS-Windows
Status: Untriaged (was: Unconfirmed)
Hmm. Please help me to understand: why do you need 10 contexts for mixing incoming streams? Can't you set up 10 MediaStreamSources within 1 context and do the mixing in there? By creating "mix", I assume you're meaning the audio capture with ScriptProcessorNode.

Indeed a very interesting use case.

Comment 4 by rtoy@chromium.org, Oct 25 2017

Labels: Needs-Feedback
Labels: Needs-Milestone
seba.kerckhof@ Can you please respond to comment #3, which will help in further triaging of this issue.

Thanks..
It would seem that I had misinterpreted the Audio API spec. comment #3 made me realize I can work out my use case within 1 audio context.

Comment 7 by rtoy@chromium.org, Jan 18 2018

Cc: dalecur...@chromium.org
Labels: -Needs-Feedback
+dalecurtis

Is there really any reason for webaudio to constrain this?  From chrome://media-internals, each AudioContext that is created creates a new output controller.

It seems that if there are any limits to be enforced, the enforcing should happen in the output controller.
No, I didn't even know this limit existed, there's no reason. If too many contexts are created the page will crash like any other out-of-resource type issue.

Comment 9 by rtoy@chromium.org, Jan 18 2018

Heh. I don't know why Chris Rogers had that limit there in the first place, but it sounds like we can just get rid of it then. (It was 4 but we increased it to 6 some time ago.)
Perhaps we can do that incrementally?

The actual use case in this issue was not a valid justification for the big number on concurrent contexts. Also it's basically spawning a thread that pulls data every 3ms with an actual device attached.

Comment 11 by rtoy@chromium.org, Jan 18 2018

What does "incrementally" mean?
Re #11:

We increase the limit by 1~2 each release, then collect and analyze the metric. Based on the analysis, we decide what to do in the next release.
Eh, if you want a limit at all just control the count via an experiment and you can observe stability and other metrics with respect to the experiment limits.

Comment 14 by rtoy@chromium.org, Jan 19 2018

I don't really care to have a limit at all.

Comment 15 by rtoy@chromium.org, Jan 19 2018

But the nice thing about a limit is that the tab doesn't crash; you just get an error and everything stops.

I vaguely remember a few valid use cases for 6 contexts, but haven't really seen any others. (Well, there was an issue where duplicated tabs 6 times makes the last one not work, but I'm not sure what the real use case for that would be.)
Project Member

Comment 16 by bugdroid1@chromium.org, Jan 29 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/faf1e5f751eb1b9005d05ad8fdfcaacb3fbd0e33

commit faf1e5f751eb1b9005d05ad8fdfcaacb3fbd0e33
Author: Raymond Toy <rtoy@chromium.org>
Date: Mon Jan 29 20:06:08 2018

Remove limit on the number of concurrent AudioContexts

There's no reason to have a limit on the number of concurrent
AudioContexts.  If the user creates too many, we'll just run out of
resources and stop.

Bug:  777342 
Test: audiocontext-max-contexts.html removed
Change-Id: I55ac01e42cc1ffc313db5b93e49db1c4a36a585b
Reviewed-on: https://chromium-review.googlesource.com/875192
Reviewed-by: Hongchan Choi <hongchan@chromium.org>
Commit-Queue: Raymond Toy <rtoy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#532561}
[delete] https://crrev.com/274e376de3c9e65117e3e13b931448d80c8a37c7/third_party/WebKit/LayoutTests/webaudio/AudioContext/audiocontext-max-contexts.html
[modify] https://crrev.com/faf1e5f751eb1b9005d05ad8fdfcaacb3fbd0e33/third_party/WebKit/Source/modules/webaudio/AudioContext.cpp

Comment 17 by rtoy@chromium.org, Jan 30 2018

Owner: rtoy@chromium.org
Status: Verified (was: Untriaged)
The limit is completely removed.  I tested and could create at least 7 contexts now. (I didn't try anything higher.)

Comment 18 by rtoy@chromium.org, Feb 1 2018

 Issue 595775  has been merged into this issue.

Sign in to add a comment