Commit Graph

514 Commits

Author SHA1 Message Date
Andreas Pehrson
4b3fa9c67e Bug 1493613 - Move MediaStream control from DOMMediaStream to MediaStreamTrack. r=padenot
This is inherently large, because modifying these bits of DOMMediaStream and
MediaStreamTrack affects all consumers and producers of all DOMMediaStreams and
MediaStreamTracks.

Things are generally much simpler now.

Producers of tracks now create a MediaStream in the graph, add it to a
MediaStreamTrackSource subclass that takes ownership of it, and add the source
to a MediaStreamTrack. Should the producer need a DOMMediaStream it is now much
simpler to create as the only thing needed is the current window. The stream is
a rather simple wrapper around an array of MediaStreamTracks.

HTMLMediaElement is still not as straight forward as other consumers since it
consumes the DOMMediaStream directly, as opposed to a set of tracks.
The new MediaStreamRenderer helper class helps bridge the gap between this fact
and the new track-based MediaStreamGraph interface, as it needs to juggle
registering multiple audio tracks for audio output. This hooks into existing
HTMLMediaElement logic and brings a welcome simplification to all the glue
previously needed there.

Differential Revision: https://phabricator.services.mozilla.com/D37934

--HG--
extra : moz-landing-system : lando
2019-07-31 07:58:17 +00:00
Andreas Pehrson
dc0cfa8bb6 Bug 1493613 - Clear mUpdateTracks in DestroyImpl to avoid leaking image buffers until CC shutdown. r=padenot
Normally a track in mUpdateTracks is cleared by ExtractPendingInput, when that
track's ending is processed. However, if the SourceMediaStream is destroyed
before an ended track is processed, the track including it's buffered segment
in mUpdateTracks will leak until the SourceMediaStream is destroyed.

This might not be until late XPCOM Shutdown when the cycle collector shuts down,
which is too late to release graphics resources.

Depends on D37931

Differential Revision: https://phabricator.services.mozilla.com/D37932

--HG--
extra : moz-landing-system : lando
2019-07-30 14:55:48 +00:00
Andreas Pehrson
82d0f44077 Bug 1493613 - Remove assert that next driver must be non-audio when no audio tracks are present. r=padenot
A legit case that fails this assert is:
- CloseAudioInput() on main thread for last non-webaudio MediaStream
- AudioContext closes on main thread
- CloseAudioInputImpl() on graph thread sets next driver to an output-only audio
  driver since there are AudioNodeStreams still present
- AudioContext's Close operation is applied on graph thread, first all
  AudioNodeStreams are suspended, making the graph consider itself as having no
  audio tracks present. Then we check the next driver, which is an audio driver
  per above. This fails the assert.

Differential Revision: https://phabricator.services.mozilla.com/D37931

--HG--
extra : moz-landing-system : lando
2019-07-30 14:55:30 +00:00
Nicholas Nethercote
18fae65f38 Bug 1563139 - Remove StaticPrefs.h. r=glandium
This requires replacing inclusions of it with inclusions of more specific prefs
files.

The exception is that StaticPrefsAll.h, which is equivalent to StaticPrefs.h,
and is used in `Codegen.py` because doing something smarter is tricky and
suitable for a follow-up. As a result, any change to StaticPrefList.yaml will
still trigger recompilation of all the generated DOM bindings files, but that's
still a big improvement over trigger recompilation of every file that uses
static prefs.

Most of the changes in this commit are very boring. The only changes that are
not boring are modules/libpref/*, Codegen.py, and ServoBindings.toml.

Differential Revision: https://phabricator.services.mozilla.com/D39138

--HG--
extra : moz-landing-system : lando
2019-07-26 01:10:23 +00:00
Paul Adenot
e7113463d0 Bug 1562626 - Keep a reference to the graph on device change. r=jesup
Differential Revision: https://phabricator.services.mozilla.com/D36580

--HG--
extra : moz-landing-system : lando
2019-07-23 18:49:45 +00:00
Karl Tomlinson
ff940f743d Bug 1542931 add a mechanism to notify engine on graph thread of forced shutdown r=padenot
This will be used to release the AudioWorkletProcessor on the correct thread.

Depends on D34480

Differential Revision: https://phabricator.services.mozilla.com/D34481

--HG--
extra : moz-landing-system : lando
2019-06-14 15:04:48 +00:00
Paul Adenot
8c692f2f23 Bug 1324552 - Implement AudioContext baseLatency and outputLatency attributes. r=pehrsons,baku
Differential Revision: https://phabricator.services.mozilla.com/D37280

--HG--
extra : moz-landing-system : lando
2019-07-12 11:28:03 +00:00
shindli
883c6619a6 Backed out 3 changesets (bug 1324552, bug 1324545, bug 1350973) for causing perma mda leakcheck failures CLOSED TREE
Backed out changeset db14e59c7e6e (bug 1324545)
Backed out changeset 088e13476d39 (bug 1324552)
Backed out changeset e79a64fc49e7 (bug 1350973)
2019-07-11 18:55:03 +03:00
Paul Adenot
4c99611f32 Bug 1324552 - Implement AudioContext baseLatency and outputLatency attributes. r=pehrsons,baku
Differential Revision: https://phabricator.services.mozilla.com/D37280

--HG--
extra : moz-landing-system : lando
2019-07-11 13:30:07 +00:00
Boris Zbarsky
46934887af Bug 1553018 part 1. Add various media preferences bindings use in Pref annotations on interfaces to StaticPrefs. r=jya
The renaming of MediaWebspeechRecognitionEnable to
media_webspeech_recognition_enable is to follow the StaticPrefs convention,
because bindings are going to assume that convention.

Differential Revision: https://phabricator.services.mozilla.com/D32942

--HG--
extra : moz-landing-system : lando
2019-05-30 17:21:39 +00:00
Andreas Pehrson
b9873fa23e Bug 1551855 - Add a dedicated pref for enabling GraphRunner. r=karlt
Differential Revision: https://phabricator.services.mozilla.com/D31262

--HG--
extra : moz-landing-system : lando
2019-05-16 06:10:54 +00:00
Jan-Ivar Bruaroey
e52e8837ef Bug 1407415 - Consolidate media::GetShutdownBarrier() use and return a RefPtr r=dminor
Differential Revision: https://phabricator.services.mozilla.com/D29700

--HG--
extra : moz-landing-system : lando
2019-05-03 21:08:42 +00:00
Andreas Pehrson
cef48c8ec4 Bug 1545133 - Avoid trying to double-suspend a MediaStream if external code makes the suspendCount negative. r=padenot
We don't currently know any ways in which external code can make the
suspendCount negative, but this will keep us safe should a future bug enable it.

Depends on D28805

Differential Revision: https://phabricator.services.mozilla.com/D28806

--HG--
extra : moz-landing-system : lando
2019-04-25 16:41:15 +00:00
Andreas Pehrson
58af5d4443 Bug 1536766 - Make NotifyOutput from SourceMediaStream tracks reflect amount of data in the track. r=padenot
`streamCurrentTime` is relative to the start of the stream, as is the track's
segment. We need to account for the track's start time in the stream when
notifying of output.

Differential Revision: https://phabricator.services.mozilla.com/D27268

--HG--
extra : moz-landing-system : lando
2019-04-24 10:56:04 +00:00
Andreas Pehrson
39580a0cf7 Bug 1536766 - Remove unused MediaStream::HasCurrentData. r=padenot
Differential Revision: https://phabricator.services.mozilla.com/D27266

--HG--
extra : moz-landing-system : lando
2019-04-24 10:55:50 +00:00
Andreas Pehrson
2c9b92be1f Bug 1536766 - Handle DecodedStream's resets when calculating VideoChunk durations in the MSG. r=padenot
This is necessary to get an accurate total track duration in case DecodedStream
does a lot of seeking and pausing.

This also removes previous code for avoiding blocking a video track, as this new
code handles that case too.

Differential Revision: https://phabricator.services.mozilla.com/D27264

--HG--
extra : moz-landing-system : lando
2019-04-24 10:55:46 +00:00
Andreas Pehrson
19834afbea Bug 1536766 - Don't ignore null frames in MediaStreamGraph. r=padenot
Null frames could still be valid. It's how DecodedStream signals a pause. They
could also be valid and have an intrinsic size and the force-black flag set.

Differential Revision: https://phabricator.services.mozilla.com/D27263

--HG--
extra : moz-landing-system : lando
2019-04-24 10:55:41 +00:00
Alex Chronopoulos
bd827c189f Bug 1541290 - Close audio input from main thread to ensure that the message is not executed on a closed graph. r=pehrsons
CloseAudioInut method posts a message, to the graph thread, in order to close the input asynchonously. When CloseAudioInput method was being executed from a thread other than the main thread, a runnable would be posted to main thread in order to post the async message from there. That was a risky path because when the graph was shutting down there were no guarantee that the close-input message would reach the graph thread before destroy takes place. By limiting CloseAudioInput to main thread it is ensured that the close-input message will be executed before destroy.

Differential Revision: https://phabricator.services.mozilla.com/D27751

--HG--
extra : moz-landing-system : lando
2019-04-18 18:35:20 +00:00
Ciure Andrei
add7a3fb9e Backed out 14 changesets (bug 1536766) for causing RunWatchdog and mediaElementAudioSource wpt failures CLOSED TREE
Backed out changeset 72d37a08f281 (bug 1536766)
Backed out changeset 63fc85885060 (bug 1536766)
Backed out changeset addbb04415cb (bug 1536766)
Backed out changeset f2923dfcf33c (bug 1536766)
Backed out changeset 25f3a33ec51b (bug 1536766)
Backed out changeset 199efe6aec59 (bug 1536766)
Backed out changeset f9d1f1bfe2b1 (bug 1536766)
Backed out changeset 87616997f160 (bug 1536766)
Backed out changeset 36f99fa3c956 (bug 1536766)
Backed out changeset 000260ba28de (bug 1536766)
Backed out changeset 6386ed1b7d74 (bug 1536766)
Backed out changeset ab27d9f5902a (bug 1536766)
Backed out changeset 4f6d240c210d (bug 1536766)
Backed out changeset 3e0e3030314d (bug 1536766)
2019-04-19 05:55:57 +03:00
Andreas Pehrson
27c622fc65 Bug 1536766 - Make NotifyOutput from SourceMediaStream tracks reflect amount of data in the track. r=padenot
`streamCurrentTime` is relative to the start of the stream, as is the track's
segment. We need to account for the track's start time in the stream when
notifying of output.

Differential Revision: https://phabricator.services.mozilla.com/D27268

--HG--
extra : moz-landing-system : lando
2019-04-18 15:25:51 +00:00
Andreas Pehrson
e63ff93e4d Bug 1536766 - Remove unused MediaStream::HasCurrentData. r=padenot
Differential Revision: https://phabricator.services.mozilla.com/D27266

--HG--
extra : moz-landing-system : lando
2019-04-18 15:24:12 +00:00
Andreas Pehrson
120d5e5971 Bug 1536766 - Handle DecodedStream's resets when calculating VideoChunk durations in the MSG. r=padenot
This is necessary to get an accurate total track duration in case DecodedStream
does a lot of seeking and pausing.

This also removes previous code for avoiding blocking a video track, as this new
code handles that case too.

Differential Revision: https://phabricator.services.mozilla.com/D27264

--HG--
extra : moz-landing-system : lando
2019-04-18 15:23:59 +00:00
Andreas Pehrson
834eeba666 Bug 1536766 - Don't ignore null frames in MediaStreamGraph. r=padenot
Null frames could still be valid. It's how DecodedStream signals a pause. They
could also be valid and have an intrinsic size and the force-black flag set.

Differential Revision: https://phabricator.services.mozilla.com/D27263

--HG--
extra : moz-landing-system : lando
2019-04-18 15:23:46 +00:00
Paul Adenot
b1c0df1177 Bug 1531833 - Add a way to tell the graph driver that the audio input is voice. r=pehrsons
Differential Revision: https://phabricator.services.mozilla.com/D21737

--HG--
extra : moz-landing-system : lando
2019-04-16 15:42:38 +00:00
Oana Pop Rus
212a653d81 Backed out 6 changesets (bug 1531833) for geckoview failures on PermissionDelegateTest.media CLOSED TREE
Backed out changeset f90ad6bb8ebd (bug 1531833)
Backed out changeset 465570a54b46 (bug 1531833)
Backed out changeset e725253ee976 (bug 1531833)
Backed out changeset 74ad8e7a722b (bug 1531833)
Backed out changeset b1268e5f7023 (bug 1531833)
Backed out changeset e3ec78b2db1f (bug 1531833)

--HG--
extra : amend_source : 81aa19c352e72cac2369e014d19ec5a896538b21
2019-04-11 21:16:55 +03:00
Paul Adenot
7806f50930 Bug 1531833 - Add a way to tell the graph driver that the audio input is voice. r=pehrsons
Differential Revision: https://phabricator.services.mozilla.com/D21737

--HG--
extra : moz-landing-system : lando
2019-04-11 09:19:34 +00:00
Paul Adenot
6a2902075e Bug 1541805 - Don't rely on the MSG to determine the number of channels to use, pass it instead. r=karlt
Differential Revision: https://phabricator.services.mozilla.com/D26197

--HG--
extra : moz-landing-system : lando
2019-04-08 07:59:47 +00:00
Paul Adenot
cbccf7ece3 Bug 1541467 - Handle situations where the document is not available from the AudioContext. r=karlt
Differential Revision: https://phabricator.services.mozilla.com/D25955

--HG--
extra : moz-landing-system : lando
2019-04-05 11:38:06 +00:00
Paul Adenot
653464a0cf Bug 1375562 - Allow suspending, resuming and closing an AudioContext without triggering the statechange event and dealing with Promises. r=karlt
This allows suspending and resuming the context from the debugger without having
observable side-effects.

Differential Revision: https://phabricator.services.mozilla.com/D24915

--HG--
extra : moz-landing-system : lando
2019-04-02 11:10:02 +00:00
Karl Tomlinson
7ab570009e bug 1539045 use AppendMessage() for ForceShutDown() r=padenot
instead of special signaling, which can get out of order with other messages.

Using AppendMessage() provides that control messages sent to the graph before
shutdown are run on the graph thread.

Differential Revision: https://phabricator.services.mozilla.com/D24856

--HG--
extra : moz-landing-system : lando
2019-03-26 12:41:05 +00:00
Karl Tomlinson
03327ed124 Bug 1539045 remove unnecessary !mRealtime checks with mForcedShutDown r=padenot
These are unnecessary because non-empty !mRealtime graphs also set
mForcedShutDown before progressing to
LIFECYCLE_WAITING_FOR_MAIN_THREAD_CLEANUP.

This reverts some of
https://hg.mozilla.org/mozilla-central/rev/d0d427badc22afa7d5406e4e376bf27df0c0aaba#l1.72
which is possible because a non-realtime graph no longer progresses to
LIFECYCLE_WAITING_FOR_MAIN_THREAD_CLEANUP when it reaches mEndTime since
https://hg.mozilla.org/mozilla-central/rev/61d08765489c#l1.41

Differential Revision: https://phabricator.services.mozilla.com/D24855

--HG--
extra : moz-landing-system : lando
2019-03-27 14:11:33 +00:00
Andreas Pehrson
94ec4e907a Bug 1423253 - Notify MediaStreamTrackListeners about tracks' enabled state. r=padenot
Disabling a track from a MediaEngineRemoteVideoSource will automatically stop
that source until the track is enabled again. With consumers of this track
getting frames through direct listeners only, there would be no more frames
coming after the source has stopped. This stopping races with making the next
frame that is appended to the track (through the MSG, though direct) black,
sometimes leaving the consumer with no black frame at all.

Specs say to render disabled video tracks as black, so with direct listeners
this needs to be signaled to, and handled by, the consumers explicitly.

Differential Revision: https://phabricator.services.mozilla.com/D22923

--HG--
extra : moz-landing-system : lando
2019-03-22 11:45:29 +00:00
Andreas Pehrson
d3c6249d6d Bug 1423253 - Disallow direct track listeners for audio tracks. r=padenot
Audio tracks are real-time-only.

Differential Revision: https://phabricator.services.mozilla.com/D22919

--HG--
extra : moz-landing-system : lando
2019-03-22 11:44:07 +00:00
Andreas Pehrson
1b901d5e29 Bug 1423253 - Remove unused SourceMediaStream::GetEndOfAppendedData. r=padenot
Differential Revision: https://phabricator.services.mozilla.com/D22917

--HG--
extra : moz-landing-system : lando
2019-03-22 11:44:00 +00:00
Andreas Pehrson
4c4a721106 Bug 1423253 - Disallow pulling of video. r=padenot
Differential Revision: https://phabricator.services.mozilla.com/D22916

--HG--
extra : moz-landing-system : lando
2019-03-22 11:43:52 +00:00
Andreas Pehrson
e57962eea8 Bug 1423253 - Remove durations from VideoSegment::AppendFrame. r=padenot
VideoSegments still have durations, and they are still needed by the
MediaStreamGraph as it shuffles MediaSegments around.
They do not have a say in the wall-clock duration of video frames however.
Removing this should prevent any producers starting to add video chunks with
durations in the future.

Differential Revision: https://phabricator.services.mozilla.com/D22914

--HG--
extra : moz-landing-system : lando
2019-03-22 11:43:40 +00:00
Andreas Pehrson
04fb07dce9 Bug 1423253 - Disregard VideoChunk durations in VideoTrackEncoder. r=padenot
Long-term we want to lift durations out of video altogether, and only use
wall-clock timestamps. This patch achieves this in VideoTrackEncoder.

When the MediaStreamGraph is audio-only, the equivalent for video will be
completely duration-less. Until we have that, some pieces around the MSG will
still need durations for track-bookkeeping reasons.

This also integrates the DriftCompensator into VideoTrackEncoder, by
compensating for drift when frames are moved from mIncomingBuffer to
mOutgoingBuffer, i.e., when we recalculate time stamps into durations for the
underlying encoder to use.

Differential Revision: https://phabricator.services.mozilla.com/D22909

--HG--
extra : moz-landing-system : lando
2019-03-22 11:43:08 +00:00
Andreas Pehrson
3cac7c4765 Bug 1423253 - Automatically progress a pushed video track to avoid blocking its stream. r=padenot
Differential Revision: https://phabricator.services.mozilla.com/D22905

--HG--
extra : moz-landing-system : lando
2019-03-22 11:42:45 +00:00
Andreas Pehrson
e0b244ec9e Bug 1506093 - Remove StreamTracksStartTimeStamp. r=padenot
DecodedStream has been basing video timestamps on something called
StreamTracksStartTimeStamp in MediaStreams, which call through all the way
down to the GraphDriver.

This removes the entire timestamp mechanism, except for a bit of legit
usage internally in the SystemClockDriver. Video timestamps are instead
based on the audio clock through GetPosition(), the same way the VideoSink
operates.

Differential Revision: https://phabricator.services.mozilla.com/D22896

--HG--
extra : moz-landing-system : lando
2019-03-22 11:41:46 +00:00
Andreas Pehrson
a8f25bd13a Bug 1506093 - Remove MediaStreamVideoSink. r=padenot
The way it's implemented it only adds plumbing and overhead, no value.
This patch moves it to a thin wrapper around DirectMediaStreamTrackListener,
managed by VideoStreamTrack, instead.

Differential Revision: https://phabricator.services.mozilla.com/D22895

--HG--
extra : moz-landing-system : lando
2019-03-22 11:41:39 +00:00
Andreas Pehrson
acf9d0ab88 Bug 1473469 - Make MediaStreamGraph run on a single thread with AudioWorklets enabled. r=padenot
Differential Revision: https://phabricator.services.mozilla.com/D20828

--HG--
extra : moz-landing-system : lando
2019-03-06 20:12:25 +00:00
Csoregi Natalia
9d67bf069c Backed out changeset 45c838c4137d (bug 1473469) for various dom/worklet/ failures. CLOSED TREE 2019-03-01 19:39:32 +02:00
Andreas Pehrson
1b78f72fe7 Bug 1473469 - Make MediaStreamGraph run on a single thread with AudioWorklets enabled. r=padenot
Differential Revision: https://phabricator.services.mozilla.com/D20828

--HG--
extra : moz-landing-system : lando
2019-03-01 10:11:16 +00:00
Karl Tomlinson
a18b25dacc Bug 1529399 Remove unnecessary wrapper runnable from CreateDirectTaskDrainer() for stable state runnables r=padenot
The original DrainDirectTask() call was added for reasons described in https://bugzilla.mozilla.org/show_bug.cgi?id=1144486#c16 which should now be unnecessary since https://hg.mozilla.org/integration/autoland/rev/ed7c9d7a635d

The code being removed here was rework to use an appropriate AbstractThread:
https://hg.mozilla.org/mozilla-central/rev/02e5708a75fcdd9e8e4b065995f00b29896fb4b5#l9.32
https://bugzilla.mozilla.org/show_bug.cgi?id=1314833#c76

Differential Revision: https://phabricator.services.mozilla.com/D20604

--HG--
extra : moz-landing-system : lando
2019-02-25 10:50:19 +00:00
Jan-Ivar Bruaroey
a35b931962 Bug 1522773 - Reject any outstanding DOMMediaStream::TrackPort::BlockSourceTrackId() promise on teardown to avoid recent debug assert permafail. r=bwc
Differential Revision: https://phabricator.services.mozilla.com/D18590

--HG--
extra : moz-landing-system : lando
2019-02-05 20:59:52 +00:00
Andreas Pehrson
6c44eb1372 Bug 1523817 - Fix tracks that start at StreamTime t > 0. r=padenot
Differential Revision: https://phabricator.services.mozilla.com/D18312

--HG--
extra : moz-landing-system : lando
2019-02-01 13:44:44 +00:00
Andreas Pehrson
4153810bc8 Bug 1521577 - Don't block a MediaStream where at least one track is pulled. r=achronop
With the per-track pulling settings we have today it is clearly the intention
of the producer to start consuming a track that has pulling enabled, even if
there are other tracks where pulling is disabled.

This patch fixes that, so that when a stream has at least one pulled track it
will append null data to other tracks (commonly video) if they are lacking
data.

This means that we still block an entire stream if all tracks have pulling
disabled - to maintain the status quo for media element capture, which is
the only push-only producer of data.

Differential Revision: https://phabricator.services.mozilla.com/D17611

--HG--
extra : moz-landing-system : lando
2019-01-28 07:26:03 +00:00
Ehsan Akhgari
e5e885ae31 Bug 1521000 - Part 2: Adjust our clang-format rules to include spaces after the hash for nested preprocessor directives r=sylvestre
# ignore-this-changeset

--HG--
extra : amend_source : 7221c8d15a765df71171099468e7c7faa648f37c
extra : histedit_source : a0cce6015636202bff09e35a13f72e03257a7695
2019-01-18 10:16:18 +01:00
Andreas Pehrson
8acabc8a13 Bug 1513973 - Log NotifyPull per track instead of per stream. r=jib
This better reflects the actual pulling that we do.

Differential Revision: https://phabricator.services.mozilla.com/D15195

--HG--
extra : moz-landing-system : lando
2019-01-04 06:39:58 +00:00
Dorel Luca
12e4f91411 Backed out 5 changesets (bug 1513973) for browser-chrome failures in browser/base/content/test/webrtc/browser_devices_get_user_media_screen.js. CLOSED TREE
Backed out changeset 2ddf61b1db11 (bug 1513973)
Backed out changeset 6c839f548745 (bug 1513973)
Backed out changeset 5669b30f2265 (bug 1513973)
Backed out changeset 6781e633d62c (bug 1513973)
Backed out changeset f1892f178011 (bug 1513973)
2018-12-21 23:28:51 +02:00