Commit graph

1384 commits

Author SHA1 Message Date
Simon Giesecke
b9621d6376 Bug 1695162 - Use range-based for instead of custom hashtable iterators. r=xpcom-reviewers,kmag
Differential Revision: https://phabricator.services.mozilla.com/D108585
2021-03-17 15:49:46 +00:00
Simon Giesecke
cb6c8aead4 Bug 1695162 - Make nsTHashtable::ConstIter return a real ConstIterator. r=xpcom-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D107038
2021-03-09 10:28:16 +00:00
Sylvestre Ledru
4edd85cc9b Bug 1519636 - Reformat recent changes to the Google coding style r=necko-reviewers,valentin
Updated with clang-format version 11.0.1 (taskcluster-B6bdwSKDRF-luRQWXBuzpA)

# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D106920
2021-03-02 16:14:46 +00:00
Simon Giesecke
2586ff14b9 Bug 1693541 - Improve uses of nsBaseHashtable and descendants and avoid multiple subsequent lookups in dom/html. r=mattwoodrow
Differential Revision: https://phabricator.services.mozilla.com/D106112
2021-03-01 09:59:29 +00:00
Simon Giesecke
9af107a839 Bug 1691913 - Rename nsBaseHashtable::Put to InsertOrUpdate. r=xpcom-reviewers,necko-reviewers,jgilbert,dragana,nika
This makes the naming more consistent with other functions called
Insert and/or Update. Also, it removes the ambiguity whether
Put expects that an entry already exists or not, in particular because
it differed from nsTHashtable::PutEntry in that regard.

Differential Revision: https://phabricator.services.mozilla.com/D105473
2021-02-26 09:11:46 +00:00
alwu
02a5936205 Bug 1691578 - part7 : add test case for audio sink failed start-up. r=bryce,emilio
Differential Revision: https://phabricator.services.mozilla.com/D104571
2021-02-25 18:07:07 +00:00
alwu
23f1c32275 Bug 1691578 - part6 : add test cases to test reporting decode error. r=bryce,webidl,emilio
Differential Revision: https://phabricator.services.mozilla.com/D104570
2021-02-25 18:07:06 +00:00
alwu
ee8e5fb47f Bug 1691578 - part5 : add test cases to test the ability of reporting error for not supported media type. r=bryce,emilio
Add test cases for `DecoderDoctorDiagnostics::StoreFormatDiagnostics()`, which is used when checking the ability of whether the decoder is supported for certain type.

Differential Revision: https://phabricator.services.mozilla.com/D104475
2021-02-25 18:07:06 +00:00
Cosmin Sabou
424d49d43e Backed out 8 changesets (bug 1691578) for bc failures on browser_decoderDoctor.js. CLOSED TREE
Backed out changeset c535dd429ada (bug 1691578)
Backed out changeset 518eadda7826 (bug 1691578)
Backed out changeset c181e29b13f2 (bug 1691578)
Backed out changeset 23f6dcc3ceb5 (bug 1691578)
Backed out changeset bfd3e4878545 (bug 1691578)
Backed out changeset 214ab3a2f00b (bug 1691578)
Backed out changeset 71a17ff3322c (bug 1691578)
Backed out changeset 6aa662e8d06e (bug 1691578)
2021-02-25 21:08:07 +02:00
alwu
3b9b787bdf Bug 1691578 - part7 : add test case for audio sink failed start-up. r=bryce,emilio
Differential Revision: https://phabricator.services.mozilla.com/D104571
2021-02-25 18:07:07 +00:00
alwu
5c51ce0bba Bug 1691578 - part6 : add test cases to test reporting decode error. r=bryce,webidl,emilio
Differential Revision: https://phabricator.services.mozilla.com/D104570
2021-02-25 18:07:06 +00:00
alwu
edf054e11a Bug 1691578 - part5 : add test cases to test the ability of reporting error for not supported media type. r=bryce,emilio
Add test cases for `DecoderDoctorDiagnostics::StoreFormatDiagnostics()`, which is used when checking the ability of whether the decoder is supported for certain type.

Differential Revision: https://phabricator.services.mozilla.com/D104475
2021-02-25 18:07:06 +00:00
Paul Adenot
5852688096 Bug 1686914 - Don't reset currentSrc when aborting a load in HTMLMediaElement, and reset it when it should be reset. r=bryce
Roughly:
- Don't reset on load
- Don't reset on URL parsing error
- Reset when playing a MediaStream, a MediaSource
- Otherwise follow the resource selection algorithm, and set it to what has been selected

Differential Revision: https://phabricator.services.mozilla.com/D101937
2021-02-16 12:39:34 +00:00
alwu
b248bcd4ac Bug 1686696 - part5 : remove nsSyncSection. r=bryce
`nsSyncSection` is not related with media event, so that's not proper ot put it in `MediaElementEventRunners.h`.

In addition, that can simply be implemented by `NS_NewRunnableFunction` so we don't need `nsSyncSection` anymore.

Differential Revision: https://phabricator.services.mozilla.com/D104115
2021-02-11 20:19:25 +00:00
alwu
30709122e3 Bug 1686696 - part3 : enforce to only dispatch periodic timeupdate once within 250ms. r=bryce
Inplemented an event runner for `timeupdate` only, which would ensure that for periodic `timeupdate` it should be only dispatched once within 250ms.

Differential Revision: https://phabricator.services.mozilla.com/D102675
2021-02-11 20:19:24 +00:00
alwu
777cb1ae03 Bug 1686696 - part2 : rework how does decoder handle owner's events when the logical position changes. r=bryce
Decoder needs to handle owner's events differently based on different situations, this patch makes the process clearer.

Differential Revision: https://phabricator.services.mozilla.com/D102674
2021-02-11 20:19:24 +00:00
alwu
976a59a484 Bug 1686696 - part1 : store pending event runner instead of saving event name. r=bryce,mccr8
In this patch, we move all event runners to a separate file and implement an event blocker.

In order to allow us to do a special check for `timeupdate` event, we have to know that event is periodic or mandatory.

We have to save extra information for `timeupdate, however, current design for storing pending events is not flexible enough to achieve that.

Therefore, instead of storing the event name, we store the event runners which can all have different implementation and know when they should dispatch their own event.

Differential Revision: https://phabricator.services.mozilla.com/D102673
2021-02-11 20:19:23 +00:00
Bogdan Tara
36a86026a3 Backed out 6 changesets (bug 1686696) for 1587248.html crashtest failures CLOSED TREE
Backed out changeset 690c6a094f8a (bug 1686696)
Backed out changeset 7f9d487945c3 (bug 1686696)
Backed out changeset 40358a758624 (bug 1686696)
Backed out changeset 36c696166033 (bug 1686696)
Backed out changeset ab149e8fc0d5 (bug 1686696)
Backed out changeset 8fce79f9bd65 (bug 1686696)
2021-02-11 06:29:47 +02:00
alwu
40fdde1bab Bug 1686696 - part5 : remove nsSyncSection. r=bryce
`nsSyncSection` is not related with media event, so that's not proper ot put it in `MediaElementEventRunners.h`.

In addition, that can simply be implemented by `NS_NewRunnableFunction` so we don't need `nsSyncSection` anymore.

Differential Revision: https://phabricator.services.mozilla.com/D104115
2021-02-11 03:45:30 +00:00
alwu
cc585407a3 Bug 1686696 - part3 : enforce to only dispatch periodic timeupdate once within 250ms. r=bryce
Inplemented an event runner for `timeupdate` only, which would ensure that for periodic `timeupdate` it should be only dispatched once within 250ms.

Differential Revision: https://phabricator.services.mozilla.com/D102675
2021-02-11 03:45:30 +00:00
alwu
0a8bd1bae4 Bug 1686696 - part2 : rework how does decoder handle owner's events when the logical position changes. r=bryce
Decoder needs to handle owner's events differently based on different situations, this patch makes the process clearer.

Differential Revision: https://phabricator.services.mozilla.com/D102674
2021-02-11 03:45:29 +00:00
alwu
e3e82a282d Bug 1686696 - part1 : store pending event runner instead of saving event name. r=bryce,mccr8
In this patch, we move all event runners to a separate file and implement an event blocker.

In order to allow us to do a special check for `timeupdate` event, we have to know that event is periodic or mandatory.

We have to save extra information for `timeupdate, however, current design for storing pending events is not flexible enough to achieve that.

Therefore, instead of storing the event name, we store the event runners which can all have different implementation and know when they should dispatch their own event.

Differential Revision: https://phabricator.services.mozilla.com/D102673
2021-02-11 03:45:28 +00:00
alwu
8efed25b78 Bug 1690416 - remove HTMLMediaElement::ReportCanPlayTelemetry(). r=bryce,Gijs,webidl,mccr8
The actual telemetry probes has been removed by this, so this function is no longer reporting any result and we can remove it.

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

Differential Revision: https://phabricator.services.mozilla.com/D103846
2021-02-09 18:27:33 +00:00
Andreas Pehrson
286c8199bf Bug 1690976 - Don't reveal error details for CORS-cross-origin decoding errors. r=sstreich,bryce
Differential Revision: https://phabricator.services.mozilla.com/D104169
2021-02-08 11:43:36 +00:00
Bogdan Tara
647a1a6efc Backed out 2 changesets (bug 1690976) for ES lint failure in test_decode_error_crossorigin.html CLOSED TREE
Backed out changeset ed0ab9078607 (bug 1690976)
Backed out changeset c6c868eaf915 (bug 1690976)
2021-02-08 13:34:59 +02:00
Andreas Pehrson
79eac50473 Bug 1690976 - Don't reveal error details for CORS-cross-origin decoding errors. r=sstreich,bryce
Differential Revision: https://phabricator.services.mozilla.com/D104169
2021-02-08 10:01:07 +00:00
Bogdan Tara
8b058fa239 Backed out 2 changesets (bug 1690976) for test_decode_error_crossorigin.html failures CLOSED TREE
DONTBUILD
Backed out changeset d119750e8469 (bug 1690976)
Backed out changeset ff2dd7ee09b6 (bug 1690976)
2021-02-08 11:56:23 +02:00
Andreas Pehrson
ac65ebfe6b Bug 1690976 - Don't reveal error details for CORS-cross-origin decoding errors. r=sstreich,bryce
Differential Revision: https://phabricator.services.mozilla.com/D104169
2021-02-05 18:07:16 +00:00
alwu
6e9347b003 Bug 1687899 - part2 : wrap details of determining if we should dispatch 'timeupdate' event into a helper function. r=bryce
Differential Revision: https://phabricator.services.mozilla.com/D102248
2021-01-22 18:11:29 +00:00
alwu
3f52c8d4f2 Bug 1687899 - part1 : use enum class to replace boolean for a better understanding why we need to dispatch 'timeupdate'. r=bryce
Differential Revision: https://phabricator.services.mozilla.com/D102247
2021-01-22 18:07:14 +00:00
alwu
f924a58a6d Bug 1685399 - part13 : add test. r=padenot
As we can only snapshot a telemetry histogram in the chrome process, we have to make them measurable in the chrome process and write a chrome mochitest.

Differential Revision: https://phabricator.services.mozilla.com/D101266
2021-01-19 19:49:23 +00:00
alwu
2063aa51ae Bug 1685399 - part10 : add chrome-only attributes to allow us check accumulated time during testing. r=padenot,emilio
Differential Revision: https://phabricator.services.mozilla.com/D101264
2021-01-15 19:58:13 +00:00
alwu
abfb3825ba Bug 1685399 - part7 : implement a helper class to accumulate and report the telemetry probe. r=padenot,bryce
In this patch, we move the responsibility of accumulating time and report the telemetry to `TelemetryProbesReporter`.

There are some differences between new telemetry report and the old one.
1. more accuracy on knowing if element is visible
2. more accuracy on determining when it should start accumulating visible & invisible play time
3. being able to report the correct result when element encounts an error or changes to a new resource
4. report result whenever MediaDecoder stops working

Here is the explanation [1] describing why our previous method was not able to achieve those advantages.

[1] https://bugzilla.mozilla.org/show_bug.cgi?id=1685399#c13

Differential Revision: https://phabricator.services.mozilla.com/D101112
2021-01-19 17:34:47 +00:00
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