зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1350973 - Implement new attributes MediaStreamAudioSourceNode.mediaStream and MediaElementAudioSourceNode.mediaElement. r=baku
Differential Revision: https://phabricator.services.mozilla.com/D37283 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
358d1707a7
Коммит
03e7bf883c
|
@ -13,9 +13,12 @@
|
|||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
MediaElementAudioSourceNode::MediaElementAudioSourceNode(AudioContext* aContext)
|
||||
: MediaStreamAudioSourceNode(aContext, TrackChangeBehavior::FollowChanges) {
|
||||
}
|
||||
MediaElementAudioSourceNode::MediaElementAudioSourceNode(
|
||||
AudioContext* aContext, HTMLMediaElement* aElement)
|
||||
: MediaStreamAudioSourceNode(aContext, TrackChangeBehavior::FollowChanges),
|
||||
mElement(aElement) {
|
||||
MOZ_ASSERT(aElement);
|
||||
}
|
||||
|
||||
/* static */
|
||||
already_AddRefed<MediaElementAudioSourceNode>
|
||||
|
@ -28,7 +31,7 @@ MediaElementAudioSourceNode::Create(
|
|||
}
|
||||
|
||||
RefPtr<MediaElementAudioSourceNode> node =
|
||||
new MediaElementAudioSourceNode(&aAudioContext);
|
||||
new MediaElementAudioSourceNode(&aAudioContext, aOptions.mMediaElement);
|
||||
|
||||
RefPtr<DOMMediaStream> stream = aOptions.mMediaElement->CaptureAudio(
|
||||
aRv, aAudioContext.Destination()->Stream()->Graph());
|
||||
|
@ -71,5 +74,9 @@ void MediaElementAudioSourceNode::Destroy() {
|
|||
MediaStreamAudioSourceNode::Destroy();
|
||||
}
|
||||
|
||||
HTMLMediaElement* MediaElementAudioSourceNode::MediaElement() {
|
||||
return mElement;
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -42,8 +42,11 @@ class MediaElementAudioSourceNode final : public MediaStreamAudioSourceNode {
|
|||
return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
|
||||
}
|
||||
|
||||
HTMLMediaElement* MediaElement();
|
||||
|
||||
private:
|
||||
explicit MediaElementAudioSourceNode(AudioContext* aContext);
|
||||
explicit MediaElementAudioSourceNode(AudioContext* aContext,
|
||||
HTMLMediaElement* aElement);
|
||||
|
||||
void Destroy() override;
|
||||
|
||||
|
@ -52,6 +55,8 @@ class MediaElementAudioSourceNode final : public MediaStreamAudioSourceNode {
|
|||
void ListenForAllowedToPlay(const MediaElementAudioSourceOptions& aOptions);
|
||||
|
||||
MozPromiseRequestHolder<GenericNonExclusivePromise> mAllowedToPlayRequest;
|
||||
|
||||
RefPtr<HTMLMediaElement> mElement;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
|
|
@ -65,6 +65,8 @@ class MediaStreamAudioSourceNode
|
|||
|
||||
uint16_t NumberOfInputs() const override { return 0; }
|
||||
|
||||
DOMMediaStream* GetMediaStream() { return mInputStream; }
|
||||
|
||||
const char* NodeType() const override { return "MediaStreamAudioSourceNode"; }
|
||||
|
||||
virtual const char* CrossOriginErrorString() const {
|
||||
|
|
|
@ -17,7 +17,7 @@ dictionary MediaElementAudioSourceOptions {
|
|||
[Pref="dom.webaudio.enabled",
|
||||
Constructor(AudioContext context, MediaElementAudioSourceOptions options)]
|
||||
interface MediaElementAudioSourceNode : AudioNode {
|
||||
|
||||
readonly attribute HTMLMediaElement mediaElement;
|
||||
};
|
||||
|
||||
// Mozilla extensions
|
||||
|
|
|
@ -17,7 +17,8 @@ dictionary MediaStreamAudioSourceOptions {
|
|||
[Pref="dom.webaudio.enabled",
|
||||
Constructor(AudioContext context, MediaStreamAudioSourceOptions options)]
|
||||
interface MediaStreamAudioSourceNode : AudioNode {
|
||||
|
||||
[BinaryName="GetMediaStream"]
|
||||
readonly attribute MediaStream mediaStream;
|
||||
};
|
||||
|
||||
// Mozilla extensions
|
||||
|
|
|
@ -14,9 +14,6 @@
|
|||
[AudioListener interface: attribute forwardX]
|
||||
expected: FAIL
|
||||
|
||||
[MediaStreamAudioSourceNode interface: attribute mediaStream]
|
||||
expected: FAIL
|
||||
|
||||
[AudioParam interface: calling cancelAndHoldAtTime(double) on new AudioBufferSourceNode(context).playbackRate with too few arguments must throw TypeError]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -41,9 +38,6 @@
|
|||
[AudioListener interface: context.listener must inherit property "positionY" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[MediaElementAudioSourceNode interface: new MediaElementAudioSourceNode(context, {mediaElement: new Audio}) must inherit property "mediaElement" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[AudioContext interface: operation getOutputTimestamp()]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -77,9 +71,6 @@
|
|||
[AudioContext interface: context must inherit property "baseLatency" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[MediaElementAudioSourceNode interface: attribute mediaElement]
|
||||
expected: FAIL
|
||||
|
||||
[AudioListener interface: context.listener must inherit property "positionX" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче