Index: Source/core/html/HTMLMediaElement.cpp |
diff --git a/Source/core/html/HTMLMediaElement.cpp b/Source/core/html/HTMLMediaElement.cpp |
index aa41d278c8f73fc305c6fb6df818e5137559f8c7..822e6bb14c97401ba4de6fd7824e99d654e12dc8 100644 |
--- a/Source/core/html/HTMLMediaElement.cpp |
+++ b/Source/core/html/HTMLMediaElement.cpp |
@@ -64,15 +64,19 @@ |
#include "core/layout/LayoutView.h" |
#include "core/layout/compositing/DeprecatedPaintLayerCompositor.h" |
#include "core/loader/FrameLoader.h" |
+#include "core/loader/FrameLoaderClient.h" |
#include "platform/ContentType.h" |
#include "platform/Logging.h" |
#include "platform/MIMETypeFromURL.h" |
#include "platform/MIMETypeRegistry.h" |
#include "platform/RuntimeEnabledFeatures.h" |
#include "platform/UserGestureIndicator.h" |
+#include "platform/audio/AudioBus.h" |
+#include "platform/audio/AudioSourceProviderClient.h" |
#include "platform/graphics/GraphicsLayer.h" |
#include "platform/weborigin/SecurityOrigin.h" |
#include "public/platform/Platform.h" |
+#include "public/platform/WebAudioSourceProvider.h" |
#include "public/platform/WebContentDecryptionModule.h" |
#include "public/platform/WebInbandTextTrack.h" |
#include "wtf/CurrentTime.h" |
@@ -334,7 +338,7 @@ HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, Document& docum |
, m_deferredLoadState(NotDeferred) |
, m_deferredLoadTimer(this, &HTMLMediaElement::deferredLoadTimerFired) |
, m_webLayer(nullptr) |
- , m_preload(MediaPlayer::Auto) |
+ , m_preload(WebMediaPlayer::PreloadAuto) |
, m_displayMode(Unknown) |
, m_cachedTime(std::numeric_limits<double>::quiet_NaN()) |
, m_fragmentEndTime(std::numeric_limits<double>::quiet_NaN()) |
@@ -495,10 +499,10 @@ void HTMLMediaElement::didMoveToNewDocument(Document& oldDocument) |
if (m_shouldDelayLoadEvent) { |
document().incrementLoadEventDelayCount(); |
// Note: Keeping the load event delay count increment on oldDocument that was added |
- // when m_shouldDelayLoadEvent was set so that destruction of m_player can not |
+ // when m_shouldDelayLoadEvent was set so that destruction of m_webMediaPlayer can not |
// cause load event dispatching in oldDocument. |
} else { |
- // Incrementing the load event delay count so that destruction of m_player can not |
+ // Incrementing the load event delay count so that destruction of m_webMediaPlayer can not |
// cause load event dispatching in oldDocument. |
oldDocument.incrementLoadEventDelayCount(); |
} |
@@ -513,7 +517,7 @@ void HTMLMediaElement::didMoveToNewDocument(Document& oldDocument) |
// document changes so that playback can be resumed properly. |
userCancelledLoad(); |
- // Decrement the load event delay count on oldDocument now that m_player has been destroyed |
+ // Decrement the load event delay count on oldDocument now that m_webMediaPlayer has been destroyed |
// and there is no risk of dispatching a load event from within the destructor. |
oldDocument.decrementLoadEventDelayCount(); |
@@ -547,19 +551,17 @@ void HTMLMediaElement::parseAttribute(const QualifiedName& name, const AtomicStr |
configureMediaControls(); |
} else if (name == preloadAttr) { |
if (equalIgnoringCase(value, "none")) { |
- m_preload = MediaPlayer::None; |
+ m_preload = WebMediaPlayer::PreloadNone; |
} else if (equalIgnoringCase(value, "metadata")) { |
- m_preload = MediaPlayer::MetaData; |
+ m_preload = WebMediaPlayer::PreloadMetaData; |
} else { |
// The spec does not define an "invalid value default" but "auto" is suggested as the |
// "missing value default", so use it for everything except "none" and "metadata" |
- m_preload = MediaPlayer::Auto; |
+ m_preload = WebMediaPlayer::PreloadAuto; |
} |
// The attribute must be ignored if the autoplay attribute is present |
- if (m_player) |
- setPlayerPreload(); |
- |
+ setPlayerPreload(); |
} else if (name == mediagroupAttr && RuntimeEnabledFeatures::mediaControllerEnabled()) { |
setMediaGroup(value); |
} else { |
@@ -1004,7 +1006,7 @@ void HTMLMediaElement::loadResource(const KURL& url, ContentType& contentType, c |
if (attemptLoad && canLoadURL(url, contentType, keySystem)) { |
ASSERT(!webMediaPlayer()); |
- if (!m_havePreparedToPlay && !autoplay() && m_preload == MediaPlayer::None) { |
+ if (!m_havePreparedToPlay && !autoplay() && m_preload == WebMediaPlayer::PreloadNone) { |
WTF_LOG(Media, "HTMLMediaElement::loadResource(%p) : Delaying load because preload == 'none'", this); |
deferLoad(); |
} else { |
@@ -1043,14 +1045,40 @@ void HTMLMediaElement::startPlayerLoad() |
if (!requestURL.pass().isEmpty()) |
requestURL.setPass(String()); |
- m_player->load(loadType(), requestURL, corsMode()); |
+ ASSERT(!m_webMediaPlayer); |
philipj_slow
2015/07/06 11:07:10
Perhaps move this to the top of the function.
Srirama
2015/07/09 15:19:37
Done.
|
+ |
+ LocalFrame* frame = document().frame(); |
philipj_slow
2015/07/06 11:07:10
I think handling the null case here instead of in
Srirama
2015/07/09 15:19:37
Done. Added TODO for time being, will investigate
|
+ KURL kurl(ParsedURLString, requestURL); |
+ m_webMediaPlayer = frame->loader().client()->createWebMediaPlayer(this, kurl); |
+ if (!m_webMediaPlayer) { |
+ mediaLoadingFailed(WebMediaPlayer::NetworkStateFormatError); |
+ return; |
+ } |
+ |
+ if (layoutObject()) |
+ layoutObject()->setShouldDoFullPaintInvalidation(); |
+#if ENABLE(WEB_AUDIO) |
+ // Make sure if we create/re-create the WebMediaPlayer that we update our wrapper. |
+ m_audioSourceProvider.wrap(m_webMediaPlayer->audioSourceProvider()); |
+#endif |
+ m_webMediaPlayer->setVolume(effectiveMediaVolume()); |
+ |
+ m_webMediaPlayer->setPoster(posterImageURL()); |
+ |
+ m_webMediaPlayer->setPreload(effectivePreloadType()); |
+ |
+ m_webMediaPlayer->load(loadType(), kurl, corsMode()); |
+ |
+ if (isFullscreen()) |
+ m_webMediaPlayer->enterFullscreen(); |
} |
void HTMLMediaElement::setPlayerPreload() |
{ |
- m_player->setPreload(effectivePreloadType()); |
+ if (m_webMediaPlayer) |
+ m_webMediaPlayer->setPreload(effectivePreloadType()); |
- if (loadIsDeferred() && m_preload != MediaPlayer::None) |
+ if (loadIsDeferred() && m_preload != WebMediaPlayer::PreloadNone) |
startDeferredLoad(); |
} |
@@ -1098,6 +1126,10 @@ void HTMLMediaElement::executeDeferredLoad() |
startProgressEventTimer(); |
+ if (!document().frame()) { |
+ mediaLoadingFailed(WebMediaPlayer::NetworkStateFormatError); |
+ return; |
+ } |
startPlayerLoad(); |
} |
@@ -1314,7 +1346,7 @@ void HTMLMediaElement::cancelPendingEventsAndCallbacks() |
source->cancelPendingErrorEvent(); |
} |
-void HTMLMediaElement::mediaPlayerNetworkStateChanged() |
+void HTMLMediaElement::networkStateChanged() |
{ |
setNetworkState(webMediaPlayer()->networkState()); |
} |
@@ -1405,7 +1437,6 @@ void HTMLMediaElement::setNetworkState(WebMediaPlayer::NetworkState state) |
void HTMLMediaElement::changeNetworkStateFromLoadingToIdle() |
{ |
- ASSERT(m_player); |
m_progressEventTimer.stop(); |
// Schedule one last progress event so we guarantee that at least one is fired |
@@ -1416,7 +1447,7 @@ void HTMLMediaElement::changeNetworkStateFromLoadingToIdle() |
m_networkState = NETWORK_IDLE; |
} |
-void HTMLMediaElement::mediaPlayerReadyStateChanged() |
+void HTMLMediaElement::readyStateChanged() |
{ |
setReadyState(static_cast<ReadyState>(webMediaPlayer()->readyState())); |
} |
@@ -1574,7 +1605,6 @@ void HTMLMediaElement::setReadyState(ReadyState state) |
void HTMLMediaElement::progressEventTimerFired(Timer<HTMLMediaElement>*) |
{ |
- ASSERT(m_player); |
if (m_networkState != NETWORK_LOADING) |
return; |
@@ -1627,7 +1657,7 @@ void HTMLMediaElement::seek(double time) |
return; |
// If the media engine has been told to postpone loading data, let it go ahead now. |
- if (m_preload < MediaPlayer::Auto && m_readyState < HAVE_FUTURE_DATA) |
+ if (m_preload < WebMediaPlayer::PreloadAuto && m_readyState < HAVE_FUTURE_DATA) |
prepareToPlay(); |
// Get the current time before setting m_seeking, m_lastSeekTime is returned once it is set. |
@@ -1801,10 +1831,10 @@ void HTMLMediaElement::setCurrentTime(double time, ExceptionState& exceptionStat |
double HTMLMediaElement::duration() const |
{ |
- // FIXME: remove m_player check once we figure out how m_player is going |
- // out of sync with readystate. m_player is cleared but readystate is not set |
- // to HAVE_NOTHING |
- if (!m_player || m_readyState < HAVE_METADATA) |
+ // FIXME: remove m_webMediaPlayer check once we figure out how |
+ // m_webMediaPlayer is going out of sync with readystate. |
+ // m_webMediaPlayer is cleared but readystate is not set to HAVE_NOTHING. |
+ if (!m_webMediaPlayer || m_readyState < HAVE_METADATA) |
return std::numeric_limits<double>::quiet_NaN(); |
// FIXME: Refactor so m_duration is kept current (in both MSE and |
@@ -1873,7 +1903,10 @@ HTMLMediaElement::DirectionOfPlayback HTMLMediaElement::directionOfPlayback() co |
void HTMLMediaElement::updatePlaybackRate() |
{ |
double effectiveRate = effectivePlaybackRate(); |
- if (m_player && potentiallyPlaying()) |
+ // FIXME: remove m_webMediaPlayer check once we figure out how |
+ // m_webMediaPlayer is going out of sync with readystate. |
+ // m_webMediaPlayer is cleared but readystate is not set to HAVE_NOTHING. |
+ if (m_webMediaPlayer && potentiallyPlaying()) |
webMediaPlayer()->setRate(effectiveRate); |
} |
@@ -1893,13 +1926,13 @@ bool HTMLMediaElement::autoplay() const |
String HTMLMediaElement::preload() const |
{ |
switch (m_preload) { |
- case MediaPlayer::None: |
+ case WebMediaPlayer::PreloadNone: |
return "none"; |
break; |
- case MediaPlayer::MetaData: |
+ case WebMediaPlayer::PreloadMetaData: |
return "metadata"; |
break; |
- case MediaPlayer::Auto: |
+ case WebMediaPlayer::PreloadAuto: |
return "auto"; |
break; |
} |
@@ -1914,9 +1947,9 @@ void HTMLMediaElement::setPreload(const AtomicString& preload) |
setAttribute(preloadAttr, preload); |
} |
-MediaPlayer::Preload HTMLMediaElement::effectivePreloadType() const |
+WebMediaPlayer::Preload HTMLMediaElement::effectivePreloadType() const |
{ |
- return autoplay() ? MediaPlayer::Auto : m_preload; |
+ return autoplay() ? WebMediaPlayer::PreloadAuto : m_preload; |
} |
void HTMLMediaElement::play() |
@@ -1944,7 +1977,7 @@ void HTMLMediaElement::playInternal() |
WTF_LOG(Media, "HTMLMediaElement::playInternal(%p)", this); |
// 4.8.10.9. Playing the media resource |
- if (!m_player || m_networkState == NETWORK_EMPTY) |
+ if (m_networkState == NETWORK_EMPTY) |
scheduleDelayedAction(LoadMediaResource); |
// Generally "ended" and "looping" are exclusive. Here, the loop attribute |
@@ -2004,7 +2037,7 @@ void HTMLMediaElement::pause() |
{ |
WTF_LOG(Media, "HTMLMediaElement::pause(%p)", this); |
- if (!m_player || m_networkState == NETWORK_EMPTY) |
+ if (m_networkState == NETWORK_EMPTY) |
scheduleDelayedAction(LoadMediaResource); |
m_autoplaying = false; |
@@ -2149,8 +2182,6 @@ void HTMLMediaElement::startPlaybackProgressTimer() |
void HTMLMediaElement::playbackProgressTimerFired(Timer<HTMLMediaElement>*) |
{ |
- ASSERT(m_player); |
- |
if (!std::isnan(m_fragmentEndTime) && currentTime() >= m_fragmentEndTime && directionOfPlayback() == Forward) { |
m_fragmentEndTime = std::numeric_limits<double>::quiet_NaN(); |
if (!m_mediaController && !m_paused) { |
@@ -2245,11 +2276,11 @@ void HTMLMediaElement::audioTracksTimerFired(Timer<HTMLMediaElement>*) |
webMediaPlayer()->enabledAudioTracksChanged(enabledTrackIds); |
} |
-WebMediaPlayer::TrackId HTMLMediaElement::addAudioTrack(const String& id, WebMediaPlayerClient::AudioTrackKind kind, const AtomicString& label, const AtomicString& language, bool enabled) |
+WebMediaPlayer::TrackId HTMLMediaElement::addAudioTrack(const WebString& id, blink::WebMediaPlayerClient::AudioTrackKind kind, const WebString& label, const WebString& language, bool enabled) |
{ |
AtomicString kindString = AudioKindToString(kind); |
WTF_LOG(Media, "HTMLMediaElement::addAudioTrack(%p, '%s', '%s', '%s', '%s', %d)", |
- this, id.ascii().data(), kindString.ascii().data(), label.ascii().data(), language.ascii().data(), enabled); |
+ this, id.utf8().data(), kindString.ascii().data(), label.utf8().data(), language.utf8().data(), enabled); |
if (!RuntimeEnabledFeatures::audioVideoTracksEnabled()) |
return 0; |
@@ -2289,11 +2320,11 @@ void HTMLMediaElement::selectedVideoTrackChanged(WebMediaPlayer::TrackId* select |
webMediaPlayer()->selectedVideoTrackChanged(selectedTrackId); |
} |
-WebMediaPlayer::TrackId HTMLMediaElement::addVideoTrack(const String& id, WebMediaPlayerClient::VideoTrackKind kind, const AtomicString& label, const AtomicString& language, bool selected) |
+WebMediaPlayer::TrackId HTMLMediaElement::addVideoTrack(const WebString& id, blink::WebMediaPlayerClient::VideoTrackKind kind, const WebString& label, const WebString& language, bool selected) |
{ |
AtomicString kindString = VideoKindToString(kind); |
WTF_LOG(Media, "HTMLMediaElement::addVideoTrack(%p, '%s', '%s', '%s', '%s', %d)", |
- this, id.ascii().data(), kindString.ascii().data(), label.ascii().data(), language.ascii().data(), selected); |
+ this, id.utf8().data(), kindString.ascii().data(), label.utf8().data(), language.utf8().data(), selected); |
if (!RuntimeEnabledFeatures::audioVideoTracksEnabled()) |
return 0; |
@@ -2318,7 +2349,7 @@ void HTMLMediaElement::removeVideoTrack(WebMediaPlayer::TrackId trackId) |
videoTracks().remove(trackId); |
} |
-void HTMLMediaElement::mediaPlayerDidAddTextTrack(WebInbandTextTrack* webTrack) |
+void HTMLMediaElement::addTextTrack(WebInbandTextTrack* webTrack) |
{ |
// 4.8.10.12.2 Sourcing in-band text tracks |
// 1. Associate the relevant data with a new text track and its corresponding new TextTrack object. |
@@ -2350,7 +2381,7 @@ void HTMLMediaElement::mediaPlayerDidAddTextTrack(WebInbandTextTrack* webTrack) |
addTextTrack(textTrack.get()); |
} |
-void HTMLMediaElement::mediaPlayerDidRemoveTextTrack(WebInbandTextTrack* webTrack) |
+void HTMLMediaElement::removeTextTrack(WebInbandTextTrack* webTrack) |
{ |
if (!m_textTracks) |
return; |
@@ -2691,7 +2722,7 @@ void HTMLMediaElement::sourceWasRemoved(HTMLSourceElement* source) |
} |
} |
-void HTMLMediaElement::mediaPlayerTimeChanged() |
+void HTMLMediaElement::timeChanged() |
{ |
WTF_LOG(Media, "HTMLMediaElement::mediaPlayerTimeChanged(%p)", this); |
@@ -2744,13 +2775,13 @@ void HTMLMediaElement::mediaPlayerTimeChanged() |
updatePlayState(); |
} |
-void HTMLMediaElement::mediaPlayerDurationChanged() |
+void HTMLMediaElement::durationChanged() |
{ |
- WTF_LOG(Media, "HTMLMediaElement::mediaPlayerDurationChanged(%p)", this); |
- // FIXME: Change MediaPlayerClient & WebMediaPlayer to convey |
- // the currentTime when the duration change occured. The current |
- // WebMediaPlayer implementations always clamp currentTime() to |
- // duration() so the requestSeek condition here is always false. |
+ WTF_LOG(Media, "HTMLMediaElement::durationChanged(%p)", this); |
+ // FIXME: Change WebMediaPlayer to convey the currentTime |
+ // when the duration change occured. The current WebMediaPlayer |
+ // implementations always clamp currentTime() to duration() |
+ // so the requestSeek condition here is always false. |
durationChanged(duration(), currentTime() > duration()); |
} |
@@ -2775,7 +2806,7 @@ void HTMLMediaElement::durationChanged(double duration, bool requestSeek) |
seek(duration); |
} |
-void HTMLMediaElement::mediaPlayerPlaybackStateChanged() |
+void HTMLMediaElement::playbackStateChanged() |
{ |
WTF_LOG(Media, "HTMLMediaElement::mediaPlayerPlaybackStateChanged(%p)", this); |
@@ -2820,7 +2851,7 @@ void HTMLMediaElement::disconnectedFromRemoteDevice() |
} |
// MediaPlayerPresentation methods |
-void HTMLMediaElement::mediaPlayerRepaint() |
+void HTMLMediaElement::repaint() |
{ |
if (m_webLayer) |
m_webLayer->invalidate(); |
@@ -2830,7 +2861,7 @@ void HTMLMediaElement::mediaPlayerRepaint() |
layoutObject()->setShouldDoFullPaintInvalidation(); |
} |
-void HTMLMediaElement::mediaPlayerSizeChanged() |
+void HTMLMediaElement::sizeChanged() |
{ |
WTF_LOG(Media, "HTMLMediaElement::mediaPlayerSizeChanged(%p)", this); |
@@ -2895,7 +2926,7 @@ bool HTMLMediaElement::couldPlayIfEnoughData() const |
bool HTMLMediaElement::endedPlayback(LoopCondition loopCondition) const |
{ |
double dur = duration(); |
- if (!m_player || std::isnan(dur)) |
+ if (std::isnan(dur)) |
return false; |
// 4.8.10.8 Playing the media resource |
@@ -2931,9 +2962,6 @@ bool HTMLMediaElement::stoppedDueToErrors() const |
void HTMLMediaElement::updatePlayState() |
{ |
- if (!m_player) |
- return; |
- |
bool isPlaying = webMediaPlayer() && !webMediaPlayer()->paused(); |
bool shouldBePlaying = potentiallyPlaying(); |
@@ -3024,7 +3052,7 @@ void HTMLMediaElement::userCancelledLoad() |
// 6 - Abort the overall resource selection algorithm. |
m_currentSourceNode = nullptr; |
- // Reset m_readyState since m_player is gone. |
+ // Reset m_readyState since m_webMediaPlayer is gone. |
m_readyState = HAVE_NOTHING; |
invalidateCachedTime(); |
updateMediaController(); |
@@ -3035,9 +3063,12 @@ void HTMLMediaElement::clearMediaPlayerAndAudioSourceProviderClientWithoutLockin |
{ |
#if ENABLE(WEB_AUDIO) |
if (audioSourceProvider()) |
- audioSourceProvider()->setClient(0); |
+ audioSourceProvider()->setClient(nullptr); |
#endif |
- m_player.clear(); |
+ if (m_webMediaPlayer) { |
+ m_audioSourceProvider.wrap(nullptr); |
+ m_webMediaPlayer.clear(); |
+ } |
} |
void HTMLMediaElement::clearMediaPlayer(int flags) |
@@ -3262,7 +3293,7 @@ void HTMLMediaElement::setClosedCaptionsVisible(bool closedCaptionVisible) |
{ |
WTF_LOG(Media, "HTMLMediaElement::setClosedCaptionsVisible(%p, %s)", this, boolString(closedCaptionVisible)); |
- if (!m_player || !hasClosedCaptions()) |
+ if (!hasClosedCaptions()) |
return; |
m_closedCaptionsVisible = closedCaptionVisible; |
@@ -3444,7 +3475,10 @@ void HTMLMediaElement::createMediaPlayer() |
closeMediaSource(); |
- m_player = MediaPlayer::create(this); |
+ if (m_webMediaPlayer) { |
+ m_audioSourceProvider.wrap(nullptr); |
+ m_webMediaPlayer.clear(); |
+ } |
// We haven't yet found out if any remote routes are available. |
m_remoteRoutesAvailable = false; |
@@ -3468,14 +3502,6 @@ void HTMLMediaElement::setAudioSourceNode(AudioSourceProviderClient* sourceNode) |
if (audioSourceProvider()) |
audioSourceProvider()->setClient(m_audioSourceNode); |
} |
- |
-AudioSourceProvider* HTMLMediaElement::audioSourceProvider() |
-{ |
- if (m_player) |
- return m_player->audioSourceProvider(); |
- |
- return nullptr; |
-} |
#endif |
const AtomicString& HTMLMediaElement::mediaGroup() const |
@@ -3587,7 +3613,7 @@ WebMediaPlayer::CORSMode HTMLMediaElement::corsMode() const |
return WebMediaPlayer::CORSModeAnonymous; |
} |
-void HTMLMediaElement::mediaPlayerSetWebLayer(WebLayer* webLayer) |
+void HTMLMediaElement::setWebLayer(blink::WebLayer* webLayer) |
{ |
if (webLayer == m_webLayer) |
return; |
@@ -3607,7 +3633,7 @@ void HTMLMediaElement::mediaPlayerSetWebLayer(WebLayer* webLayer) |
GraphicsLayer::registerContentsLayer(m_webLayer); |
} |
-void HTMLMediaElement::mediaPlayerMediaSourceOpened(WebMediaSource* webMediaSource) |
+void HTMLMediaElement::mediaSourceOpened(WebMediaSource* webMediaSource) |
{ |
m_mediaSource->setWebMediaSourceAndOpen(adoptPtr(webMediaSource)); |
} |
@@ -3684,6 +3710,62 @@ void HTMLMediaElement::clearWeakMembers(Visitor* visitor) |
if (!Heap::isHeapObjectAlive(m_audioSourceNode) && audioSourceProvider()) |
audioSourceProvider()->setClient(nullptr); |
} |
+ |
+void HTMLMediaElement::AudioSourceProviderImpl::wrap(WebAudioSourceProvider* provider) |
+{ |
+ MutexLocker locker(provideInputLock); |
+ |
+ if (m_webAudioSourceProvider && provider != m_webAudioSourceProvider) |
+ m_webAudioSourceProvider->setClient(nullptr); |
+ |
+ m_webAudioSourceProvider = provider; |
+ if (m_webAudioSourceProvider) |
+ m_webAudioSourceProvider->setClient(m_client.get()); |
+} |
+ |
+void HTMLMediaElement::AudioSourceProviderImpl::setClient(AudioSourceProviderClient* client) |
+{ |
+ MutexLocker locker(provideInputLock); |
+ |
+ if (client) |
+ m_client = new HTMLMediaElement::AudioClientImpl(client); |
+ else |
+ m_client.clear(); |
+ |
+ if (m_webAudioSourceProvider) |
+ m_webAudioSourceProvider->setClient(m_client.get()); |
+} |
+ |
+void HTMLMediaElement::AudioSourceProviderImpl::provideInput(AudioBus* bus, size_t framesToProcess) |
+{ |
+ if (!bus) |
+ return; |
+ |
+ MutexTryLocker tryLocker(provideInputLock); |
+ if (!tryLocker.locked() || !m_webAudioSourceProvider || !m_client.get()) { |
+ bus->zero(); |
+ return; |
+ } |
+ |
+ // Wrap the AudioBus channel data using WebVector. |
+ size_t n = bus->numberOfChannels(); |
+ WebVector<float*> webAudioData(n); |
+ for (size_t i = 0; i < n; ++i) |
+ webAudioData[i] = bus->channel(i)->mutableData(); |
+ |
+ m_webAudioSourceProvider->provideInput(webAudioData, framesToProcess); |
+} |
+ |
+void HTMLMediaElement::AudioClientImpl::setFormat(size_t numberOfChannels, float sampleRate) |
+{ |
+ if (m_client) |
+ m_client->setFormat(numberOfChannels, sampleRate); |
+} |
+ |
+DEFINE_TRACE(HTMLMediaElement::AudioClientImpl) |
+{ |
+ visitor->trace(m_client); |
+} |
#endif |
} |