Commit Graph

215 Commits

Author SHA1 Message Date
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
Carsten "Tomcat" Book
541deb95af Backed out changeset e30080454885 (bug 1222980) 2016-12-15 17:13:46 +01: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
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
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
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
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
Alastor Wu
6f4b863655 Bug 1309162 - part2 : remove audio channel code from media element. r=jwwang
Remove the audio channel related codes.

MozReview-Commit-ID: Fc09gDDF21a
2016-11-29 12:40:35 +08:00
Alastor Wu
98177d02da Bug 1309162 - part1 : create a separate class to handle audio channel releated stuffs. r=baku,jwwang
In order to keep the media element's code clear (spec code only), we want to remove our
custom policy code out from media element. This new class will handle all audio channel
related stuffs, eg. mute/unmuted operation from tab audio indicator, play/resume from
Fennec's media control.

MozReview-Commit-ID: 5mDqDBTnBOr
2016-11-29 12:40:32 +08:00
Wes Kocher
e9ed4f958a Backed out 7 changesets (bug 1309162) for valgrind failures a=backout
Backed out changeset 3f0ad2d2c594 (bug 1309162)
Backed out changeset 17c744162fbe (bug 1309162)
Backed out changeset 2015de6577af (bug 1309162)
Backed out changeset fe1771c91309 (bug 1309162)
Backed out changeset b5ab5eae225d (bug 1309162)
Backed out changeset 16ceabbf8eef (bug 1309162)
Backed out changeset 6b09c6adcfa5 (bug 1309162)
2016-11-28 13:16:31 -08:00
Alastor Wu
b1b53dfa7c Bug 1309162 - part7 : wrap custom policy function. r=jwwang
MozReview-Commit-ID: EdjzMi90ukx
2016-11-28 10:23:14 +08:00
Alastor Wu
f627f175a1 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-26 02:34:49 +08:00
Alastor Wu
325a48daae Bug 1309162 - part2 : remove audio channel code from media element. r=jwwang
Remove the audio channel related codes.

MozReview-Commit-ID: Fc09gDDF21a
2016-11-26 02:34:42 +08:00
Alastor Wu
a15ae0e683 Bug 1309162 - part1 : create a separate class to handle audio channel releated stuffs. r=baku,jwwang
In order to keep the media element's code clear (spec code only), we want to remove our
custom policy code out from media element. This new class will handle all audio channel
related stuffs, eg. mute/unmuted operation from tab audio indicator, play/resume from
Fennec's media control.

MozReview-Commit-ID: 5mDqDBTnBOr
2016-11-26 02:34:39 +08:00
Alastor Wu
273d74cd0e Bug 1301055 - part4 : special error dispatching stragedy for Fennec. r=jwwang
On Fennec, we would use external app (Android view) to play the media whih is
unsupported by gecko. We implement some special logic in error sink.

(1) dispatch "OpenMediaWithExternalApp" event
we use this event to start the android video player

(2) doesn't dispatch "error" event
some JS players won't let user to trigger play() again after receving the "error".
So we don't dispatch that event if we want to play the unsupported media more than once.

MozReview-Commit-ID: 7fZK5hdvaOG
2016-11-24 10:24:08 +08:00
Alastor Wu
726bbd643a Bug 1301055 - part2 : create a error sink to handle media element's error related event. r=bkelly,jwwang
Error sink would be response for the error handling, we could write different
error dispatching stragedies for different situation. eg. if we can play
unsupported type media with external app, we won't dispatch the "error" event on fennec.

MozReview-Commit-ID: Lm4x9ksspAY
2016-11-24 10:24:04 +08:00
Alastor Wu
7d72019557 Bug 1317167 - only need to do the untrust JS checking in play(). r=jwwang
The first checking condition in the IsAllowedPlay() is used to prevent the play() operation
is called by untrusted JS when media.autoplay.enabled=false. Therefore, we don't need to check
that in CanActivateAutoplay().

MozReview-Commit-ID: 6yqoG8ISyra
2016-11-17 15:09:59 +08:00
Alastor Wu
8beec95340 Bug 1315551 - part2 : check we have initialized agent when we want to call the agent's function. r=jwwang
Because the agent's initialization might fail if we don't get the valid inner window, we need to
check whether the agent exists before calling the agent's method.

MozReview-Commit-ID: IUuvyGh7CMd
2016-11-08 11:08:02 +08:00
Alastor Wu
3cf8874ec0 Bug 1302350 - part6 : ensure loading process doens't be interrupted even media element can't be played. r=jwwang
We don't want to stop the loading process even we canceled the play operation.

MozReview-Commit-ID: FyPqBlDKYo0
2016-11-02 14:22:35 +08:00
Alastor Wu
01a17b2a49 Bug 1302350 - part4 : refactor the media-blocking mechanism. r=jwwang
The old way is to start playing first, and then block the media element. This
way is too complicated because it involves lots of interal state and isn't intuitive.

The new way is to ignore the play if the media element should be blocked. It's
easy to know and we doesn't need to keep any internal states because we don't play
the media element.

MozReview-Commit-ID: B20e0pvXES4
2016-11-02 14:22:24 +08:00
Alastor Wu
5d226762d6 Bug 1302350 - part1 : create audio channel agent in the beginning. r=baku
We create audio channel agent in the beginning in oreder to use some agent's methods.
But the agent is still started after media element starting playing.

MozReview-Commit-ID: KPGb7snB2t7
2016-11-01 17:46:07 +08:00
Andreas Pehrson
b028a0b40f Bug 1301675 - Implement StreamCaptureTrackSource::Stop. r=jib
MozReview-Commit-ID: 2qwNba6bA80
2016-09-23 16:53:10 +02:00
Alastor Wu
47b76aa673 Bug 1302453 - part1 : send new gecko event when media is resumed. r=baku
We uses "media-playback" event to notify fennec media control about media start
and end. However, if we resume media which was paused by media control, it won't
send any notification to JAVA side so that the MediaControlService can't change
the correct playing icon.

Therefore, we create new event to inform this situation.

MozReview-Commit-ID: zScaHxvHXM
2016-10-27 09:59:55 +08:00
Chris Pearce
e3a94f36b3 Bug 1310548 - Delay firing of 'waitingforkey' until all decoded data has been rendered. r=jya
This means 'waitingforkey' will be fired at a predictable time.

MozReview-Commit-ID: HMt1RbgrbuR
2016-10-17 14:16:54 +13:00
Alastor Wu
68bd777317 Bug 1308119 - replace nsIAudioChannelAgent with AudioChannelAgent. r=baku
Since I want to use more agent's functions in MediaElement and I don't think these functions need to be exposed on IDL level. (for other languages binding)

Therefore, I want to use AudioChannelAgent directly in MediaElement.

MozReview-Commit-ID: 43FvDeLpZPt
2016-10-07 10:35:01 +08:00
JW Wang
19ae50ff0f Bug 1239899. Part 1 - Remove ElementInTreeState for ELEMENT_NOT_INTREE and ELEMENT_INTREE are not used at all. We can use a bool flag to do the job. r=cpearce
MozReview-Commit-ID: 4htNy1dZODF
2016-09-23 14:51:52 +08:00
James Cheng
42e8029df1 Bug 1300654 Part1-Remove MOZ_EME from code base. r=cpearce,smaug
MozReview-Commit-ID: JboGO0w4tcE
2016-09-08 18:06:20 +08:00
Chris Pearce
af78e9f93a Bug 1304604 - Use EventTarget to simplyfy HTMLMediaElement.onencrypted implementation. r=smaug
MozReview-Commit-ID: EUpZX4ODgNj
2016-09-22 16:25:38 +12:00
Chris Pearce
4f67ef3293 Bug 1304247 - Implement HTMLMediaElement.onwaitingforkeys. r=smaug
MozReview-Commit-ID: DhNV30BfksS
2016-09-21 14:10:26 +12:00
Jean-Yves Avenard
1933de1197 Bug 1302632: P3. Provide failures details to error attribute. r=jwwang
MozReview-Commit-ID: 3eIXOF96UR4
2016-09-15 16:17:10 +10:00
Phil Ringnalda
f2abe31659 Backed out 5 changesets (bug 1302632) for forthcoming failures
Backed out changeset f2ced742d6aa (bug 1302632)
Backed out changeset 55e7962d4fc0 (bug 1302632)
Backed out changeset b20f7c887e6c (bug 1302632)
Backed out changeset 22772e4a9c72 (bug 1302632)
Backed out changeset 7d7558864a66 (bug 1302632)
2016-09-15 21:39:00 -07:00
Jean-Yves Avenard
5faeec0612 Bug 1302632: P1. Set proper error code when readyState is HAVE_NOTHING. r=jwwang
MozReview-Commit-ID: CMQkW5pPDF2
2016-09-14 16:45:52 +10:00
Carsten "Tomcat" Book
8c3409a304 Merge mozilla-central to mozilla-inbound 2016-09-14 12:11:09 +02:00
Jean-Yves Avenard
a945c437e1 Bug 1299072: P10. Pass decoding error details to media element's error attribute. r=jwwang
MozReview-Commit-ID: 49DurV9WI5S
2016-09-11 00:56:09 +10:00
kaku@mozilla.com
3e4dcf7643 Bug 1299718 part 2 - implement the MarkAsContentSource() API; r=gerald,kamidphish
MozReview-Commit-ID: 1eAdcMAmXSB
2016-09-14 15:50:29 +10:00
Andreas Pehrson
f20ab4d087 Bug 1300529 - Remove default arguments from HTMLMediaElement::CaptureStreamInternal. r=padenot
MozReview-Commit-ID: IL7odCBP74
2016-09-07 15:14:15 +02:00
Jeremy Chen
c22b72adf2 Bug 1297306 - part5:create enum constructors for EnumTable. r=baku
Enable nsAttrValue::EnumTable to be initialized with enum. So, we could get rid
of the castings in EnumTable. Fix EnumTable initialization comment.

For those untyped enumerations, declare them with uint8_t, as to other typed
enumerations with type size larger than int16_t, force casting to int16_t.

Use {nullptr,0} instead of {0} to represent the last entry.

MozReview-Commit-ID: 7Dma3Apkmxj
2016-09-07 10:20:17 +08:00
Gerald Squelart
04eb9daee8 Bug 1300459 - Pass MediaInfo by const-ref to SetMediaInfo - r=jya
MozReview-Commit-ID: 5KvCBHmI1JC
2016-09-05 14:23:23 +10:00
Alastor Wu
2a26bc5f28 Bug 1262053 - part8 : remove function NotifyOwnerDocumentActivityChangedInternal. r=cpearce
MozReview-Commit-ID: DnWgQHGJLU5
2016-08-29 18:56:38 +08:00
Alastor Wu
0aa6d63f4f Bug 1262053 - part6 : don't need to capture media element without audio. r=baku,cpearce
MozReview-Commit-ID: GO6nXbzYwIy
2016-08-29 18:56:32 +08:00
Alastor Wu
8bbb47f0e2 Bug 1262053 - part3 : modify media element for blocking autoplay media. r=cpearce
MozReview-Commit-ID: 8e13lkYTN46
2016-08-29 16:34:26 +08:00
Chris Pearce
6abb31e01c Bug 1262053 - part2 : remove old media.block-play-until-visible behaviour. r=cpearce
MozReview-Commit-ID: GujLSVfu2rp
2016-08-29 10:42:10 +08:00
Jean-Yves Avenard
90c89d6302 Bug 1298594: P2. Fire waiting event when readyState move back to HAVE_CURRENT_DATA. r=jwwang
MozReview-Commit-ID: BpwYY6njXGC
2016-08-27 22:23:52 +10:00
Andreas Pehrson
71794987a5 Bug 1259788 - Ensure ready state is updated when first track added after NotifyTracksAvailable(). r=jesup
MozReview-Commit-ID: 1FwPfety82M
2016-08-19 13:41:48 +02:00
Andreas Pehrson
0ea44a1cbd Bug 1259788 - Support MediaStream sources for HTMLMediaElement.mozCaptureStream(). r=jesup
This adds support for HTMLMediaElement.mozCaptureStream() and
mozCaptureStreamUntilEnded() for a HTMLMediaElement playing a MediaStream.

This is up to spec, while capturing a HTMLMediaElement playing a file is not.
This incompatibility means we cannot mix sources for the returned MediaStream.

As such, a MediaStream returned while the HTMLMediaElement was playing a file
will only have content while the element is playing files. If the src changes
to a MediaStream, the stream will be empty.

It works the same way if a MediaStream was captured while the HTMLMediaElement
was playing another MediaStream.

This is due to TrackID management - MediaDecoder doesn't care, and creates new
tracks when you seek, so users are unable to keep track, while for MediaStream
we control everything from main thread and keep track of the TrackIDs used
previously.

This also adds a separate path from MediaElementAudioSourceNode so that we don't
forward video tracks when the returned MediaStream is only used internally for
WebAudio. We should in that case not require a DOMMediaStream but just forwarding
tracks to a TrackUnionStream should be enough, and will save us some cpu cycles.
This is however fine for now as it's simpler.

MozReview-Commit-ID: Bg8hESDISDU
2016-08-23 17:51:50 +02:00
Andreas Pehrson
e335a8c2f6 Bug 1259788 - Rename CaptureStreamTrackSource to DecoderCaptureTrackSource. r=jesup
This prepares HTMLMediaElement for having a separate MediaStreamTrackSource for
MediaStreams, StreamCaptureTrackSource.

MozReview-Commit-ID: FVrYxFgvXgA
2016-07-06 12:15:27 +02:00