Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1077)

Side by Side Diff: Source/web/WebMediaPlayerClientImpl.cpp

Issue 604753003: Removing #ifdefs for WEB_AUDIO compile time flag. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "web/WebMediaPlayerClientImpl.h" 6 #include "web/WebMediaPlayerClientImpl.h"
7 7
8 #include "core/frame/LocalFrame.h" 8 #include "core/frame/LocalFrame.h"
9 #include "core/html/HTMLMediaElement.h" 9 #include "core/html/HTMLMediaElement.h"
10 #include "core/html/TimeRanges.h" 10 #include "core/html/TimeRanges.h"
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 // FIXME: Remove this cast 203 // FIXME: Remove this cast
204 LocalFrame* frame = mediaElement().document().frame(); 204 LocalFrame* frame = mediaElement().document().frame();
205 205
206 WebURL poster = m_client->mediaPlayerPosterURL(); 206 WebURL poster = m_client->mediaPlayerPosterURL();
207 207
208 KURL kurl(ParsedURLString, url); 208 KURL kurl(ParsedURLString, url);
209 m_webMediaPlayer = createWebMediaPlayer(this, kurl, frame, HTMLMediaElementE ncryptedMedia::contentDecryptionModule(mediaElement())); 209 m_webMediaPlayer = createWebMediaPlayer(this, kurl, frame, HTMLMediaElementE ncryptedMedia::contentDecryptionModule(mediaElement()));
210 if (!m_webMediaPlayer) 210 if (!m_webMediaPlayer)
211 return; 211 return;
212 212
213 #if ENABLE(WEB_AUDIO)
214 // Make sure if we create/re-create the WebMediaPlayer that we update our wr apper. 213 // Make sure if we create/re-create the WebMediaPlayer that we update our wr apper.
215 m_audioSourceProvider.wrap(m_webMediaPlayer->audioSourceProvider()); 214 m_audioSourceProvider.wrap(m_webMediaPlayer->audioSourceProvider());
216 #endif
217 215
218 m_webMediaPlayer->setVolume(mediaElement().effectiveMediaVolume()); 216 m_webMediaPlayer->setVolume(mediaElement().effectiveMediaVolume());
219 217
220 m_webMediaPlayer->setPoster(poster); 218 m_webMediaPlayer->setPoster(poster);
221 219
222 m_webMediaPlayer->load(loadType, kurl, corsMode); 220 m_webMediaPlayer->load(loadType, kurl, corsMode);
223 } 221 }
224 222
225 void WebMediaPlayerClientImpl::setPreload(MediaPlayer::Preload preload) 223 void WebMediaPlayerClientImpl::setPreload(MediaPlayer::Preload preload)
226 { 224 {
227 if (m_webMediaPlayer) 225 if (m_webMediaPlayer)
228 m_webMediaPlayer->setPreload(static_cast<WebMediaPlayer::Preload>(preloa d)); 226 m_webMediaPlayer->setPreload(static_cast<WebMediaPlayer::Preload>(preloa d));
229 } 227 }
230 228
231 #if ENABLE(WEB_AUDIO)
232 AudioSourceProvider* WebMediaPlayerClientImpl::audioSourceProvider() 229 AudioSourceProvider* WebMediaPlayerClientImpl::audioSourceProvider()
233 { 230 {
234 return &m_audioSourceProvider; 231 return &m_audioSourceProvider;
235 } 232 }
236 #endif
237 233
238 PassOwnPtr<MediaPlayer> WebMediaPlayerClientImpl::create(MediaPlayerClient* clie nt) 234 PassOwnPtr<MediaPlayer> WebMediaPlayerClientImpl::create(MediaPlayerClient* clie nt)
239 { 235 {
240 return adoptPtr(new WebMediaPlayerClientImpl(client)); 236 return adoptPtr(new WebMediaPlayerClientImpl(client));
241 } 237 }
242 238
243 WebMediaPlayerClientImpl::WebMediaPlayerClientImpl(MediaPlayerClient* client) 239 WebMediaPlayerClientImpl::WebMediaPlayerClientImpl(MediaPlayerClient* client)
244 : m_client(client) 240 : m_client(client)
245 { 241 {
246 ASSERT(m_client); 242 ASSERT(m_client);
247 } 243 }
248 244
249 HTMLMediaElement& WebMediaPlayerClientImpl::mediaElement() const 245 HTMLMediaElement& WebMediaPlayerClientImpl::mediaElement() const
250 { 246 {
251 return *static_cast<HTMLMediaElement*>(m_client); 247 return *static_cast<HTMLMediaElement*>(m_client);
252 } 248 }
253 249
254 #if ENABLE(WEB_AUDIO)
255 void WebMediaPlayerClientImpl::AudioSourceProviderImpl::wrap(WebAudioSourceProvi der* provider) 250 void WebMediaPlayerClientImpl::AudioSourceProviderImpl::wrap(WebAudioSourceProvi der* provider)
256 { 251 {
257 MutexLocker locker(provideInputLock); 252 MutexLocker locker(provideInputLock);
258 253
259 if (m_webAudioSourceProvider && provider != m_webAudioSourceProvider) 254 if (m_webAudioSourceProvider && provider != m_webAudioSourceProvider)
260 m_webAudioSourceProvider->setClient(0); 255 m_webAudioSourceProvider->setClient(0);
261 256
262 m_webAudioSourceProvider = provider; 257 m_webAudioSourceProvider = provider;
263 if (m_webAudioSourceProvider) 258 if (m_webAudioSourceProvider)
264 m_webAudioSourceProvider->setClient(m_client.get()); 259 m_webAudioSourceProvider->setClient(m_client.get());
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 { 297 {
303 if (m_client) 298 if (m_client)
304 m_client->setFormat(numberOfChannels, sampleRate); 299 m_client->setFormat(numberOfChannels, sampleRate);
305 } 300 }
306 301
307 void WebMediaPlayerClientImpl::AudioClientImpl::trace(Visitor* visitor) 302 void WebMediaPlayerClientImpl::AudioClientImpl::trace(Visitor* visitor)
308 { 303 {
309 visitor->trace(m_client); 304 visitor->trace(m_client);
310 } 305 }
311 306
312 #endif
313
314 } // namespace blink 307 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698