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

Unified Diff: Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp

Issue 15077011: Add safety when the .src attribute of an <audio> or <video> element is changed and it's used with t… (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: don't call WebAudioSourceProvider::provideInput() if client is not set Created 7 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp
diff --git a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp
index 17d2fcddf67972131cfe5fb73132da35aafca975..656e638ec8a510efe0627b976579c0556b4757de 100644
--- a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp
+++ b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp
@@ -841,6 +841,11 @@ WebMediaPlayerClientImpl::WebMediaPlayerClientImpl()
#if ENABLE(WEB_AUDIO)
void WebMediaPlayerClientImpl::AudioSourceProviderImpl::wrap(WebAudioSourceProvider* provider)
{
+ MutexLocker locker(provideInputLock);
+
+ if (m_webAudioSourceProvider && provider != m_webAudioSourceProvider)
+ m_webAudioSourceProvider->setClient(0);
+
m_webAudioSourceProvider = provider;
if (m_webAudioSourceProvider)
m_webAudioSourceProvider->setClient(m_client.get());
@@ -848,6 +853,8 @@ void WebMediaPlayerClientImpl::AudioSourceProviderImpl::wrap(WebAudioSourceProvi
void WebMediaPlayerClientImpl::AudioSourceProviderImpl::setClient(AudioSourceProviderClient* client)
{
+ MutexLocker locker(provideInputLock);
+
if (client)
m_client = adoptPtr(new WebMediaPlayerClientImpl::AudioClientImpl(client));
else
@@ -863,7 +870,8 @@ void WebMediaPlayerClientImpl::AudioSourceProviderImpl::provideInput(AudioBus* b
if (!bus)
return;
- if (!m_webAudioSourceProvider) {
+ MutexTryLocker tryLocker(provideInputLock);
+ if (!tryLocker.locked() || !m_webAudioSourceProvider || !m_client.get()) {
bus->zero();
return;
}
« no previous file with comments | « Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698