Closed Bug 1473469 Opened Last year Closed 8 months ago

Run MediaStreamGraph from a single thread

Categories

(Core :: Audio/Video: MediaStreamGraph, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
mozilla67
Tracking Status
firefox67 --- fixed

People

(Reporter: karlt, Assigned: pehrsons)

References

(Depends on 2 open bugs, Blocks 1 open bug)

Details

Attachments

(1 file)

For the sake of the JS implementation (see bug 1458448) and for simplicity in GraphDriver, we'd like to run the MediaStreamGraph on a single thread.

The sensible way to do this would be to modify AudioIPC's API to allow the
client to specify the thread.  This project is therefore dependent on bug
1362220.

Rendering audio with the new AudioIPC API could look something like:

   while (WaitCode::StartRendering == stream->Wait()) {

      (buffer_ptr, bytes_to_render) = stream->BeginRender();

      graph->Render(buffer_ptr, bytes_to_render);

      stream->EndRender();
   }
Depends on: 1458448
Priority: -- → P2
No longer depends on: 1458448
See Also: → 1458448
Blocks: 1476514
Depends on: 1503132
Assignee: nobody → apehrson
Status: NEW → ASSIGNED
Pushed by pehrsons@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/45c838c4137d
Make MediaStreamGraph run on a single thread with AudioWorklets enabled. r=padenot

Thanks for backing out! I'll take a look.

Flags: needinfo?(apehrson)

These hangs happened when the audio callback got started faster than the GraphRunner's dedicated thread.

One case that I debugged with some logging, it took 25ms from MSG ctor to the first audio callback (e10s, cubeb sandbox), and 34ms for the GraphRunner thread to start running.

This made them both wait for each other.

I've made it so the audio callback will wait for the thread to start if it's early. Tests running at https://treeherder.mozilla.org/#/jobs?repo=try&revision=2051ae405f10e2d9863ed822e2e1d6718ec46928

Pushed by pehrsons@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/6070ee57c329
Make MediaStreamGraph run on a single thread with AudioWorklets enabled. r=padenot
Status: ASSIGNED → RESOLVED
Closed: 8 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla67
Depends on: 1533305
Depends on: 1533377
Depends on: 1533656
Depends on: 1533851
Depends on: 1534238
Blocks: 1535214
Depends on: 1538630
See Also: → 1551391
You need to log in before you can comment on or make changes to this bug.