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

Unified Diff: Source/WebCore/Modules/webaudio/PannerNode.cpp

Issue 12284015: Merge 142687 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1410/
Patch Set: Created 7 years, 10 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/WebCore/Modules/webaudio/PannerNode.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/Modules/webaudio/PannerNode.cpp
===================================================================
--- Source/WebCore/Modules/webaudio/PannerNode.cpp (revision 143082)
+++ Source/WebCore/Modules/webaudio/PannerNode.cpp (working copy)
@@ -104,21 +104,28 @@
return;
}
- // Apply the panning effect.
- double azimuth;
- double elevation;
- getAzimuthElevation(&azimuth, &elevation);
- m_panner->pan(azimuth, elevation, source, destination, framesToProcess);
+ // The audio thread can't block on this lock, so we call tryLock() instead.
+ MutexTryLocker tryLocker(m_pannerLock);
+ if (tryLocker.locked()) {
+ // Apply the panning effect.
+ double azimuth;
+ double elevation;
+ getAzimuthElevation(&azimuth, &elevation);
+ m_panner->pan(azimuth, elevation, source, destination, framesToProcess);
- // Get the distance and cone gain.
- double totalGain = distanceConeGain();
+ // Get the distance and cone gain.
+ double totalGain = distanceConeGain();
- // Snap to desired gain at the beginning.
- if (m_lastGain == -1.0)
- m_lastGain = totalGain;
+ // Snap to desired gain at the beginning.
+ if (m_lastGain == -1.0)
+ m_lastGain = totalGain;
- // Apply gain in-place with de-zippering.
- destination->copyWithGainFrom(*destination, &m_lastGain, totalGain);
+ // Apply gain in-place with de-zippering.
+ destination->copyWithGainFrom(*destination, &m_lastGain, totalGain);
+ } else {
+ // Too bad - The tryLock() failed. We must be in the middle of changing the panner.
+ destination->zero();
+ }
}
void PannerNode::reset()
@@ -185,6 +192,9 @@
case EQUALPOWER:
case HRTF:
if (!m_panner.get() || model != m_panningModel) {
+ // This synchronizes with process().
+ MutexLocker processLocker(m_pannerLock);
+
OwnPtr<Panner> newPanner = Panner::create(model, sampleRate());
m_panner = newPanner.release();
m_panningModel = model;
« no previous file with comments | « Source/WebCore/Modules/webaudio/PannerNode.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698