Add MediaPlayer::audioSourceProvider() method for audio stream access by the Web...
authorcrogers@google.com <crogers@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 26 Aug 2011 19:29:32 +0000 (19:29 +0000)
committercrogers@google.com <crogers@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 26 Aug 2011 19:29:32 +0000 (19:29 +0000)
commitd9c8b2ef95cfdf27619e2d81046add420e8832ff
treea4ec3848a79580e51f829de5c9b9a4caee91d2d9
parent9676338e1383e43d8ee4a33d628defaf45a697ed
Add MediaPlayer::audioSourceProvider() method for audio stream access by the Web Audio API.
https://bugs.webkit.org/show_bug.cgi?id=66398

Reviewed by Eric Carlson.

Source/WebCore:

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::HTMLMediaElement):
(WebCore::HTMLMediaElement::prepareForLoad):
(WebCore::HTMLMediaElement::loadNextSourceChild):
(WebCore::HTMLMediaElement::ensureMediaPlayer):
(WebCore::HTMLMediaElement::createMediaPlayer):
    MediaPlayer creation has now been put into createMediaPlayer() instead of it being created
    separately in these various methods.  It has been made thread-safe for use with the Web Audio API
    in conjunction with an MediaElementAudioSourceNode.
(WebCore::HTMLMediaElement::setAudioSourceNode):
(WebCore::HTMLMediaElement::audioSourceProvider):
* html/HTMLMediaElement.h:
(WebCore::HTMLMediaElement::audioSourceNode):
    The HTMLMediaElement now keeps track of an optional MediaElementAudioSourceNode if
    the audio stream is being processed using the Web Audio API.

* platform/graphics/MediaPlayer.cpp:
(WebCore::MediaPlayer::audioSourceProvider):
* platform/graphics/MediaPlayer.h:
* platform/graphics/MediaPlayerPrivate.h:
(WebCore::MediaPlayerPrivateInterface::audioSourceProvider):
    MediaPlayer now has an audioSourceProvider() method with a default "empty" implementation.
    audioSourceProvider() returns an AudioSourceProvider object which the Web Audio API's
    MediaElementAudioSourceNode uses (indirectly through an HTMLMediaElement method) to get the rendered audio stream.

* webaudio/AudioContext.cpp:
(WebCore::AudioContext::createMediaElementSource):
* webaudio/AudioContext.h:
* webaudio/AudioContext.idl:
    AudioContext::createMediaElementSource() is now more careful to check that an HTMLMediaElement
    doesn't already have a MediaElementAudioSourceNode attached to it.

* webaudio/MediaElementAudioSourceNode.cpp:
(WebCore::MediaElementAudioSourceNode::MediaElementAudioSourceNode):
(WebCore::MediaElementAudioSourceNode::~MediaElementAudioSourceNode):
(WebCore::MediaElementAudioSourceNode::process):
(WebCore::MediaElementAudioSourceNode::lock):
(WebCore::MediaElementAudioSourceNode::unlock):
* webaudio/MediaElementAudioSourceNode.h:
    Implement thread-safe processing (replacing the old stub implementation).

LayoutTests:

* webaudio/mediaelementaudiosourcenode-expected.txt:
* webaudio/mediaelementaudiosourcenode.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@93903 268f45cc-cd09-0410-ab3c-d52691b4dbfc
14 files changed:
LayoutTests/ChangeLog
LayoutTests/webaudio/mediaelementaudiosourcenode-expected.txt
LayoutTests/webaudio/mediaelementaudiosourcenode.html
Source/WebCore/ChangeLog
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/html/HTMLMediaElement.h
Source/WebCore/platform/graphics/MediaPlayer.cpp
Source/WebCore/platform/graphics/MediaPlayer.h
Source/WebCore/platform/graphics/MediaPlayerPrivate.h
Source/WebCore/webaudio/AudioContext.cpp
Source/WebCore/webaudio/AudioContext.h
Source/WebCore/webaudio/AudioContext.idl
Source/WebCore/webaudio/MediaElementAudioSourceNode.cpp
Source/WebCore/webaudio/MediaElementAudioSourceNode.h