Commit graph

1351 commits

Author SHA1 Message Date
alwu
5c53d3f7d8 Bug 1685399 - part4 : check media info directly to know if video is valid. r=padenot
I will move these telemetry related codes out from media element, so I want to avoid using media element's own attribute to determine if we need to report the probe or not, which will help that following works don't need to reply on media element's own attribute.

Differential Revision: https://phabricator.services.mozilla.com/D101109
2021-01-14 19:54:42 +00:00
alwu
4b46783098 Bug 1685399 - part3 : use actual invisible state to determine if we should suspend decoding. r=padenot
There is no need for decoder to use both "document visibility" and "element's layout visibility" to determine if we should suspend decoding.

That can simply be done by checking `HTMLMediaElement::IsActuallyInvisible()`.

Differential Revision: https://phabricator.services.mozilla.com/D101108
2021-01-14 19:54:42 +00:00
alwu
9edb9d310f Bug 1685399 - part2 : reorgnize functions being used for determining if element is visible. r=padenot,webidl,mccr8
There are several functions related with an element's visibie state, which are confusing. So this patch is going to make them clearer and remove unnecessary function.

- `IsVisible()` : add description to mention that the visibility state is only for layout level, which doesn't represent the actual visible state.
- rename `IsHidden()` to `IsActualInvisible()` : make it represent the actual visible state of an element.
- remove `IsActive()` : current two callers of `IsActive()` only care about if the page is inactive or not, it doesn't care about if page hidden or not. So we can call the owner doc's method directly.

Differential Revision: https://phabricator.services.mozilla.com/D101107
2021-01-19 19:48:43 +00:00
alwu
45f3985c1e Bug 1685399 - part1 : remove mCurrentLoadPlayTime. r=padenot
`mCurrentLoadPlayTime` was added in [1], which is no longer in use, so we should remove it.

[1] https://phabricator.services.mozilla.com/D18628

Differential Revision: https://phabricator.services.mozilla.com/D101106
2021-01-14 19:54:41 +00:00
Andreas Pehrson
37c143a9fa Bug 1601385 - Don't continue UpdateOutputTrackSources if the tracks-captured state changed. r=jib
Changing the tracks-captured state will trigger another run of
UpdateOutputTrackSources, so continuing the current one is futile. The next run
will properly re-evaluate all input state to this function.

Differential Revision: https://phabricator.services.mozilla.com/D100004
2021-01-12 09:35:20 +00:00
Andreas Pehrson
73fccbfe24 Bug 1601422 - Update output track sources synchronously when aborted by content. r=jib
Differential Revision: https://phabricator.services.mozilla.com/D99936
2021-01-12 02:05:36 +00:00
Andreas Pehrson
1df5aff0c0 Bug 1601799 - Use a SharedDummyTrack for graph access in DecodedStream. r=karlt
When enabling our MediaTrack implementation (which we don't plan to by default,
NB) and disabling all audio tracks and unselecting all video tracks while having
an active captureStream leads to having no output tracks in DecodedStream.

In this case, DecodedStream doesn't know which graph to use for creating the
intermediary tracks it feeds data to. We don't want to resort to the default
graph either, since two graphs on different clocks could then race each other.

With this patch we plumb down a SharedDummyTrack from the media element where
the captureStream was triggered, through MediaDecoder, to DecodedStream. The
SharedDummyTrack guarantees to keep the graph alive, and holds the graph used
for the output tracks.

Differential Revision: https://phabricator.services.mozilla.com/D99822
2021-01-05 07:43:34 +00:00
Emilio Cobos Álvarez
3987c781d0 Bug 1635914 - Move active flag handling explicitly to BrowsingContext. r=nika
And have it mirror in the parent process more automatically.

The docShellIsActive setter in the browser-custom-element side needs to
be there rather than in the usual DidSet() calls because the
AsyncTabSwitcher code relies on getting an exact amount of notifications
as response to that specific setter. Not pretty, but...

BrowserChild no longer sets IsActive() on the docshell itself for OOP
iframes. This fixes bug 1679521. PresShell activeness is used to
throttle rAF as well, which handles OOP iframes nicely as well.

Differential Revision: https://phabricator.services.mozilla.com/D96072
2020-12-11 15:43:19 +00:00
Simon Giesecke
1c53236b70 Bug 1679272 - Include ScopeExit.h exactly where used. r=andi
Differential Revision: https://phabricator.services.mozilla.com/D98888
2020-12-07 14:25:59 +00:00
Simon Giesecke
971b645fe3 Bug 1660470 - Add missing include directives/forward declarations. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D87865
2020-11-23 16:21:38 +00:00
alwu
20a5d55af7 Bug 1674829 - part1 : dispatch 'MozNoControlsBlockedVideo' to video control. r=Gijs
When autoplay media gets blocked, dispatch `MozNoControlsBlockedVideo` event to video control in order to show `click-to-play` icon.

Differential Revision: https://phabricator.services.mozilla.com/D97505
2020-11-19 17:31:13 +00:00
alwu
19e7a1a22f Bug 1673509 - part3 : stop controlled media when it unbind from DOM tree. r=chunmin
When we remove the media from DOM tree, we should not only pause it but also stop controlling it.

Differential Revision: https://phabricator.services.mozilla.com/D95359
2020-11-19 00:33:26 +00:00
Sylvestre Ledru
bebb9f9181 Bug 1519636 - Reformat with clang-format-11 to the Google coding style r=andi,sg,geckoview-reviewers,snorp
It is bringing some minor changes

# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D90795
2020-11-18 09:05:59 +00:00
Sylvestre Ledru
fde06f6d21 Bug 1674637 - Use nested namespaces in dom/ r=sg,andi
Also add some missing namespace qualifications

Done with:
./mach static-analysis check --checks="-*,modernize-concat-nested-namespaces" --fix dom/
./mach clang-format -p $(hg status dom/|grep ^M|awk '{print $2}')

Differential Revision: https://phabricator.services.mozilla.com/D95456
2020-11-04 17:04:01 +00:00
Butkovits Atila
964cca3198 Backed out changeset c0adbf7522dc (bug 1674637) for bustage on GMPParent.cpp. CLOSED TREE 2020-11-04 10:54:36 +02:00
Sylvestre Ledru
5f29324f60 Bug 1674637 - Use nested namespaces in dom/ r=sg,andi
Also add some missing namespace qualifications

Done with:
./mach static-analysis check --checks="-*,modernize-concat-nested-namespaces" --fix dom/
./mach clang-format -p $(hg status dom/|grep ^M|awk '{print $2}')

Differential Revision: https://phabricator.services.mozilla.com/D95456
2020-11-04 08:29:00 +00:00
Emilio Cobos Álvarez
e5a63697bf Bug 1673707 - Simplify handling of the suspendMediaWhenInactive flag. r=nika
Make it a synced field on the top browsing context. This handling the
propagation right and is much simpler.

This should fix cases where we don't look at the top level docshell to
figure out if we should suspend media.

Differential Revision: https://phabricator.services.mozilla.com/D94878
2020-10-27 19:55:47 +00:00
Andreas Pehrson
d1aeaca86a Bug 1582294 - Implement MediaStreamTrackSource::HasAlpha for MediaDecoder sources. r=bryce
Differential Revision: https://phabricator.services.mozilla.com/D92899
2020-10-19 15:35:29 +00:00
Andreas Pehrson
d5227f851c Bug 1582294 - Set up HTMLMediaElement to convey video track alpha channel when playing a MediaStream. r=bryce
Differential Revision: https://phabricator.services.mozilla.com/D92898
2020-10-19 15:35:13 +00:00
Chun-Min Chang
9d1970b6ea Bug 1646719 - P1: Add more debugging logs r=gerald
Add some logs that can help us to check how many cache-streams are
suspended and the working status in `MediaCache::Update`

Differential Revision: https://phabricator.services.mozilla.com/D92124
2020-10-04 07:19:18 +00:00
Matt Woodrow
e94ba17c2e Bug 1660928 - Record video play time telemetry if we had a non-empty video track at any point. r=jya
YouTube frequently uses the same <video> element for sequential videos and ads. We want to record telemetry if any of these were non-empty, not only consider the last one played when the tab is closed.

Differential Revision: https://phabricator.services.mozilla.com/D88098
2020-10-06 01:47:14 +00:00
alwu
25b9d83ca8 Bug 1652108 - part3 : remove relevant codes for 'autoplay_would_be_allowed_count' and 'autoplay_would_not_be_allowed_count'. r=bryce
We don't need `autoplay_would_be_allowed_count` and `autoplay_would_not_be_allowed_count`, so we can remove all related codes.

Differential Revision: https://phabricator.services.mozilla.com/D83227
2020-09-23 22:35:26 +00:00
alwu
37f127c8f3 Bug 1652108 - part2 : modify page_had_media_count to in_page_count r=nika,bryce
We would like to remove `page_had_media_count` and use a new probe `in_page_count` to record the total number of top level content documents using media.

Therefore, we would rename WindowContext's `DocTreeHadAudibleMedia` to `DocTreeHadMedia` in order to support the new usage.

In the future, if we want to know something like "the percentage of media element is being used for MSE/EME?", then this scalar can be the base and used to calculate the answser.

Differential Revision: https://phabricator.services.mozilla.com/D83225
2020-09-24 21:41:10 +00:00
alwu
8704182c9e Bug 1662164 - remove expired telemetry ping 'MEDIA_PLAYED_TIME_AFTER_AUTOPLAY_BLOCKED' and its related code. r=bryce
Differential Revision: https://phabricator.services.mozilla.com/D91222
2020-09-24 16:18:35 +00:00
Simon Giesecke
de7bab0f06 Bug 1650145 - Replace all value uses of Empty[C]String by 0-length _ns literals. r=froydnj,geckoview-reviewers,agi
Differential Revision: https://phabricator.services.mozilla.com/D82325
2020-09-23 15:17:15 +00:00
Bryce Seager van Dyk
edc49f167b Bug 1615444 - Remove media telem histograms that expired in 74 and related code. r=alwu
Removes
- MEDIACACHESTREAM_LENGTH_KB
- MEDIA_PLAY_PROMISE_RESOLUTION
- AUDIO_TRACK_SILENCE_PROPORTION

and all the code I could find that was specific to reporting these values via
telemetry.

Differential Revision: https://phabricator.services.mozilla.com/D88868
2020-09-17 14:43:26 +00:00
Bryce Seager van Dyk
dad3db465a Bug 1662212 - Add telemetry to track play time of encrypted HTMLMediaElements. r=drno
Add 3 probes
- Play time for encrypted elements.
- Play time for Clearkey elements.
- Play time for Widevine elements.

Differential Revision: https://phabricator.services.mozilla.com/D88895
2020-09-10 22:04:39 +00:00
Bryce Seager van Dyk
3645d0e0bd Bug 1662210 - Remove dead MediaKeys code from MediaElement's SuspendOrResumeElement. r=jolin
Differential Revision: https://phabricator.services.mozilla.com/D88887
2020-08-31 18:19:18 +00:00
Andreas Pehrson
222394b14b Bug 1661668 - Capture this in HTMLMediaElement::SetSinkId captures, for readability. r=padenot
Depends on D88820

Differential Revision: https://phabricator.services.mozilla.com/D88821
2020-08-31 15:34:09 +00:00
Andreas Pehrson
71be872132 Bug 1661668 - Rename CrossGraphManager to CrossGraphPort. r=padenot
"Manager" is vague, and it seems to mostly keep some members around rather than
managing them. Port is analogue to MediaInputPort in that it acts as a link
between two tracks. Neither type of port does very much heavy lifting -- they
are similarly dumb.

Differential Revision: https://phabricator.services.mozilla.com/D88812
2020-08-31 16:08:21 +00:00
Andreas Pehrson
a04205e495 Bug 1592539 - Use a MediaStreamRenderer to render video tracks into a secondary container. r=jib,mconley
This re-uses MediaStreamRenderer to render video into a secondary container, to
get identical logic for the clone target as for the clone source. The
MediaStreamRenderer can handle audio, currentTime and more as well, but those
are not used here.

Differential Revision: https://phabricator.services.mozilla.com/D87139
2020-08-26 14:25:40 +00:00
Andreas Pehrson
2a5941ee11 Bug 1592539 - Make MediaStreamRenderer always apply its FirstFrameVideoOutput. r=jib,karlt
The first-frame output used to only be applied when not rendering the
MediaStream, and the regular video output was applied when rendering.

The difference with this patch is when rendering -- both the first-frame and the
regular outputs are applied at the same time. The former allows one frame to go
through to the VideoFrameContainer, then the regular output takes over and lets
any frames through. Nothing in how frames are rendered should be noticable by
users.

This allows for simpler logic for resolving the visual clone target promise in a
future patch, as we won't have to track the first frame in different outputs
depending on the rendering state.

Differential Revision: https://phabricator.services.mozilla.com/D87138
2020-08-26 14:25:27 +00:00
Andreas Pehrson
f1fcc6692b Bug 1592539 - Inject a FirstFrameVideoOutput into MediaStreamRenderer. r=jib
This allows different users of renderers to inject different first frame
outputs. So far there is only one, but a future patch will bring a special one
for the secondary video frame container.

Differential Revision: https://phabricator.services.mozilla.com/D87137
2020-08-26 14:25:20 +00:00
Andreas Pehrson
0c8a4d0535 Bug 1592539 - Also null out mMediaStreamRenderer in Unlink. r=bryce
I have observed async calls to the MediaStreamRenderer's mWatchManager::Unwatch()
in flight after it was Shutdown(). This would cause an assertion failure in
debug. Per the comment we should do the same in Unlink as
EndSrcMediaStreamPlayback() without creating new strong refs. This conforms to
that instruction.

I am not willing to null out the other members at this point, since at least
HTMLVideoElement's relies on the selected video track to exist in some cases.

Differential Revision: https://phabricator.services.mozilla.com/D87136
2020-08-26 14:25:08 +00:00
Andreas Pehrson
13232f716c Bug 1592539 - Move the FirstFrameListener to VideoOutput.h. r=jib
This allows the FirstFrameListener to be instantiated outside of
HTMLMediaElement. A future patch brings in a subclass in HTMLVideoElement.

This also renames FirstFrameListener to FirstFrameVideoOutput since that better
denotes what it is.

Differential Revision: https://phabricator.services.mozilla.com/D87135
2020-08-26 14:25:05 +00:00
Andreas Pehrson
0bb8c3dc1d Bug 1592539 - Move the FirstFrameListener handling to MediaStreamRenderer. r=jib
This unclutters HTMLMediaElement somewhat by putting away the logic for handling
the FirstFrameListener into MediaStreamRenderer, which is better suited for the
task.

This will allow us to use a second MediaStreamRenderer to properly track video
tracks for a secondary VideoFrameContainer.

Differential Revision: https://phabricator.services.mozilla.com/D87134
2020-08-26 14:24:55 +00:00
Jan-Ivar Bruaroey
c27b3d3a89 Bug 1652884 - Rename MediaTrack::SetEnabled to SetDisabledTrackMode. r=pehrsons
Differential Revision: https://phabricator.services.mozilla.com/D86070
2020-08-19 22:18:04 +00:00
Bogdan Tara
30eb420e4a Backed out 14 changesets (bug 1652884) for test_peerConnection_trackDisabling.html failures CLOSED TREE
Backed out changeset f83951453e94 (bug 1652884)
Backed out changeset fc697986d538 (bug 1652884)
Backed out changeset 20a10128b5e1 (bug 1652884)
Backed out changeset c99c32323c76 (bug 1652884)
Backed out changeset 991e8975f03d (bug 1652884)
Backed out changeset 9e9511e32cdd (bug 1652884)
Backed out changeset 605c1ac3081a (bug 1652884)
Backed out changeset dd6edf636659 (bug 1652884)
Backed out changeset 74a2f5a9eea2 (bug 1652884)
Backed out changeset b9f419aed12d (bug 1652884)
Backed out changeset 84e82e25929f (bug 1652884)
Backed out changeset 876dbad27af5 (bug 1652884)
Backed out changeset 8f60e3af2a19 (bug 1652884)
Backed out changeset de7537bda499 (bug 1652884)
2020-08-20 01:13:29 +03:00
Jan-Ivar Bruaroey
9aec15aa0d Bug 1652884 - Rename MediaTrack::SetEnabled to SetDisabledTrackMode. r=pehrsons
Differential Revision: https://phabricator.services.mozilla.com/D86070
2020-08-19 19:30:50 +00:00
Bogdan Tara
fd6c09249f Backed out 14 changesets (bug 1652884) for VideoFrameConverter related failures CLOSED TREE
Backed out changeset 28c4e8c373f0 (bug 1652884)
Backed out changeset 658ba8f39abe (bug 1652884)
Backed out changeset 8e67fe040e4a (bug 1652884)
Backed out changeset 6f5833203763 (bug 1652884)
Backed out changeset 569ff85dfc2e (bug 1652884)
Backed out changeset eaa171643447 (bug 1652884)
Backed out changeset 6b37b60b6662 (bug 1652884)
Backed out changeset 438cce7456fb (bug 1652884)
Backed out changeset e6ed13952b67 (bug 1652884)
Backed out changeset e0b1266231bf (bug 1652884)
Backed out changeset 32f4aae2b5fe (bug 1652884)
Backed out changeset 76b4abccd61b (bug 1652884)
Backed out changeset 9010365ffa66 (bug 1652884)
Backed out changeset 763f39eb5c13 (bug 1652884)
2020-08-19 22:21:31 +03:00
Jan-Ivar Bruaroey
f5e002a857 Bug 1652884 - Rename MediaTrack::SetEnabled to SetDisabledTrackMode. r=pehrsons
Differential Revision: https://phabricator.services.mozilla.com/D86070
2020-08-19 14:03:32 +00:00
alwu
917df3ddbb Bug 1656642 - part2 : prevent to start controller for non-playable media even if it enters fullscreen/PIP mode. r=chunmin
When a media without src or with error enters fullscreen or PIP mode, we don't want to control it. Therefore, we shouldn't start the listener for it.

In addition, updating PIP/fullscreen state no matter the listener starts or not. See following example.

1. Play a media and it enter PIP/fullscreen (it would update `state=true`)
2. abort the current src (that would stop the listener)
3. leave PIP/fullscreen (in this case, we don't have src, so the listener won't start, but we still need to update the `state` to `false`)

Differential Revision: https://phabricator.services.mozilla.com/D85785
2020-08-13 19:16:18 +00:00
alwu
5643c8a32f Bug 1654657 - part1 : update fullscreen change in media element. r=chunmin
Calling `NotifyMediaFullScreenState()` is related with updating state on media controller, which is only used for media element. So it'd  be better to move that into media element.

Differential Revision: https://phabricator.services.mozilla.com/D85513
2020-08-14 01:23:28 +00:00
alwu
96afc7c19e Bug 1657224 - add a pref to control stopping media after media reaches to the end. r=chunmin
In bug1654045, we would stop controlling media once media reaches to the end. Considering some user might still want to control media by pressing media keys even if it has ended, so adding a pref to control this abilitiy.

Differential Revision: https://phabricator.services.mozilla.com/D85930
2020-08-05 23:12:16 +00:00
alwu
a3ed6de802 Bug 1654045 - part1 : stop listening to the media keys when media reaches to the end. r=chunmin
Our current implementation is to allow to resume media by using media key after media reaches the the end. However, we don't know how many users would really use media key like that, and if they don't use media key in this way.

The benefit to use that approach are (1) being able to give media key controllability back to other applications which are really playing media (2) to avoid possible compatibility issue (Chrome has been using this approach as well)

Differential Revision: https://phabricator.services.mozilla.com/D85228
2020-07-31 00:05:02 +00:00
alwu
9f4ebd9e69 Bug 1654277 - part3 : add a test for only resuming latest paused media. r=chunmin
Differential Revision: https://phabricator.services.mozilla.com/D84879
2020-07-29 23:39:09 +00:00
alwu
b495e4e49f Bug 1654277 - part2 : pause playing media but stop already paused media when receiving 'pause'. r=chunmin
We want to modify our current behavior from "resuming all media" to "resuming latest paused media" when pressing `play` media key.

The reason of doing that is because that give us better user experience, espeically on Facebook. Chrome has been taking this approach, so we want to follow this strategy. The test in D84879 can help to understand this scenario.

Differential Revision: https://phabricator.services.mozilla.com/D85118
2020-07-30 04:01:08 +00:00
alwu
565588e2f8 Bug 1655204 - part3 : start listening to media control keys once media starts again. r=chunmin
For media which has been stopped via media key `Stop`, we should start controlling it if it starts playing again.

Differential Revision: https://phabricator.services.mozilla.com/D85102
2020-07-29 22:15:54 +00:00
alwu
1ba14f3e89 Bug 1655204 - part1 : stop being controlled by media control keys when media element receives Stop. r=chunmin
Currently, we treat `pause` and `stop` equally, but `stop` is actully implying more meaning, which should stop controlling media entirely. Therefore, we would pause media and stop controlling it when receiving `stop`.

In addition, removing pause state checking, because it wouldn't happen anything to call `play()` and `pause()` if media is already playing or paused.

Differential Revision: https://phabricator.services.mozilla.com/D84875
2020-07-29 22:15:50 +00:00
emcminn
e256431464 Bug 1655765 - Add media permission for about:welcome privacy page mp4 r=ckerschb
Differential Revision: https://phabricator.services.mozilla.com/D85192
2020-07-29 08:27:34 +00:00