Changeset 176259 in webkit
- Timestamp:
- Nov 18, 2014 8:31:36 AM (9 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r176258 r176259 1 2014-11-18 Philippe Normand <pnormand@igalia.com> 2 3 HRTFDatabaseLoader is not an absolute condition to run audioContext 4 https://bugs.webkit.org/show_bug.cgi?id=138829 5 6 Reviewed by Jer Noble. 7 8 This patch is a port of the following Blink revision by 9 <keonho07.kim@samsung.com>: 10 <https://src.chromium.org/viewvc/blink?revision=167887&view=revision> 11 12 * Modules/webaudio/AudioContext.cpp: 13 (WebCore::AudioContext::AudioContext): 14 (WebCore::AudioContext::isRunnable): Deleted. 15 * Modules/webaudio/AudioContext.h: 16 (WebCore::AudioContext::hrtfDatabaseLoader): Deleted. 17 * Modules/webaudio/AudioDestinationNode.cpp: 18 (WebCore::AudioDestinationNode::render): 19 * Modules/webaudio/OfflineAudioDestinationNode.cpp: 20 (WebCore::OfflineAudioDestinationNode::offlineRender): 21 * Modules/webaudio/PannerNode.cpp: 22 (WebCore::PannerNode::PannerNode): 23 (WebCore::PannerNode::process): 24 (WebCore::PannerNode::initialize): 25 (WebCore::PannerNode::setPanningModel): 26 * Modules/webaudio/PannerNode.h: 27 * Modules/webaudio/RealtimeAnalyser.cpp: 28 * Modules/webaudio/RealtimeAnalyser.h: 29 * platform/audio/HRTFDatabaseLoader.cpp: 30 (WebCore::HRTFDatabaseLoader::createAndLoadAsynchronouslyIfNecessary): 31 1 32 2014-11-18 Commit Queue <commit-queue@webkit.org> 2 33 -
trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp
r174089 r176259 143 143 144 144 m_destinationNode = DefaultAudioDestinationNode::create(this); 145 146 // This sets in motion an asynchronous loading mechanism on another thread.147 // We can check m_hrtfDatabaseLoader->isLoaded() to find out whether or not it has been fully loaded.148 // It's not that useful to have a callback function for this since the audio thread automatically starts rendering on the graph149 // when this has finished (see AudioDestinationNode).150 m_hrtfDatabaseLoader = HRTFDatabaseLoader::createAndLoadAsynchronouslyIfNecessary(sampleRate());151 145 } 152 146 … … 168 162 constructCommon(); 169 163 170 // FIXME: the passed in sampleRate MUST match the hardware sample-rate since HRTFDatabaseLoader is a singleton.171 m_hrtfDatabaseLoader = HRTFDatabaseLoader::createAndLoadAsynchronouslyIfNecessary(sampleRate);172 173 164 // Create a new destination for offline rendering. 174 165 m_renderTarget = AudioBuffer::create(numberOfChannels, numberOfFrames, sampleRate); … … 289 280 } 290 281 291 bool AudioContext::isRunnable() const292 {293 if (!isInitialized())294 return false;295 296 // Check with the HRTF spatialization system to see if it's finished loading.297 return m_hrtfDatabaseLoader->isLoaded();298 }299 300 282 void AudioContext::stopDispatch(void* userData) 301 283 { -
trunk/Source/WebCore/Modules/webaudio/AudioContext.h
r162777 r176259 87 87 88 88 bool isOfflineContext() { return m_isOfflineContext; } 89 90 // Returns true when initialize() was called AND all asynchronous initialization has completed.91 bool isRunnable() const;92 93 HRTFDatabaseLoader* hrtfDatabaseLoader() const { return m_hrtfDatabaseLoader.get(); }94 89 95 90 // Document notification … … 344 339 // Only accessed in the audio thread. 345 340 Vector<AudioNode*> m_deferredFinishDerefList; 346 347 // HRTF Database loader348 RefPtr<HRTFDatabaseLoader> m_hrtfDatabaseLoader;349 341 350 342 // EventTarget -
trunk/Source/WebCore/Modules/webaudio/AudioDestinationNode.cpp
r162368 r176259 60 60 context()->setAudioThread(currentThread()); 61 61 62 if (!context()->is Runnable()) {62 if (!context()->isInitialized()) { 63 63 destinationBus->zero(); 64 64 return; -
trunk/Source/WebCore/Modules/webaudio/OfflineAudioDestinationNode.cpp
r157971 r176259 102 102 if (!m_renderBus.get()) 103 103 return; 104 104 105 bool isAudioContextInitialized = context()->isInitialized(); 106 ASSERT(isAudioContextInitialized); 107 if (!isAudioContextInitialized) 108 return; 109 105 110 bool channelsMatch = m_renderBus->numberOfChannels() == m_renderTarget->numberOfChannels(); 106 111 ASSERT(channelsMatch); … … 112 117 if (!isRenderBusAllocated) 113 118 return; 114 115 // Synchronize with HRTFDatabaseLoader.116 // The database must be loaded before we can proceed.117 HRTFDatabaseLoader* loader = context()->hrtfDatabaseLoader();118 ASSERT(loader);119 if (!loader)120 return;121 122 loader->waitForLoaderThreadCompletion();123 119 124 120 // Break up the render target into smaller "render quantize" sized pieces. -
trunk/Source/WebCore/Modules/webaudio/PannerNode.cpp
r163568 r176259 53 53 , m_connectionCount(0) 54 54 { 55 // Load the HRTF database asynchronously so we don't block the Javascript thread while creating the HRTF database. 56 m_hrtfDatabaseLoader = HRTFDatabaseLoader::createAndLoadAsynchronouslyIfNecessary(context->sampleRate()); 57 55 58 addInput(std::make_unique<AudioNodeInput>(this)); 56 59 addOutput(std::make_unique<AudioNodeOutput>(this, 2)); … … 102 105 103 106 AudioBus* source = input(0)->bus(); 104 105 107 if (!source) { 106 108 destination->zero(); 107 109 return; 110 } 111 112 // HRTFDatabase should be loaded before proceeding for offline audio context when panningModel() is "HRTF". 113 if (panningModel() == "HRTF" && !m_hrtfDatabaseLoader->isLoaded()) { 114 if (context()->isOfflineContext()) 115 m_hrtfDatabaseLoader->waitForLoaderThreadCompletion(); 116 else { 117 destination->zero(); 118 return; 119 } 108 120 } 109 121 … … 145 157 return; 146 158 147 m_panner = Panner::create(m_panningModel, sampleRate(), context()->hrtfDatabaseLoader());159 m_panner = Panner::create(m_panningModel, sampleRate(), m_hrtfDatabaseLoader.get()); 148 160 149 161 AudioNode::initialize(); … … 200 212 std::lock_guard<std::mutex> lock(m_pannerMutex); 201 213 202 m_panner = Panner::create(model, sampleRate(), context()->hrtfDatabaseLoader());214 m_panner = Panner::create(model, sampleRate(), m_hrtfDatabaseLoader.get()); 203 215 m_panningModel = model; 204 216 } -
trunk/Source/WebCore/Modules/webaudio/PannerNode.h
r162368 r176259 33 33 #include "Distance.h" 34 34 #include "FloatPoint3D.h" 35 #include "HRTFDatabaseLoader.h" 35 36 #include "Panner.h" 36 37 #include <memory> … … 155 156 float m_lastGain; 156 157 158 // HRTF Database loader 159 RefPtr<HRTFDatabaseLoader> m_hrtfDatabaseLoader; 160 157 161 unsigned m_connectionCount; 158 162 -
trunk/Source/WebCore/Modules/webaudio/RealtimeAnalyser.cpp
r172816 r176259 31 31 #include "AudioBus.h" 32 32 #include "AudioUtilities.h" 33 #include "FFTFrame.h"34 33 #include "VectorMath.h" 35 34 #include <algorithm> -
trunk/Source/WebCore/Modules/webaudio/RealtimeAnalyser.h
r162368 r176259 27 27 28 28 #include "AudioArray.h" 29 #include "FFTFrame.h" 29 30 #include <memory> 30 31 #include <runtime/Float32Array.h> … … 36 37 37 38 class AudioBus; 38 class FFTFrame;39 39 40 40 class RealtimeAnalyser { -
trunk/Source/WebCore/platform/audio/HRTFDatabaseLoader.cpp
r165676 r176259 50 50 ASSERT(isMainThread()); 51 51 52 RefPtr<HRTFDatabaseLoader> loader; 53 54 loader = loaderMap().get(sampleRate); 52 RefPtr<HRTFDatabaseLoader> loader = loaderMap().get(sampleRate); 55 53 if (loader) { 56 54 ASSERT(sampleRate == loader->databaseSampleRate());
Note: See TracChangeset
for help on using the changeset viewer.