Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 #include "WebMediaPlayerClientImpl.h" | 6 #include "WebMediaPlayerClientImpl.h" |
| 7 | 7 |
| 8 #include "WebDocument.h" | 8 #include "WebDocument.h" |
| 9 #include "WebFrameClient.h" | 9 #include "WebFrameClient.h" |
| 10 #include "WebFrameImpl.h" | 10 #include "WebFrameImpl.h" |
| 11 #include "WebHelperPlugin.h" | 11 #include "WebHelperPlugin.h" |
| 12 #include "WebViewImpl.h" | 12 #include "WebViewImpl.h" |
| 13 #include "core/frame/Frame.h" | 13 #include "core/frame/Frame.h" |
| 14 #include "core/html/HTMLMediaElement.h" | 14 #include "core/html/HTMLMediaElement.h" |
| 15 #include "core/html/HTMLVideoElement.h" | |
| 15 #include "core/html/TimeRanges.h" | 16 #include "core/html/TimeRanges.h" |
| 16 #include "core/rendering/RenderLayerCompositor.h" | 17 #include "core/rendering/RenderLayerCompositor.h" |
| 17 #include "core/rendering/RenderView.h" | 18 #include "core/rendering/RenderView.h" |
| 18 #include "modules/mediastream/MediaStreamRegistry.h" | 19 #include "modules/mediastream/MediaStreamRegistry.h" |
| 19 #include "platform/audio/AudioBus.h" | 20 #include "platform/audio/AudioBus.h" |
| 20 #include "platform/audio/AudioSourceProviderClient.h" | 21 #include "platform/audio/AudioSourceProviderClient.h" |
| 21 #include "platform/geometry/IntSize.h" | 22 #include "platform/geometry/IntSize.h" |
| 22 #include "platform/graphics/GraphicsContext.h" | 23 #include "platform/graphics/GraphicsContext.h" |
| 23 #include "platform/graphics/GraphicsContext3D.h" | 24 #include "platform/graphics/GraphicsContext3D.h" |
| 24 #include "platform/graphics/GraphicsLayer.h" | 25 #include "platform/graphics/GraphicsLayer.h" |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 221 } | 222 } |
| 222 | 223 |
| 223 void WebMediaPlayerClientImpl::loadInternal() | 224 void WebMediaPlayerClientImpl::loadInternal() |
| 224 { | 225 { |
| 225 #if ENABLE(WEB_AUDIO) | 226 #if ENABLE(WEB_AUDIO) |
| 226 m_audioSourceProvider.wrap(0); // Clear weak reference to m_webMediaPlayer's WebAudioSourceProvider. | 227 m_audioSourceProvider.wrap(0); // Clear weak reference to m_webMediaPlayer's WebAudioSourceProvider. |
| 227 #endif | 228 #endif |
| 228 | 229 |
| 229 // FIXME: Remove this cast | 230 // FIXME: Remove this cast |
| 230 Frame* frame = static_cast<HTMLMediaElement*>(m_client)->document().frame(); | 231 Frame* frame = static_cast<HTMLMediaElement*>(m_client)->document().frame(); |
| 232 WebURL poster = static_cast<HTMLVideoElement*>(m_client)->posterImageURL(); | |
| 231 | 233 |
| 232 // This does not actually check whether the hardware can support accelerated | 234 // This does not actually check whether the hardware can support accelerated |
| 233 // compositing, but only if the flag is set. However, this is checked lazily | 235 // compositing, but only if the flag is set. However, this is checked lazily |
| 234 // in WebViewImpl::setIsAcceleratedCompositingActive() and will fail there | 236 // in WebViewImpl::setIsAcceleratedCompositingActive() and will fail there |
| 235 // if necessary. | 237 // if necessary. |
| 236 m_needsWebLayerForVideo = frame->contentRenderer()->compositor()->hasAcceler atedCompositing(); | 238 m_needsWebLayerForVideo = frame->contentRenderer()->compositor()->hasAcceler atedCompositing(); |
| 237 | 239 |
| 238 m_webMediaPlayer = createWebMediaPlayer(this, m_url, frame); | 240 m_webMediaPlayer = createWebMediaPlayer(this, m_url, frame); |
| 239 if (m_webMediaPlayer) { | 241 if (m_webMediaPlayer) { |
| 240 #if ENABLE(WEB_AUDIO) | 242 #if ENABLE(WEB_AUDIO) |
| 241 // Make sure if we create/re-create the WebMediaPlayer that we update ou r wrapper. | 243 // Make sure if we create/re-create the WebMediaPlayer that we update ou r wrapper. |
| 242 m_audioSourceProvider.wrap(m_webMediaPlayer->audioSourceProvider()); | 244 m_audioSourceProvider.wrap(m_webMediaPlayer->audioSourceProvider()); |
| 243 #endif | 245 #endif |
| 244 | 246 |
| 247 // Tell WebMediaPlayer about the poster image URL, if it exists. | |
| 248 if (!poster.isEmpty()) | |
| 249 m_webMediaPlayer->setPoster(poster); | |
| 250 | |
| 245 // Tell WebMediaPlayer about any connected CDM (may be null). | 251 // Tell WebMediaPlayer about any connected CDM (may be null). |
| 246 m_webMediaPlayer->setContentDecryptionModule(m_cdm); | 252 m_webMediaPlayer->setContentDecryptionModule(m_cdm); |
| 247 | 253 |
| 248 WebMediaPlayer::CORSMode corsMode = static_cast<WebMediaPlayer::CORSMode >(m_client->mediaPlayerCORSMode()); | 254 WebMediaPlayer::CORSMode corsMode = static_cast<WebMediaPlayer::CORSMode >(m_client->mediaPlayerCORSMode()); |
| 249 m_webMediaPlayer->load(m_loadType, m_url, corsMode); | 255 m_webMediaPlayer->load(m_loadType, m_url, corsMode); |
| 250 } | 256 } |
| 251 } | 257 } |
| 252 | 258 |
| 253 void WebMediaPlayerClientImpl::play() | 259 void WebMediaPlayerClientImpl::play() |
| 254 { | 260 { |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 400 m_webMediaPlayer->setVolume(volume); | 406 m_webMediaPlayer->setVolume(volume); |
| 401 } | 407 } |
| 402 | 408 |
| 403 void WebMediaPlayerClientImpl::setMuted(bool muted) | 409 void WebMediaPlayerClientImpl::setMuted(bool muted) |
| 404 { | 410 { |
| 405 m_muted = muted; | 411 m_muted = muted; |
| 406 if (m_webMediaPlayer) | 412 if (m_webMediaPlayer) |
| 407 m_webMediaPlayer->setVolume(muted ? 0 : m_volume); | 413 m_webMediaPlayer->setVolume(muted ? 0 : m_volume); |
| 408 } | 414 } |
| 409 | 415 |
| 416 void WebMediaPlayerClientImpl::setPoster(const KURL& poster) { | |
| 417 if (m_webMediaPlayer && !poster.isEmpty()) { | |
|
acolwell GONE FROM CHROMIUM
2014/02/06 22:53:50
nit: I believe you need to notify m_webMediaPlayer
cimamoglu (inactive)
2014/02/07 14:36:19
Done.
| |
| 418 m_webMediaPlayer->setPoster(WebURL(poster)); | |
| 419 } | |
| 420 } | |
| 421 | |
| 410 MediaPlayer::NetworkState WebMediaPlayerClientImpl::networkState() const | 422 MediaPlayer::NetworkState WebMediaPlayerClientImpl::networkState() const |
| 411 { | 423 { |
| 412 if (m_webMediaPlayer) | 424 if (m_webMediaPlayer) |
| 413 return static_cast<MediaPlayer::NetworkState>(m_webMediaPlayer->networkS tate()); | 425 return static_cast<MediaPlayer::NetworkState>(m_webMediaPlayer->networkS tate()); |
| 414 return MediaPlayer::Empty; | 426 return MediaPlayer::Empty; |
| 415 } | 427 } |
| 416 | 428 |
| 417 MediaPlayer::ReadyState WebMediaPlayerClientImpl::readyState() const | 429 MediaPlayer::ReadyState WebMediaPlayerClientImpl::readyState() const |
| 418 { | 430 { |
| 419 if (m_webMediaPlayer) | 431 if (m_webMediaPlayer) |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 665 | 677 |
| 666 void WebMediaPlayerClientImpl::AudioClientImpl::setFormat(size_t numberOfChannel s, float sampleRate) | 678 void WebMediaPlayerClientImpl::AudioClientImpl::setFormat(size_t numberOfChannel s, float sampleRate) |
| 667 { | 679 { |
| 668 if (m_client) | 680 if (m_client) |
| 669 m_client->setFormat(numberOfChannels, sampleRate); | 681 m_client->setFormat(numberOfChannels, sampleRate); |
| 670 } | 682 } |
| 671 | 683 |
| 672 #endif | 684 #endif |
| 673 | 685 |
| 674 } // namespace blink | 686 } // namespace blink |
| OLD | NEW |