+2013-02-12 Raymond Toy <rtoy@google.com>
+
+ Synchronize setting of panner node model and processing
+ https://bugs.webkit.org/show_bug.cgi?id=109599
+
+ Reviewed by Chris Rogers.
+
+ No new tests.
+
+ * Modules/webaudio/PannerNode.cpp:
+ (WebCore::PannerNode::process):
+ (WebCore::PannerNode::setPanningModel):
+ * Modules/webaudio/PannerNode.h:
+
2013-02-12 Dean Jackson <dino@apple.com>
Add class name for snapshotted plugin based on dimensions
return;
}
- // 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();
-
- // Snap to desired gain at the beginning.
- if (m_lastGain == -1.0)
- m_lastGain = totalGain;
+ // 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();
+
+ // 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()
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;