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

Unified Diff: Source/modules/webaudio/PannerNode.cpp

Issue 393363002: Move handle of HRTFDatabaseLoader to AudioListener. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 5 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
Index: Source/modules/webaudio/PannerNode.cpp
diff --git a/Source/modules/webaudio/PannerNode.cpp b/Source/modules/webaudio/PannerNode.cpp
index 029c73cf16cbee3b6c7f1bd380557f004719b5ec..7783013acc746ad74057e97f213aa03e4c351063 100644
--- a/Source/modules/webaudio/PannerNode.cpp
+++ b/Source/modules/webaudio/PannerNode.cpp
@@ -29,6 +29,7 @@
#include "modules/webaudio/PannerNode.h"
#include "core/dom/ExecutionContext.h"
+#include "platform/audio/HRTFDatabaseLoader.h"
#include "platform/audio/HRTFPanner.h"
#include "modules/webaudio/AudioBufferSourceNode.h"
#include "modules/webaudio/AudioContext.h"
@@ -65,7 +66,8 @@ PannerNode::PannerNode(AudioContext* context, float sampleRate)
{
// Load the HRTF database asynchronously so we don't block the Javascript thread while creating the HRTF database.
// The HRTF panner will return zeroes until the database is loaded.
- m_hrtfDatabaseLoader = HRTFDatabaseLoader::createAndLoadAsynchronouslyIfNecessary(context->sampleRate());
+ RefPtrWillBeRawPtr<HRTFDatabaseLoader> loader = HRTFDatabaseLoader::createAndLoadAsynchronouslyIfNecessary(context->sampleRate());
tkent 2014/07/16 23:32:25 RefPtrWillBeRawPtr should be RefPtr.
KhNo 2014/07/17 16:23:17 Done.
+ listener()->setHRTFDatabaseLoader(loader.release());
Raymond Toy 2014/07/16 16:35:38 Per the comment above, should we check that listen
KhNo 2014/07/17 16:23:17 Yes, we must. Thanks.
ScriptWrappable::init(this);
addInput(adoptPtr(new AudioNodeInput(this)));
@@ -125,9 +127,9 @@ void PannerNode::process(size_t framesToProcess)
if (tryLocker.locked() && tryListenerLocker.locked()) {
// HRTFDatabase should be loaded before proceeding for offline audio context when the panning model is HRTF.
- if (m_panningModel == Panner::PanningModelHRTF && !m_hrtfDatabaseLoader->isLoaded()) {
+ if (m_panningModel == Panner::PanningModelHRTF && !hrtfDatabaseLoader()->isLoaded()) {
if (context()->isOfflineContext()) {
- m_hrtfDatabaseLoader->waitForLoaderThreadCompletion();
+ hrtfDatabaseLoader()->waitForLoaderThreadCompletion();
} else {
destination->zero();
return;
@@ -162,7 +164,7 @@ void PannerNode::initialize()
if (isInitialized())
return;
- m_panner = Panner::create(m_panningModel, sampleRate(), m_hrtfDatabaseLoader.get());
+ m_panner = Panner::create(m_panningModel, sampleRate(), hrtfDatabaseLoader());
listener()->addPanner(this);
AudioNode::initialize();
@@ -213,7 +215,7 @@ bool PannerNode::setPanningModel(unsigned model)
if (!m_panner.get() || model != m_panningModel) {
// This synchronizes with process().
MutexLocker processLocker(m_processLock);
- OwnPtr<Panner> newPanner = Panner::create(model, sampleRate(), m_hrtfDatabaseLoader.get());
+ OwnPtr<Panner> newPanner = Panner::create(model, sampleRate(), hrtfDatabaseLoader());
m_panner = newPanner.release();
m_panningModel = model;
}
« Source/modules/webaudio/AudioListener.h ('K') | « Source/modules/webaudio/PannerNode.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698