Commit Graph

670 Commits

Author SHA1 Message Date
Phil Ringnalda
b728b48d1d Backed out 4 changesets (bug 1322505) for frequent timeouts in browser_block_autoplay_media_pausedAfterPlay.js
Backed out changeset dad8acbe41e9 (bug 1322505)
Backed out changeset 861f01ee0e6e (bug 1322505)
Backed out changeset ddf90342d71d (bug 1322505)
Backed out changeset 049ab1a92da6 (bug 1322505)
2017-01-19 21:57:46 -08:00
Alastor Wu
96b3d80ac4 Bug 1322505 - part2 : reset suspend type for blocked media after calling media.pause(). r=baku
If the blocked media is paused before resuming it, we should not resume it again
after the tab is visible. The way to achieve that is to unregister the agent so
AudioChannelService can't resume that media because we have disconnected their
relationship.

MozReview-Commit-ID: 6Dq4K9hVsU0
2017-01-20 11:30:03 +08:00
Alastor Wu
077a2ef142 Bug 1322505 - part1 : rename audio channel wrapper's function. r=baku
Rename function and modify the comment.

MozReview-Commit-ID: F5JTmPvH7GC
2017-01-20 11:29:51 +08:00
JW Wang
75bcb52440 Bug 1332160 - use nsCString internally whenever possible. r=gerald
MozReview-Commit-ID: 1DUaJWfbL88
2017-01-18 16:51:31 +08:00
Gerald Squelart
34b7caba8a Bug 1331770 - Rename 'MediaContentType' to 'MediaContainerType' - r=jya
MozReview-Commit-ID: F0BWai8vPyo
2017-01-18 11:59:03 +11:00
Chris Pearce
9799825be6 Bug 1329543 - Remove IsPrimetimeKeySystem(string) from Gecko. r=gerald
MozReview-Commit-ID: LX1ywPZDHtj
2017-01-09 21:51:40 +08:00
Gerald Squelart
7150a6f27e Bug 1329561 - MediaContentType is always valid - r=jya
MediaContentType can only be created through MakeMediaContentType(), which
returns a Maybe<MediaContentType>.
If the return value is Nothing, parsing failed.
Otherwise the contained MediaContentType object is guaranteed to be valid;
E.g., GetMIMEType() will always return a non-empty string.

Note that this interface will change a lot in the following bugs&patches, so
please don't worry about the 'Get' in the never-failing GetMIMEType(), it will
be gone soon!

MozReview-Commit-ID: IjGKkQ6RVd4
2016-12-01 12:56:11 +11:00
Kilik Kuo
b8d985efc5 Bug 1316573 - Reset the information in EncryptionInfo to make MediaElement reusable from encrypted content to plain content. r=jya
MozReview-Commit-ID: 4OU0sb2OSzi
2017-01-12 11:33:55 +08:00
Andreas Pehrson
adf481a046 Bug 1329075 - Avoid an infinite event loop spin. r=jesup
Because we add tracks to the output streams async, it's possible to switch the
mSrcStream of a media element and *then* get a notification of an added track,
when this track originated from the old mSrcStream.
If the new mSrcStream is an output stream of the media element, this would
again add a new track async, which on the next event loop spin would show up
on mSrcStream, and the loop continues.

MozReview-Commit-ID: HmKgXLYmubh
2017-01-09 19:10:48 +01:00
Andreas Pehrson
1e53104c97 Bug 1329075 - Add asserts to StreamCaptureTrackSource for sanity. r=jesup
MozReview-Commit-ID: EeSKM4JHWGv
2017-01-09 17:02:13 +01:00
Andreas Pehrson
ff7d5fdf42 Bug 1329075 - Fix potential null deref issues in media element track sources. r=jesup
MozReview-Commit-ID: ExUh2magc2z
2017-01-09 17:00:43 +01:00
Andreas Pehrson
515070fdd2 Bug 1329075 - Fix assertion failure in debug build. r=jesup
With the attached test case I was failing an assert in a debug build because
NotifyMediaTrackEnabled exited early due to `mReadyState == HAVE_NOTHING` but
NotifyMediaTrackDisabled didn't. The latter would fail an assert.

MozReview-Commit-ID: 7Frpj62s0Bc
2017-01-09 16:36:00 +01:00
Gerald Squelart
8a97960a90 Bug 1320785 - Remove obsolete 'ns' from 'StorensRefPtrPassByPtr' - r=froydnj
MozReview-Commit-ID: FuhlsLVFdLi
2017-01-09 07:55:19 +11:00
Kaku Kuo
64a0262a5e Bug 1299096 - Remove the event-based play() method out from nsIDOMHTMLMediaElement.idl; r=bz
MozReview-Commit-ID: 3pHsSsADPLu
2016-12-13 16:04:45 +08:00
Cameron McCormack
5f9911da79 Bug 1328832 - Part 2: Rename mozFlushType to mozilla::FlushType and make it an enum class. r=bzbarsky
MozReview-Commit-ID: D3fIngSHSsl
2017-01-05 15:31:56 +08:00
ctai
a0c0824b15 Bug 1325053 - Remove media attribute code and set the currentSrc attribute to urlString after type checking in HTMLMediaElement. r=jwwang
According to current WhatWG HTML spec, the checking of media attribute in SourceElement is removed. Fix the Gecko code to reflect current spec.

MozReview-Commit-ID: 43d9zL9Fvih
2016-12-21 20:42:48 +08:00
ctai
4d9f98e185 Bug 1323369 - Make HTMLMediaElement::UnbindFromTree to follow WhatWG HTML spec. r=jwwang
W3C HTML5 spec isn't very actively maintained now. WhatWG HTML spec:
When a media element is removed from a Document, the user agent must run the following steps:
Below is the related statement in WhatWG HTML spec:
Await a stable state, allowing the task that removed the media element from the Document to continue. The synchronous section consists of all the remaining steps of this algorithm. (Steps in the synchronous section are marked with .)
 If the media element is in a document, abort these steps.
 Run the internal pause steps for the media element.

MozReview-Commit-ID: H4EgPqj2YxD
2016-12-13 15:34:14 +08:00
ctai
3b19d8d6b5 Bug 1222980 - Dispatch |QueueLoadFromSourceTask| to main thread. And end the synchronous section and asynchronously await a stable state when the src is not set. r=jwwang.
Dispatch |QueueLoadFromSourceTask| to main thread to make sure the task will be executed later than loadstart event. And when the src get errors, we need to end the synchronous section.

MozReview-Commit-ID: EQ0jVIMnqoZ
2016-12-13 15:45:59 +08:00
Jean-Yves Avenard
a118ef712f Bug 1319992: P5. Don't attempt to estimate readyState when ended. r=jwwang
Buffered range is now calculated asynchronously. It may not be up to date by the time the MDSM has entered ended mode.
There's no point estimating readyState in ended mode anyway: we know what it is...

MozReview-Commit-ID: ErGsAwBzeXI
2016-12-14 17:35:36 +11:00
Sebastian Hengst
b935ae31c6 Backed out changeset 48b968826893 (bug 1319992) 2016-12-19 12:38:23 +01:00
Jean-Yves Avenard
0ad1eadd95 Bug 1319992: P5. Don't attempt to estimate readyState when ended. r=jwwang
Buffered range is now calculated asynchronously. It may not be up to date by the time the MDSM has entered ended mode.
There's no point estimating readyState in ended mode anyway: we know what it is...

MozReview-Commit-ID: ErGsAwBzeXI
2016-12-14 17:35:36 +11:00
Carsten "Tomcat" Book
b672a630a5 Backed out changeset f982627067f7 (bug 1319992) 2016-12-16 12:41:05 +01:00
Jean-Yves Avenard
d8121f4fe8 Bug 1319992: P5. Don't attempt to estimate readyState when ended. r=jwwang
Buffered range is now calculated asynchronously. It may not be up to date by the time the MDSM has entered ended mode.
There's no point estimating readyState in ended mode anyway: we know what it is...

MozReview-Commit-ID: ErGsAwBzeXI
2016-12-14 17:35:36 +11:00
Carsten "Tomcat" Book
541deb95af Backed out changeset e30080454885 (bug 1222980) 2016-12-15 17:13:46 +01:00
Carsten "Tomcat" Book
24b6303c1a Backed out changeset 6bf4393db489 (bug 1323369) for causing memory leaks on a CLOSED TREE 2016-12-15 17:11:02 +01:00
ctai
7af1a78425 Bug 1323369 - Make HTMLMediaElement::UnbindFromTree to follow WhatWG HTML spec. r=jwwang
W3C HTML5 spec isn't very actively maintained now. WhatWG HTML spec:
When a media element is removed from a Document, the user agent must run the following steps:
Below is the related statement in WhatWG HTML spec:
Await a stable state, allowing the task that removed the media element from the Document to continue. The synchronous section consists of all the remaining steps of this algorithm. (Steps in the synchronous section are marked with .)
 If the media element is in a document, abort these steps.
 Run the internal pause steps for the media element.

MozReview-Commit-ID: H4EgPqj2YxD
2016-12-13 15:34:14 +08:00
ctai
d712b0faf8 Bug 1222980 - Dispatch |QueueLoadFromSourceTask| to main thread. And end the synchronous section and asynchronously await a stable state when the src is not set. r=jwwang.
Dispatch |QueueLoadFromSourceTask| to main thread to make sure the task will be executed later than loadstart event. And when the src get errors, we need to end the synchronous section.

MozReview-Commit-ID: EQ0jVIMnqoZ
2016-12-13 15:45:59 +08:00
Alastor Wu
4c3bbb8d96 Bug 1320005 - don't show the 'play tab' icon for the media element without audio track. r=baku
MozReview-Commit-ID: K42I0yWaI7N
2016-12-13 22:47:13 +08:00
Kaku Kuo
2d8279241f Bug 1244768 part 9 - modify the play() method; r=alwu,bz,jwwang
4.8.12.8
https://html.spec.whatwg.org/multipage/embedded-content.html#dom-media-play

MozReview-Commit-ID: 5r4xOIQwOEr
2016-12-01 14:54:33 +08:00
Kaku Kuo
cdac228fe3 Bug 1244768 part 8 - extract the HTMLMediaElement::CreateDOMPromise() utility; r=jwwang
MozReview-Commit-ID: 28NopfA8lgV
2016-08-08 16:53:20 +08:00
Kaku Kuo
f885bcb90d Bug 1244768 part 7 - refactor the Play() and PlayInternal() methods; r=jwwang
MozReview-Commit-ID: CP00vERdWMv
2016-08-08 14:52:00 +08:00
Kaku Kuo
41f38a84cb Bug 1244768 part 6 - modify the internal pause steps; r=jwwang
4.8.12.8
https://html.spec.whatwg.org/multipage/embedded-content.html#internal-pause-steps

MozReview-Commit-ID: Dt0VVbXLrhw
2016-08-18 20:05:13 +08:00
Kaku Kuo
cb6b4cb44b Bug 1244768 part 5 - reject pending play promises while the playback reaching the end; r=jwwang
4.8.12.8
https://html.spec.whatwg.org/multipage/embedded-content.html#dom-media-ended

MozReview-Commit-ID: H7Tw0XGzpW0
2016-08-19 11:52:04 +08:00
Kaku Kuo
ae0528cb46 Bug 1244768 part 4 - call NotifyAboutPlaying() while ready state is changed; r=jwwang
4.8.12.7
https://html.spec.whatwg.org/multipage/embedded-content.html#ready-states

MozReview-Commit-ID: 1RUIU6Rw2SF
2016-08-05 16:42:31 +08:00
Kaku Kuo
481260964e Bug 1244768 part 3 - modify the resource selection algorithm; r=jwwang
4.8.12.5
https://html.spec.whatwg.org/multipage/embedded-content.html#concept-media-load-algorithm
https://html.spec.whatwg.org/multipage/embedded-content.html#dedicated-media-source-failure-steps

MozReview-Commit-ID: DKFQC4v92Vi
2016-08-18 20:04:27 +08:00
Kaku Kuo
7ad1d899de Bug 1244768 part 2 - modify media element load algorith; r=jwwang
4.8.12.5
https://html.spec.whatwg.org/multipage/embedded-content.html#media-element-load-algorithim

The living WHATWG spec has been changed since I implemented this patch.
Will update to the latest spec later.

MozReview-Commit-ID: 7U1AC2Ua83Z
2016-08-18 20:03:48 +08:00
Kaku Kuo
77834d2806 Bug 1244768 part 1 - implement utilities which are the foundation of promise-based play operation; r=jwwang
In this patch, the following utilities are implemented:
(1) A list to keep pending promises of a HTMLMediaElement.
(2) A method to take pending promises out from the HTMLMediaElement.
(3) A global function to resolve the passed promises.
(4) A global function to reject the passed promises with an error code.
(5) A method to asynchronously resolve all pending promises of a HTMLMediaElement.
(6) A method to asynchronously reject all pending promises of a HTMLMediaElement.
(7) A method to dispatch a 'playing' event and resolve all the pending play promises.

All the above functionalities are defined at WHATWG 4.8.12.8:
https://html.spec.whatwg.org/multipage/embedded-content.html#list-of-pending-play-promises

This patch also implements two MediaEvent classes, nsResolveOrRejectPendingPlayPromisesRunner and nsNotifyAboutPlayingRunner, which help (5), (6) and (7).

This patch also implements a list of already-dispatched nsResolveOrRejectPendingPlayPromisesRunner; we keep tracing these tasks because the load algorithm resolves/rejects all already-dispatched pending play promises (in patch 2).

MozReview-Commit-ID: EUirNqDfttk
2016-12-08 14:34:39 -10:00
JW Wang
813f283d4e Bug 1322087. Part 2 - move readyState to HAVE_ENOUGH_DATA when we have no more data to fetch. r=cpearce
http://searchfox.org/mozilla-central/rev/dc8cf05768b83a6ef0b4039edd6efddd56ee4109/dom/media/MediaDecoderStateMachine.cpp#1065
Changing nextFrameStatus to UNAVAILABLE might change readyState to HAVE_CURRENT_DATA and cause 'waiting' to fire.
It doesn't make sense to fire 'waiting' at the end of playback.

http://searchfox.org/mozilla-central/rev/dc8cf05768b83a6ef0b4039edd6efddd56ee4109/dom/html/HTMLMediaElement.cpp#5423
Note the check for Ended() doesn't work as expected to prevent 'waiting' from firing at the end of playback
because of the way how TailDispatcher schedules stateChange tasks.

This patch keeps readyState in HAVE_ENOUGH_DATA when playback is near the end for wanting no more data.
readyState will change to HAVE_CURRENT_DATA when the playing state of MediaDecoder is changed to PLAY_STATE_ENDED.

MozReview-Commit-ID: 6EspaD2hhx
2016-12-07 10:41:33 -10:00
JW Wang
184a2184eb Bug 1322087. Part 1 - move |if (!mFirstFrameLoaded)| up to save some duplicate checks. r=cpearce
MozReview-Commit-ID: 77duxxtEAQP
2016-12-06 15:54:51 -10:00
Kaku Kuo
ad9fdaf9ff Bug 1321497 - correct the logic of resuming from AudioChannel; r=alwu,jwwang
MozReview-Commit-ID: JxeqdzADlrU
2016-12-01 16:30:18 +08:00
Alastor Wu
678fa0e7b5 Bug 1321410 - stop agent after cycle collection. r=jwwang
The crash reason seems the mOwner has been released, so we shouldn't call any method which would call mOwner.
The AudioChannelAgentCallback could only be called from two parts, one is from mOwner, another is from AudioChannelService (via AudioChannelAgent).
We don't want this class be called after mOwner was released, we should disconnect it from AudioChannelService.
Calling NotifyStoppedPlaying() can unregister agent from service, so service won't call agent anymore.
Therefore, no one would call AudioChannelAgentCallback after CC happened.

MozReview-Commit-ID: 7HY4KpciacB
2016-12-04 11:02:10 +08:00
Bill McCloskey
d2a1c646a4 Bug 1318506 - Label some common runnables with a DocGroup (r=ehsan)
MozReview-Commit-ID: 19gyZRfbzXP
2016-12-01 15:00:13 -08:00
Kaku Kuo
1b0552843e Bug 1321196 part 2 - rework the IsAllowedToPlay policy; r=alwu,jwwang
MozReview-Commit-ID: 8mrXoLRK42y
2016-11-30 16:01:36 +08:00
Kaku Kuo
dd95108d31 Bug 1321196 part 1 - typo correction; r=alwu
MozReview-Commit-ID: 4EodGXfjb8i
2016-11-30 14:43:41 +08:00
ctai
90bdf8580c Bug 1133483 - Dispatch |NoSupportedMediaSourceError| to main thread in |SelectResource|. r=jwwang
We need to end the synchronous section when the src attribute is empty and then run the "failed with elements step" in non-sync section.

MozReview-Commit-ID: DJ7GYqa6aI5
2016-11-18 11:04:36 +08:00
Alastor Wu
57dca5de8b Bug 1309162 - part7 : wrap custom policy function. r=jwwang
MozReview-Commit-ID: EdjzMi90ukx
2016-11-29 12:40:47 +08:00
Alastor Wu
f2045df120 Bug 1309162 - part6 : remove useless comment. r=jwwang
These comments should be removed after landing bug1302350.

MozReview-Commit-ID: 7N0cWImZDDI
2016-11-29 12:40:45 +08:00
Alastor Wu
290dc21abc Bug 1309162 - part5 : only set the audible state when stream starts playing. r=baku
If input is a media stream, we would always regard it as audible when it's playing.
We won't need to set it as non-audible.

MozReview-Commit-ID: 8mzTsAkt6lG
2016-11-29 12:40:43 +08:00
Alastor Wu
d5d037103c Bug 1309162 - part4 : remove checking for mPlayingBeforeSeek. r=baku
In previous patch, we removed UpdateAudioChannelPlayingState() from AddRemoveSelfReference(), now we
don't call UpdateAudioChannelPlayingState() during the seeking. So we don't need to afraid to stop
audio channel agent during the seeking.


MozReview-Commit-ID: GTuIRB24zlq
2016-11-29 12:40:41 +08:00
Alastor Wu
0b306ad6ba Bug 1309162 - part3 : modify the place calling UpdateAudioChannelPlayingState(). r=baku
UpdateAudioChannelPlayingState() should only be called when following attributes changed.
eg. pause/ready state/error/owner document's visibility/exteral source stream.

Therefore, we don't need to call this function in FinishDecoderSetup() and AddRemoveSelfReference().

Remove AutoNotifyAudioChannelAgent is because now we don't check HasAudio() for IsPlayingThroughTheAudioChannel().

MozReview-Commit-ID: 4VTHIAdAqX1
2016-11-29 12:40:39 +08:00