Commit Graph

325 Commits

Author SHA1 Message Date
Eric Rahm
6165689908 Bug 1074387 - Fix double-counting of WebAudio PannerNode memory. r=jessup
--HG--
extra : rebase_source : a23a8d204e6eea6c1fca424343e4cb9569b012e1
2014-10-09 19:30:28 -07:00
Ryan VanderMeulen
5cbfa3c2ce Backed out changeset 11f95edf23a4 (bug 1073615) for frequent mochitest-bc timeouts. 2014-10-01 13:04:02 -04:00
Andrea Marchesini
8e7ea7a033 Bug 1073615 - One MediaStreamGraph singleton per audioChannel, r=roc 2014-09-30 18:35:32 +01:00
Eric Rahm
4edeb41338 Bug 1068981 - Acquire monitor before calling WakeUp. r=roc 2014-09-29 11:46:29 -07:00
Jan Beich
c9e1108606 Bug 1074009 - Fix type causing mFarendObserverRef to not be initialized. r=jesup 2014-09-28 17:27:00 -04:00
Randell Jesup
863298d9e0 bug 1072780: patch 4 - Use atomics for EnsureNextIteration to close races around CurrentDriver r=roc 2014-09-28 12:07:25 -04:00
Randell Jesup
64af5f19cd Bug 1072775: Additional assertions for MediaStreamGraph/GraphDriver r=roc 2014-09-28 12:07:24 -04:00
Randell Jesup
bb9f80b6b1 Bug 1072780: patch 1 - clean up CurrentDriver() use off-MSG-thread; fix InCallback() r=roc 2014-09-28 12:07:24 -04:00
Daniel Holbert
8c09c51078 Back out bug 1072780 & bug 1072775 (by reverting to cset before them, d71444b75291) for pthread assertion failures 2014-09-28 09:56:40 -07:00
Randell Jesup
319ff20936 bug 1072780: patch 4 - Use atomics for EnsureNextIteration to close races around CurrentDriver r=roc 2014-09-28 12:07:25 -04:00
Randell Jesup
e78a54416d Bug 1072775: Additional assertions for MediaStreamGraph/GraphDriver r=roc 2014-09-28 12:07:24 -04:00
Randell Jesup
40d928dbfe Bug 1072780: patch 1 - clean up CurrentDriver() use off-MSG-thread; fix InCallback() r=roc 2014-09-28 12:07:24 -04:00
Paul Adenot
616503a7f6 Bug 1059389 - Unbreak --disable-webrtc. r=jesup
--HG--
extra : rebase_source : 4ef5373b44a889c0641b0e829e3feae2a0116f5e
2014-09-09 18:23:01 +02:00
Paul Adenot
6a633ae6b2 Bug 1062293 - Ensure the graph stays alive when doing driver switches and audio stream shutdown operations. r=jesup
This basically gets a grip on the graph while doing driver switches operations
on another thread (system thread or audio thread), because those can take time.
Because the graph is refcounted, it'll be freed when the last operation
finishes, which is what we want.

This patch also only allows driver switching when the graph is in state
LIFECYCLE_RUNNING, which is what we want anyway.

--HG--
extra : rebase_source : 76365981ec909796509bd21e616b1ff8602406bd
2014-09-03 15:52:43 +02:00
Paul Adenot
0661e8b253 Bug 1062293 - Add specialized logging to track the lifetime state change of MediaStreamGraphs r=jesup
As noted in the comment, it is very useful to have this interleaved with the ADB
logcat on Android/b2g, because this way we can correlate gecko state with the
state of the Android HAL.

--HG--
extra : rebase_source : 80df45d0851a06daac3abeab2ea4b5bc7e58a21d
2014-08-31 14:19:48 +02:00
Ehsan Akhgari
5c071cc02e Bug 1060980 - Fix more bad implicit constructors in the media code; r=roc
--HG--
extra : rebase_source : 14da50f7d2e37e04452445dea575ea4d582e8efd
2014-08-31 23:50:23 -04:00
Paul Adenot
f10161b39f Bug 1060311 - Force the use of an AudioCallbackDriver when at least an AudioNodeStream is present in the graph. r=jesup
This prevent a bug where the graph would be using a SystemClockDriver even if it
was rendering Web Audio API content.

It went like this:
- An AudioContext was created.
- Some AudioNodeStream (Web Audio API MediaStreams) were created, but their
MediaStreamTrack was not added yet
- During the stream ordering, we would see that we were running an
AudioCallbackDriver (because the MSG was created using an AudioContext, and we
pass in hints regarding the type of MediaStreams that will be added in the
future, to open the audio stream as early as we can, because it can take some
time, the MSG was created directly using an AudioCallbackDriver)
- Also during the stream ordering, we see that none of our MediaStream have an
MediaStreamTrack with an audio track. This triggers a switch to a
SystemClockDriver, because the graph thinks there is no audio.
- During CreateAndDestroyAudioNode, we would not switch to an
AudioCallbackDriver on the first iteration (right after the UpdateStreamOrder
call), because we would be switching, and not during the iteration after,
because we thought we already switched (the first patch makes this more robust).

This basically forces an AudioCallbackDriver if there is an AudioNodeStream,
which prevents unnecessary GraphDriver switches (and save threads creation
destruction, audio stream create and destruction, and all other resources
associated with a GraphDriver).
2014-08-29 20:26:29 +02:00
Paul Adenot
305b725752 Bug 1059601 - Make sure we don't try to play audio with a system driver. r=jesup
--HG--
extra : rebase_source : 7142e0d9baf38491637d40d66375d92a0aaa9e9e
2014-08-27 19:13:15 +02:00
Randell Jesup
5d75646bd9 Bug 848954 - Part 32 - Disable MSG sleep. r=padenot
This has a race somewhere, so we disable it for now.

The real fix will come from the Web Audio API Suspend API [0]

[0]: https://github.com/WebAudio/web-audio-api/issues/317
2014-08-26 17:12:41 +02:00
Randell Jesup
7dc8dd9b1e Bug 848954 - Part 29 - Make the MSG in stable state event ref counted. r=padenot 2014-08-26 17:04:39 +02:00
Randell Jesup
709c9d60a7 Bug 848954 - Part 29 - Make sure to clear the right boolean flag when dispatching a stable state event. r=padenot 2014-08-25 14:13:14 +02:00
Paul Adenot
4d9c2e35fb Bug 848954 - Part 28 - Properly stop the driver when shutting down the graph. r=jesup
(this was originaly present, probably caused by a bad rebase)
2014-08-26 17:04:38 +02:00
Paul Adenot
e686bd4763 Bug 848954 - Part 24 - Clean up the clock getter, because the right thing is now done by the GraphDriver. r=roc 2014-08-26 17:02:31 +02:00
Paul Adenot
5f32ebf427 Bug 848954 - Part 23 - Refcount the AudioOutputObserver. r=jesup 2014-08-26 17:02:31 +02:00
Paul Adenot
7846782ef2 Bug 848954 - Part 20 - Remove the now useless DriverHolder class. r=roc 2014-08-26 17:02:28 +02:00
Paul Adenot
6da931e7d6 Bug 848954 - Part 18 - Start the thread after having processed the messages to make sure there are messages in the queue when processing starts. r=roc 2014-08-26 17:02:09 +02:00
Paul Adenot
c66ac1d38b Bug 848954 - Part 16 - Make AudioCallbackDriver respect the AudioChannelType. r=roc 2014-08-26 17:02:08 +02:00
Paul Adenot
3bfd993eac Bug 848954 - Part 15 - Allow an AudioCallbackDriver to sleep to save power. r=roc 2014-08-26 17:02:08 +02:00
Paul Adenot
ee5c66a26b Bug 848954 - Part 14 - Run all blocking cubeb operations off-main-thread. r=roc 2014-08-26 17:02:07 +02:00
Paul Adenot
12a686451d Bug 848954 - Part 13 - Add an RAII class to ensure another thread is not in the audio callback when shutting down. r=roc 2014-08-26 17:01:35 +02:00
Paul Adenot
5b06f66f01 Bug 848954 - Part 11 - When deciding to block a MediaStream due to a speculative data underrun, don't block if we have exactly the right number of frames buffered. r=roc 2014-08-26 17:01:35 +02:00
Paul Adenot
6c0f9e38fb Bug 848954 - Part 10 - Add a MediaStreamGraph driver based on an audio callback. r=roc 2014-08-26 17:01:33 +02:00
Paul Adenot
b76a30bb3f Bug 848954 - Part 9 - Allow to pass in hints when getting a reference to a MediaStreamGraph to get the right driver started as soon as possible. r=roc
This is useful because some platform have rather slow audio stream
initialization time, especially the first time an audio stream is created for
the process.

We put in telemetry probes to measure that:
First stream opened for the process:
http://telemetry.mozilla.org/#filter=nightly%2F33%2FAUDIOSTREAM_FIRST_OPEN_MS&aggregates=multiselect-all!Submissions!Mean!5th%20percentile!25th%20percentile!median!75th%20percentile!95th%20percentile&evoOver=Builds&locked=true&sanitize=true&renderhistogram=Graph

Subsequent streams:
http://telemetry.mozilla.org/#filter=nightly%2F33%2FAUDIOSTREAM_LATER_OPEN_MS&aggregates=multiselect-all!Submissions!Mean!5th%20percentile!25th%20percentile!median!75th%20percentile!95th%20percentile&evoOver=Builds&locked=true&sanitize=true&renderhistogram=Graph
2014-08-25 15:27:25 +02:00
Paul Adenot
679fac5442 Bug 848954 - Part 7 - Get rid of the stack allocated message queue. r=roc
In the next patches, when the AudioDriver will be implemented, the audio backend
thread (that we don't control), will return from the stack frame where the
nsTArray that allows the MSG thread to exchange message queues in a efficient
manner with the main thread. We put it in the MediaStreamGraph to avoid adding
an allocation/deallocation per iteration on the MSG thread.

In addition, the graph will be able to run on different threads during its
lifetime, so we can't guarantee a stable stack frame to allocate things on
anymore.

The array are renamed with meaningful names, explaining the double-buffering
pattern: the back queue is filled by the main thread, and is swapped with the
front queue that is processed by the MSG thread.

Arrays accesses are synchronized using the driver's monitor.
2014-08-25 15:26:21 +02:00
Paul Adenot
3494e982d0 Bug 848954 - Part 6 - Put cubeb-related static functions in their own file. r=kinetik 2014-08-25 15:26:09 +02:00
Paul Adenot
5283170bbe Bug 848954 - Part 5 - Mix down all audio and only output a single stream. r=roc 2014-08-25 15:25:49 +02:00
Paul Adenot
8f4a6f19f7 Bug 848954 - Part 4 - Factor behavior for drivers that manage their thread. r=roc 2014-04-25 18:04:53 +02:00
Paul Adenot
af9bfbca22 Bug 848954 - Part 3 - Separate interval time calculation and actual processing, and give an audio-callback compatible interface to the Process function. r=roc 2014-04-25 18:04:23 +02:00
Paul Adenot
f04cfc8457 Bug 848954 - Part 2 - Put the thread management in the driver. r=roc 2014-04-25 18:03:04 +02:00
Paul Adenot
53b7efb271 Bug 848954 - Part 1 - Factor out clocks and scheduling of MSG iterations. r=roc 2014-04-25 16:09:30 +02:00
Paul Adenot
3a76d049e6 Bug 989921 - Allow the MediaStreamGraph mixer to send data back to multiple consumers. r=jesup 2014-08-25 14:13:08 +02:00
Randell Jesup
1365c98d16 Bug 1054166: Mirror Add/RemoveListener in Add/RemoveDirectListener r=roc 2014-08-17 02:09:21 -04:00
Paul Adenot
fb61e0a656 Bug 1046930 - Fix loop index when sending the status of the microphone to the AudioStream. r=jesup 2014-08-01 15:29:19 +02:00
Karl Tomlinson
39582dd9ce b=1033122 be consistent about speex_resampler symbol visibility r=khuey
When "speex/speex_resampler.h" was included, another exported header (in
dist/include) would find the speex/speex_resampler.h in dist/include before
dist/system_wrappers.  Visibility of undefined symbols depended on the order
of includes.

This patch changes includes to <speex/speex_resampler.h> so that
WRAP_SYSTEM_INCLUDES works as expected but removes the wrapper when not using
GKMEDIAS_SHARED_LIBRARY.

--HG--
extra : rebase_source : 93ca1dbdd6b489647624326e78539f44c60d0b34
2014-07-02 14:21:34 +12:00
Paul Adenot
fa3dd7a74b Bug 1027713 - Part 5 - Trigger the panning logic on stream creation. r=jesup
UpdateStreamOrder is not called often because it's expensive (it's called only
when the graph topology changed), and it's earlier in the MSG loop than the
audio stream creation, so we need to tell the newly created AudioStream that a
microphone is active on creation as well.

The panning logic is also now triggered on stream start, because it is async.
2014-07-29 18:45:05 +02:00
Paul Adenot
96c26a803b Bug 1027713 - Part 4 - Pan audio to the right when we are using gUM and outputing sound using MacBookPro speakers. r=jesup 2014-07-29 18:45:03 +02:00
Karl Tomlinson
5b0037452f b=1022945 only AppendToTrack before SourceMediaStreams are destroyed r=roc
--HG--
extra : rebase_source : 016877261fb7a10b6d99abd17a8ca26b222d38c4
2014-07-25 09:23:59 +12:00
Karl Tomlinson
4fdfbacc91 b=1022945 null MediaInputPort::mGraph when removing port from graph r=roc
This shouldn't be necessary, if clients do the right things, but provides some
safety, in case they don't.

--HG--
extra : rebase_source : e64d663c27f03eff35f538c205cd66d42420d9e4
2014-07-25 09:18:38 +12:00
Karl Tomlinson
ccb63bd2ec b=1022945 null MediaStream::mGraph before removing stream from graph r=roc
and use mGraph to test whether SourceMediaStreams are destroyed.

--HG--
extra : rebase_source : 03df9e7ab14ecd627dfeb333b79713a7b619f215
2014-07-25 09:09:22 +12:00
Karl Tomlinson
c6e0643c5d b=1022945 remove SetStreamOrderDirty call from ProcessedMediaStream::DestroyImpl r=roc
The stream order is only important if there are connections, in which case
MediaInputPort::Disconnect() calls SetStreamOrderDirty().

MediaStreamGraphImpl::RemoveStream() also calls SetStreamOrderDirty(), which
ensures that mFirstCycleBreaker is updated when necessary.

--HG--
extra : rebase_source : b437f0d078a481725579456d91acc32353e1221a
2014-07-25 08:36:07 +12:00