Commit Graph

302 Commits

Author SHA1 Message Date
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
Karl Tomlinson
70b7090397 b=1041466 don't remove one too many streams from the SCC stack r=roc
Also reduce the number of ProcessedMediaStream* static_casts and use a new
variable name |removed| to emphasize what is happening.

--HG--
extra : rebase_source : 50b6c5e2d97a2e4ffbf9db993e1327de8c1d7b36
2014-07-24 21:58:01 +12:00
Wes Kocher
c1992a8da2 Backed out 8 changesets (bug 1023947, bug 1027713) for frequent Cppunit test failures
Backed out changeset 03edb1ab3182 (bug 1027713)
Backed out changeset ad05dc816fa0 (bug 1023947)
Backed out changeset a56aad94c7c9 (bug 1023947)
Backed out changeset 63af4528bd9c (bug 1023947)
Backed out changeset b6bb38846333 (bug 1027713)
Backed out changeset c0045bb1849e (bug 1027713)
Backed out changeset 274b2b25d167 (bug 1027713)
Backed out changeset e0bba6f4966f (bug 1027713)
2014-07-24 13:57:03 -07:00
Paul Adenot
bf0d80701e 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-24 17:05:24 +02:00
Paul Adenot
6245e51a74 Bug 1027713 - Part 4 - Pan audio to the right when we are using gUM and outputing sound using MacBookPro speakers. r=jesup
--HG--
extra : rebase_source : d77a3e6d17b237dc46301a34ed36b6d3e8e0aeda
2014-07-24 17:05:23 +02:00
Karl Tomlinson
c408e4099c b=932400 change stream ordering to get feedback DelayNode output before supplying input r=roc
Previously downstream nodes from DelayNodes in cycles sometimes received stale
output from the previous MSG iteration.

Also, if two cycles share a common path, they will now *both* be treated as
cycles, either by muting or by enforcing minimum delay.  Previously, marking
one cycle first could prevent detection of other cycles in the same SCC.

--HG--
extra : rebase_source : 82892c538c5ce514165b5f975474df15b99e3d2b
2014-07-17 12:55:55 +12:00
Karl Tomlinson
cbffbf7d6b b=932400 remove refcount manipulation of streams when reordering for processing r=roc
--HG--
extra : rebase_source : f99f4220b53a28a32e9a294b67f4db6218113d73
2014-07-07 11:52:25 +12:00
Randell Jesup
6064176f06 Bug 1035819: patch 1 - Add notification of DirectListeners and generalize Notification of events r=roc 2014-07-14 01:47:56 -04:00
Eric Rahm
d550923b30 Bug 1036679 - MediaStreamGraph shutdown can hang if happening in conjunction with a memory report. r=roc 2014-07-09 17:22:37 -07:00
Karl Tomlinson
db2546467c b=1020411 correct control message order with RunAfterPendingUpdates() at shutdown r=roc
--HG--
extra : transplant_source : %AE%05%92%2C%60%9FL%D0%13O%EE%7D%09ZV%87%06%E9%B6%D8
2014-07-02 18:04:54 +12:00
Karl Tomlinson
89916d5337 b=1027963 count ticks remaining in PlayAudio() better when blocking changes r=padenot
The previous code could result in an infinite loop.

--HG--
extra : transplant_source : %DB%20%2C%A3%26%A1%B0%00E%0B%85v%DC%1F0%F1%81Tm%9B
2014-07-01 18:21:57 +12:00
Paul Adenot
54c2895226 Bug 1028458 - Don't try to use a resampler when resampling segments to graph rate if we haven't instanciated one yet. r=karlt
--HG--
extra : rebase_source : 3b7696b3e89c1be0e338893578d81088f7182a3b
2014-06-26 14:01:01 +02:00
Benoit Jacob
0943d4adbd Bug 1028588 - Fix dangerous public destructors in content/media/ - r=cpearce,smaug 2014-06-24 12:36:43 -04:00
JW Wang
b23c53b0d6 Bug 750258 - include |nextCurrentTime| when calculating whether to call NotifyBlockingChanged(). r=roc 2014-06-22 20:21:00 +02:00
Eric Rahm
fa5d109ec2 Bug 1027573 - Crash when measuring memory in about:memory while using Web Audio. r=roc 2014-06-20 10:29:10 -07:00
Nicholas Nethercote
39f29c384a Bug 1010064 - Allow memory reports to be anonymized. r=bsmedberg.
--HG--
extra : rebase_source : 5eb756b17a97e751deb0f47e909fdb35533cb23b
2014-05-20 23:06:54 -07:00
Karl Tomlinson
a4b9a3c57e b=1023697 use audio ticks for graph time units r=roc
--HG--
extra : transplant_source : 8%BA%9D%5C%E32%05x%A79K%08TH%A7%F4%F2tg%EC
2014-06-12 16:45:00 +12:00
Karl Tomlinson
36c7833021 b=1023697 use 0 for initial graph time r=roc
We could get away with 1 as an initial time when units were 1/(1<<20) seconds
but when graph time units are audio samples, an initial value of 1 will mean
that the first audio block produced has 1 frame fewer.

--HG--
extra : transplant_source : %FF%D5%AF%A9%C7%EA%C4%D7%ED%8F%CC%AC%E4%5E%FF%D0%87%8D%3AN
2014-06-12 16:45:00 +12:00
Karl Tomlinson
d8be06bf30 b=1023697 add functions to convert between track rates and remove global StreamTime/tick conversion functions r=roc
--HG--
extra : transplant_source : %B6%BC%83%17%22%EE%5D%BEl%B6%17m%1C%D0N%D1C%97%60%E1
2014-06-12 16:44:59 +12:00
Karl Tomlinson
b0bb0ef6be b=1023697 record the graph tick rate on StreamBuffer and its Tracks for StreamTime calculations r=roc
--HG--
extra : transplant_source : 8%B4%DB%A4%FE%2C%B7%235%7F%7D5%2C%FA%BA%0D%9E%CC%7E%11
2014-06-12 16:44:59 +12:00
Karl Tomlinson
7896a7639e b=995690 don't advance audio output stream position 1 tick beyond what has been produced r=roc
This may result in repeating a sample sometimes due to rounding effects, but
that should only happen once per unblocked sequence of track frames.

--HG--
extra : transplant_source : %0C%E9%A4jq%286%96%B1%A9%AE%9F%1Cr%DCK%8F%AF%92i
2014-06-12 16:41:29 +12:00
Karl Tomlinson
d978344073 b=995690 correct mLastTickWritten to only advance when not blocked r=roc
mLastTickWritten and offset are stream positions, which do not advance when
the stream is blocked.

--HG--
extra : transplant_source : %15%7B%E5%E9.%89%BC%1E%F8%92%FD%3D%CB%10%FC%AD%EAT%90-
2014-06-12 16:40:51 +12:00
Karl Tomlinson
7386288622 b=1014862 assert that source track resamplers are used with the correct channel count r=padenot
--HG--
extra : rebase_source : cc28665fc90cf0bfc9f113b5e25f2c57a4948c9e
2014-06-09 12:11:41 +12:00
Karl Tomlinson
c4e30140cf b=1016177 reduce MEDIA_TIME_MAX to not overflow when multiplying by sample rates r=roc
MediaTimes are multiplied by sample rates when converting to ticks.

This new maximum leaves 24 bits to count seconds, which corresponds to 194
days.

TimeVarying::GetAt() can return INT64_MAX, which may be > GRAPH_TIME_MAX.

The "Start time too early" assertion would now fail because conversion of
STREAM_TIME_MAX to ticks no longer overflows.

--HG--
extra : rebase_source : b49c95315d0c633f191ff68aab0b5b7aa04c6e38
2014-06-05 22:08:05 +12:00