Commit Graph

395 Commits

Author SHA1 Message Date
Ben Kelly
75bf35692e Bug 1440407 P2 Remove some unnecessary nsPIDOMWindowInner QI to nsIGlobalObject. r=mystor 2018-02-22 14:28:39 -08:00
Andreas Pehrson
09669c4432 Bug 1299515 - Don't assert that tracks must be ended in forced shutdown. r=padenot
I hit this during local tests. It's a fine invariant but it doesn't hold in
forced shutdown.

MozReview-Commit-ID: HtoiGwf7IMI

--HG--
extra : rebase_source : 707de2fe08ccad99a06dab00969e2f140e63abad
2018-01-03 15:13:36 +01:00
Andreas Pehrson
2b25cd7258 Bug 1299515 - Signal SetPullEnabled with a message. r=padenot
With the added invariant that NotifyPull() needs a MediaStreamListener present
to not underrun, we need SetPullEnabled() and AddListener() to stay in sync by
using the same signaling mechanism.

MozReview-Commit-ID: 49KWdiTOG98

--HG--
extra : rebase_source : d0ad44d7ce431aa792c4908f96baf0c0920dbe90
2018-01-03 11:59:41 +01:00
Andreas Pehrson
aa75f0c28e Bug 1408294 - Don't assume there is always a listener feeding a SourceMediaStream. r=padenot
There are legit cases when a SourceMediaStream gets pulled without a listener
present.

A clear example (though a corner case and easily overlooked) that I've hit is
when the last track is ended and the only stream listener is removed at the same
time. This leads to a pull on the next iteration where the track-end has not
yet been picked up. And thus, a false positive error saying that a live track
doesn't have listeners.

The real error here will now instead be caught by the new assert for when a
pulled stream underruns (which is now illegal).

MozReview-Commit-ID: 3e8FcCZfhYJ

--HG--
extra : rebase_source : ada823dbab07c8ca50429cd854b0c4b1df688fbb
2018-01-04 10:32:30 +01:00
Andreas Pehrson
ee75d2b969 Bug 1408294 - Assert that NotifyPull produces data. r=padenot
MozReview-Commit-ID: CtC8A83iJgg

--HG--
extra : rebase_source : ada5a771164fafe35d22589956ced6f54545ee73
2017-12-05 14:34:08 +01:00
Chris Peterson
37efe4d0e6 Bug 1428535 - Add missing override specifiers to overridden virtual functions. r=froydnj
MozReview-Commit-ID: DCPTnyBooIe

--HG--
extra : rebase_source : cfec2d96faeb11656d86d760a34e0a04cacddb13
extra : intermediate-source : 6176724d63788b0fe8caa3f91607c2d93dbaa7ec
extra : source : eebbb0600447f9b64aae3bcd47b4be66c02a51ea
2017-11-05 19:37:28 -08:00
Paul Adenot
e3c5088847 Bug 1428392 - Remove AudioOutputObserver, and feed the reverse-stream directly to the AEC. r=pehrsons
MozReview-Commit-ID: EVpH5LUOZ6g

--HG--
extra : rebase_source : d172cd10dffee89ac48b9ec6b6435dcf0c0581d4
2018-01-05 18:10:23 +01:00
Karl Tomlinson
798ca9ae4e bug 1418820 add diagnostic asserts to check for running with incorrect lifecycle state r=padenot
MozReview-Commit-ID: HfwBfHoIsTu

--HG--
extra : rebase_source : 854ac34687bdcea2faf01d8006f8302ff2139923
2017-12-21 18:04:08 +13:00
Jean-Yves Avenard
0a4ce68473 Bug 1425623 - Don't allocate array on the heap. r=padenot
Instead allocate it on the stack and provide it as out parameter.

MozReview-Commit-ID: 9fSJ68EfAga

--HG--
extra : rebase_source : 81430b45e4341d0f4208097f021c2a917e8e2645
2017-12-17 15:47:44 +01:00
Jean-Yves Avenard
9c5a09051e Bug 1404997 - P26. Give Await the threadpool to use. r=gerald
This allows to re-use the SharedThreadPool across calls, preventing the need to create a new thread on each call.

MozReview-Commit-ID: CbP6OTYKhHL

--HG--
extra : rebase_source : 969f2c74f00614d6265fe0e25abfb36c9648d564
2017-12-15 20:06:38 +01:00
Jean-Yves Avenard
1fc0ccabbd Bug 1404997 - P20. Make MediaStreamListener::NotifyPull asynchronous. r=padenot
The operations is done in two ways:
1- Process all the MediaStreamListener at once, which returns a promise that will be resolved once the operation is completed.
2- As the Cubeb audio callback must be resolved immediately, the MSG will wait for all the promises to be resolved until it continues the operation of feeding the callback the necessary data.

This will allow to parallelize the stream's tracks' audio decoding.

MozReview-Commit-ID: EeoDvxnJyWV

--HG--
extra : rebase_source : 3d09af5aa3c80c4892a4d9af80842541d8fc33bb
2017-12-10 21:33:43 +01:00
Jean-Yves Avenard
8ee5b6a296 Bug 1404997 - P17. Split ExtractPendingInput into two methods. r=padenot
There were two steps happening inside ExtractPendingInput:
1- Retrieve the data from the StreamTracks
2- Process any pending pending states change

We split it so that the retrieval from the StreamTrack can be promisified in an upcoming change

MozReview-Commit-ID: 53O4fXWMDGL

--HG--
extra : rebase_source : da082fa8db3a9029dc05d845cb9f58514f5ffcff
2017-12-07 20:52:56 +01:00
Jean-Yves Avenard
ec5bd7af01 Bug 1404997 - P16. Properly finish the SourceMediaStream during shutdown. r=padenot
Despite the name of the function, the original SourceMediaStream::Finish() (consequently renamed FinishPending) didn't actually finished the stream, but instead set a bool that would indicate to completely finish the stream once ExtractPendingInput ran. But here it could never run again.
So actually do what the original fix intended to do (bug 1410829)

MozReview-Commit-ID: 1hHiOLiovG

--HG--
extra : rebase_source : 7b108a96b54c92812ba583b0dc78ceddbfe15636
2017-12-07 20:20:53 +01:00
Jean-Yves Avenard
d62fc9df33 Bug 1404997 - P15. Move MSG::FinishStream logic to MediaStream. r=padenot
It is good practice for the MSG to now know the implementation details of the MediaStream.

Additionally, this will allow to make a thread-safe version later.,

MozReview-Commit-ID: CTacCLSeKRP

--HG--
extra : rebase_source : 4feb4beb12f4cd2a6fb67fd6a18f003ea8b18869
2017-12-07 16:12:19 +01:00
Jean-Yves Avenard
a21ef82be7 Bug 1404997 - P14. Rename members to clarify the finish meaning. r=padenot
We have different concept of "finish" between the base class and its hierarchy.
Attempt to clear the sitatuation by renaming the members and related methods.

MozReview-Commit-ID: vFsXhMK5GY

--HG--
extra : rebase_source : 65eda9257e447584161da51af7c240e31027c501
2017-12-06 19:00:22 +01:00
Jean-Yves Avenard
55065b688d Bug 1404997 - P13. Move ExtractPendingInput logic to SourceMediaStream. r=padenot
The MSG shouldn't have to know about the inner details of the SourceMediaStream

MozReview-Commit-ID: 2S81SPzy09E

--HG--
extra : rebase_source : dff8384b19442e7686cef42420372e39f10094b6
2017-12-06 16:55:56 +01:00
Jean-Yves Avenard
b8ec246a1f Bug 1404997 - P7. Simplify played time calculations. r=pehrsons
Now that the graph rate match the one out of NetEQ, we can remove an unecessary conversion.

Additionally, move a member from the base case to the only one where it's used.

MozReview-Commit-ID: II5mdcl0vhK

--HG--
extra : rebase_source : 1d9edfc2803c3fadde7505b4d84293640e4311e0
2017-12-08 20:58:09 +01:00
Alex Chronopoulos
8904b64329 Bug 1406772 - Get channel count from MSG. p=padenot
MozReview-Commit-ID: 8aFdJkfcbCA
2017-12-01 23:21:42 +02:00
Karl Tomlinson
7c98745089 bug 1408276 move to LIFECYCLE_WAITING_FOR_MAIN_THREAD_CLEANUP at end of iteration f=pehrsons r=padenot
MozReview-Commit-ID: GbfIOPZPuGu

--HG--
extra : rebase_source : 8a7abbe8a96a90f20dbb0465b6a5f69f05140d4f
extra : amend_source : 41079a2a825b53ed6d4e8cc31fc4c8de2f041e8b
extra : histedit_source : df5b962ac253df34ace8ebc22cdd98b608b6ddfb
2017-10-17 18:14:43 +13:00
Jean-Yves Avenard
2f874411a0 Bug 1415556 - P11. Remove unecessary locking. r=padenot
The method doesn't use any MSG member, only dispatching a task.

MozReview-Commit-ID: 7uZbTvq9OQt

--HG--
extra : rebase_source : e12c5ffcb6479ab2bc06973121c291e759db23a4
2017-11-11 10:20:59 +01:00
Jean-Yves Avenard
d1be81a96e Bug 1415556 - P10. Make functions const where needed. r=padenot
MozReview-Commit-ID: EBEgDVCTewa

--HG--
extra : rebase_source : 282ea4f98d253e9235f159afd7d3f88a4f26d6b1
2017-11-10 20:01:27 +01:00
Jean-Yves Avenard
a4416cf9f6 Bug 1415556 - P7. Remove unecessary locking. r=padenot.
mForceShutdownTicket and mShutdownTimer are only ever accessed on the main thread. We don't need the use of the monitor to reset them.

MozReview-Commit-ID: 1DL8bLmzEH5

--HG--
extra : rebase_source : 84d56c7f4428143426cd22e88ef2912330efba4e
2017-11-10 18:53:23 +01:00
Jean-Yves Avenard
66c39c273f Bug 1415556 - P6. Ensure mLifecycleState member is always accessed safely. r=padenot
We only access mLifecycleState via a helper which strongly enforced how the member can be accessed.
Two non-safe accesses are corrected.

MozReview-Commit-ID: 6LYk7t4rSyB

--HG--
extra : rebase_source : 9727771e1b04ba1b39f5cf9a6cf94093b7e92b27
2017-11-10 18:38:02 +01:00
Jean-Yves Avenard
251f706a51 Bug 1415556 - P5. Use helper to set mDriver. r=padenot
MozReview-Commit-ID: Fres1YwcYYM

--HG--
extra : rebase_source : e856357a57708d21e896818095fa1a25085b11a9
2017-11-10 18:28:42 +01:00
Jean-Yves Avenard
95a29ea071 Bug 1415556 - P4. Make members atomics. r=padenot
They are accessed across multiple threads without the use of monitors.
While it could be argued that some use of the monitor in functions accessing those members would set in place memory barriers, making them atomics remove all doubts as to the thread safetyness of their use.

MozReview-Commit-ID: tyTqeGgDNM

--HG--
extra : rebase_source : 420c38abcfeaa5fca2449034d8e1e3d82949d49d
2017-11-10 18:27:39 +01:00
Jean-Yves Avenard
2eda28dd35 Bug 1415556 - P3. clearly mark functions' thread use. r=padenot
MozReview-Commit-ID: BXmdk4zBo28

--HG--
extra : rebase_source : 4afd6fa5e887aff093e7a9e629e8c93573f17631
2017-11-10 18:24:20 +01:00
Andreas Pehrson
e22e9cf471 Bug 1407542 - Implement MediaStreamGraph::GetInstanceIfExists. r=padenot
MozReview-Commit-ID: EAd0rIrZg43

--HG--
extra : rebase_source : 2fdfc1ce361b9f9d6c43ffa887c54c88e6157f11
2017-10-23 19:08:40 +02:00
Andreas Pehrson
c8ea57f25d Bug 1410829 - Clean up streams and listeners before unblocking shutdown. r=padenot
MozReview-Commit-ID: CcGaAJAUahm

--HG--
extra : rebase_source : 70133a11af466484bd7bbf6ef8793fbdff4312ab
2017-10-27 10:12:59 +02:00
Andreas Pehrson
71cacec3d5 Bug 1410829 - Signal listeners removed on shutdown so they can clean up. r=padenot
When shutting down we shut modules down in the order of
[media, gfx, cycleCollector].

At the same time we rely on destructors to clean up resources for MediaStreams
and MediaStreamTracks, but these objects may be held until cycleCollector
shutdown. Gfx resources are not allowed to be released after gfx shutdown, which
is where we this approach hits a wall.

This patch will signal them through the three available listener types to clean
up during media shutdown.

MozReview-Commit-ID: FwsG3ukV29P

--HG--
extra : rebase_source : 554ec29a43b7551b3b5570577b0559285e36d4fd
2017-10-26 16:13:38 +02:00
Kris Maglione
60d080b412 Bug 1404198: Part 2i - Switch to NS_NewTimer* in dom. r=njn
MozReview-Commit-ID: 8Oei6TuXNbu

--HG--
extra : rebase_source : 31c583c699790cbcf302064146d313ee8126ef0c
2017-10-15 23:15:40 -07:00
Karl Tomlinson
a7bb0b6a26 bug 1406830 store the AsyncCubeTask SharedThreadPool reference on the AudioCallbackDriver r=jesup,padenot
The first AsyncCubebTask dispatch from AudioCallbackDriver::Start() may either
be from MediaStreamGraphImpl::RunInStableState() on the main thread or
ThreadedDriver::RunThread() on a threaded driver thread.
These could potentially occur concurrently when there are multiple
MediaStreamGraphs.

This change removes the race around setting sThreadPool.
SharedThreadPool::Get() would have returned the same pointer, and so
that race was probably mostly benign apart from the potential to add an
extra reference and so hang on shutdown in SharedThreadPool::SpinUntilEmpty().

Storing the reference to the SharedThreadPool on the object using it is the
typical way to use SharedThreadPool.  It lets the thread pool be released when
not in use, and lets SharedThreadPool deal with multi-thread access and
shutdown.

MozReview-Commit-ID: 8WutVsAMfJo

--HG--
extra : rebase_source : a3d0ce75d65889fff47389ccd80640c3f1150244
2017-09-26 17:28:17 +13:00
Andreas Pehrson
2acc2e8b7e Bug 1406027 - Always use the mixer so AudioCallbackDriver can track processed samples. r=padenot
This is unnecessary work but simpler than adding a path to, or refactoring, AudioCallbackDriver::DataCallback.

MozReview-Commit-ID: GLNoBqxEuwz

--HG--
extra : rebase_source : b5ef6b2e1506e68d41b22ad557968d70214fbd9f
2017-10-06 12:42:11 +02:00
Karl Tomlinson
449d985d8e bug 1406831 don't tolerate just owning the monitor if AssertOnGraphThreadOrNotRunning() is not called on the correct thread r=pehrsons
Owning the monitor is not sufficient for consistent state if state can be
accessed without the monitor.

The requirements for SetCurrentDriver() are tighted to require both the
monitor and correct thread, as CurrentDriver() can be called either with the
monitor or on the graph thread.

MozReview-Commit-ID: 90q7Pfa8jxn

--HG--
extra : rebase_source : 6cbcc334dc2bd355d2e9afdebda45a9624edda4b
2017-09-28 15:30:48 +13:00
Karl Tomlinson
4bd4041ca0 bug 1406831 tighten AssertOnGraphThreadOrNotRunning() to not accept graph thread after mDetectedNotRunning r=pehrsons
This also permits setting mDriver to null after mDetectedNotRunning, which is
useful for fixing bug 1406830.

MozReview-Commit-ID: EEgAxqPQPRI

--HG--
extra : rebase_source : 56e1583a0090e683e92463536637d0f1460cb727
2017-09-28 12:17:22 +13:00
Karl Tomlinson
b6f526449e bug 1406831 simplify AssertOnGraphThreadOrNotRunning() r=pehrsons
mLifecycleState is always > LIFECYCLE_RUNNING when mDetectedNotRunning

MozReview-Commit-ID: Ds6ybTv4miA

--HG--
extra : rebase_source : 71aea6693026dc919ea6d2096f55152ae12bc58e
2017-09-28 12:10:59 +13:00
Alex Chronopoulos
643923ac4c Bug 1400889 - Keep constant output channels in MediaStreamGraph. r=padenot
MozReview-Commit-ID: JlQdxU0aNOf

--HG--
extra : rebase_source : 25b6f223c2158a4eb9175731cdbb8521de4ce312
2017-10-03 17:56:53 +03:00
Andreas Pehrson
d918302551 Bug 1319446 - DirectMediaStreamListener, you are dead to me. r=padenot
MozReview-Commit-ID: KwztE5ogSj9

--HG--
extra : rebase_source : e8e6bb3548c5697c5db901c0310ea5067a30c895
2017-09-27 12:01:46 +02:00
Andreas Pehrson
540090020d Bug 1296531 - Make logic that passes buffered data to direct listener generic. r=jesup
MozReview-Commit-ID: GdGFJHTNBS

--HG--
extra : rebase_source : 031f02b25072a2c2e47e28c9f584c7d31a758c60
2017-05-24 18:54:40 +02:00
Andreas Pehrson
f6213c0568 Bug 1296531 - Don't notify of ended tracks when adding a direct listener. r=jesup
There were some cases where these tracks were detected as ended when they were
in fact not. That result in problems in the MediaRecorder.

MozReview-Commit-ID: 4CNUYRvzOgK

--HG--
extra : rebase_source : b94c29bc73e76575489a4684facc0b01bb7aeb22
extra : source : bedb7abcc84263c6a6369c4d05e8bf3287281090
2017-05-23 16:00:42 +02:00
Andreas Pehrson
eabd4ccaab Bug 1296531 - Break out ShutdownTicket and GetShutdownBarrier from MSG to MediaUtils. r=jib
MozReview-Commit-ID: HVCfuJz1zoA

--HG--
extra : rebase_source : 409867202687a2597f3ede12d06720f4a3e4ac30
2017-05-16 12:39:02 +02:00
Andreas Pehrson
63142392a5 Bug 1296531 - Notify MSG track listeners of removal during shutdown. r=jesup
MozReview-Commit-ID: BnWrUUvE5qk

--HG--
extra : rebase_source : d205097a8fd9e831af9ba4638b1e957224a546a9
2017-02-23 11:08:57 +01:00
Andreas Pehrson
8cf8c5abb7 Bug 1296531 - Change MSG ControlMessages from virtual to override. r=jesup
MozReview-Commit-ID: 5cCbIG4gpd0

--HG--
extra : rebase_source : adbf77d9b71d81794feb7cb0cc6d896717ee3eba
2017-02-23 11:08:26 +01:00
Andreas Pehrson
4cf8133d45 Bug 1296531 - Notify of realtime data after NotifyDirectListenerInstalled. r=jesup
MozReview-Commit-ID: Byw5PZTHdLC

--HG--
extra : rebase_source : 7f32fa5e32fbf358cd7e56158a82699625a8d6b5
extra : source : e3d8905bbadd64994388b1059e81ddb00bc0a84f
2016-11-17 09:59:49 +01:00
Wes Kocher
cf93b6ca0d Merge m-c to autoland, a=merge
MozReview-Commit-ID: BlE0HFQUP9c
2017-08-31 16:56:58 -07:00
Paul Adenot
202ba7566b Bug 1335029 - Take into account SystemClockDrivers in fallback mode when dealing with AudioContext promises. r=jesup
MozReview-Commit-ID: HBS6XGXDGf1

--HG--
extra : rebase_source : 00ea5cd91d0c96d352239fdd1fa89e332399fe04
2017-08-30 15:18:10 +02:00
Paul Adenot
097de34e5b Bug 1395593 - Don't query the maximum channel count in ::PlayAudio using cubeb. r=achronop
MozReview-Commit-ID: 97ri5vhzsRF

--HG--
extra : rebase_source : 56bc0f44566dfc3e271444f8dfc9f89e12a1a0a1
2017-08-31 17:14:34 +02:00
Matthew Gregan
2f8cc7804c Bug 1388236 - Remove B2G-only AudioChannel code from MSG. r=padenot 2017-08-10 13:00:08 +12:00
Carsten "Tomcat" Book
d360d49d2a merge mozilla-inbound to mozilla-central a=merge 2017-07-27 10:57:25 +02:00
Bevis Tseng
95b18d794e Bug 1382172 - Name nsITimerCallback instances in native implementation. r=billm
--HG--
extra : rebase_source : 84de1abfcc30a6964144c2e6718a508c71027b65
2017-07-27 02:18:20 +08:00
Kartikaya Gupta
ba4b3b9101 Bug 1384233 - Remove SizePrintfMacros.h. r=froydnj
We have a minimum requirement of VS 2015 for Windows builds, which supports
the z length modifier for format specifiers. So we don't need SizePrintfMacros.h
any more, and can just use %zu and friends directly everywhere.

MozReview-Commit-ID: 6s78RvPFMzv

--HG--
extra : rebase_source : 009ea39eb4dac1c927aa03e4f97d8ab673de8a0e
2017-07-26 16:03:57 -04:00