Diff
Modified: trunk/Source/WebCore/ChangeLog (106419 => 106420)
--- trunk/Source/WebCore/ChangeLog 2012-02-01 01:55:03 UTC (rev 106419)
+++ trunk/Source/WebCore/ChangeLog 2012-02-01 03:04:48 UTC (rev 106420)
@@ -1,3 +1,22 @@
+2012-01-31 Raymond Liu <[email protected]>
+
+ Clean up m_processLock logic in AudioBasicProcessorNode and AudioGainNode
+ https://bugs.webkit.org/show_bug.cgi?id=76772
+
+ Reviewed by Kenneth Russell.
+
+ No new tests required.
+
+ * webaudio/AudioBasicProcessorNode.cpp:
+ (WebCore::AudioBasicProcessorNode::process):
+ (WebCore::AudioBasicProcessorNode::checkNumberOfChannelsForInput):
+ * webaudio/AudioBasicProcessorNode.h:
+ * webaudio/AudioGainNode.cpp:
+ (WebCore::AudioGainNode::process):
+ (WebCore::AudioGainNode::checkNumberOfChannelsForInput):
+ * webaudio/AudioGainNode.h:
+ (AudioGainNode):
+
2012-01-31 Adam Klein <[email protected]>
ProcessingInstruction should not be a ContainerNode
Modified: trunk/Source/WebCore/webaudio/AudioBasicProcessorNode.cpp (106419 => 106420)
--- trunk/Source/WebCore/webaudio/AudioBasicProcessorNode.cpp 2012-02-01 01:55:03 UTC (rev 106419)
+++ trunk/Source/WebCore/webaudio/AudioBasicProcessorNode.cpp 2012-02-01 03:04:48 UTC (rev 106420)
@@ -71,24 +71,16 @@
{
AudioBus* destinationBus = output(0)->bus();
- // The realtime thread can't block on this lock, so we call tryLock() instead.
- if (m_processLock.tryLock()) {
- if (!isInitialized() || !processor())
- destinationBus->zero();
- else {
- AudioBus* sourceBus = input(0)->bus();
+ if (!isInitialized() || !processor())
+ destinationBus->zero();
+ else {
+ AudioBus* sourceBus = input(0)->bus();
- // FIXME: if we take "tail time" into account, then we can avoid calling processor()->process() once the tail dies down.
- if (!input(0)->isConnected())
- sourceBus->zero();
-
- processor()->process(sourceBus, destinationBus, framesToProcess);
- }
+ // FIXME: if we take "tail time" into account, then we can avoid calling processor()->process() once the tail dies down.
+ if (!input(0)->isConnected())
+ sourceBus->zero();
- m_processLock.unlock();
- } else {
- // Too bad - the tryLock() failed. We must be in the middle of re-connecting and were already outputting silence anyway...
- destinationBus->zero();
+ processor()->process(sourceBus, destinationBus, framesToProcess);
}
}
@@ -124,8 +116,6 @@
if (isInitialized() && numberOfChannels != output(0)->numberOfChannels()) {
// We're already initialized but the channel count has changed.
- // We need to be careful since we may be actively processing right now, so synchronize with process().
- MutexLocker locker(m_processLock);
uninitialize();
}
Modified: trunk/Source/WebCore/webaudio/AudioBasicProcessorNode.h (106419 => 106420)
--- trunk/Source/WebCore/webaudio/AudioBasicProcessorNode.h 2012-02-01 01:55:03 UTC (rev 106419)
+++ trunk/Source/WebCore/webaudio/AudioBasicProcessorNode.h 2012-02-01 03:04:48 UTC (rev 106420)
@@ -57,10 +57,6 @@
protected:
AudioProcessor* processor() { return m_processor.get(); }
OwnPtr<AudioProcessor> m_processor;
-
-private:
- // This synchronizes live channel count changes which require an uninitialization / re-initialization.
- mutable Mutex m_processLock;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/webaudio/AudioGainNode.cpp (106419 => 106420)
--- trunk/Source/WebCore/webaudio/AudioGainNode.cpp 2012-02-01 01:55:03 UTC (rev 106419)
+++ trunk/Source/WebCore/webaudio/AudioGainNode.cpp 2012-02-01 03:04:48 UTC (rev 106420)
@@ -59,31 +59,23 @@
AudioBus* outputBus = output(0)->bus();
ASSERT(outputBus);
- // The realtime thread can't block on this lock, so we call tryLock() instead.
- if (m_processLock.tryLock()) {
- if (!isInitialized() || !input(0)->isConnected())
- outputBus->zero();
- else {
- AudioBus* inputBus = input(0)->bus();
+ if (!isInitialized() || !input(0)->isConnected())
+ outputBus->zero();
+ else {
+ AudioBus* inputBus = input(0)->bus();
- if (gain()->hasTimelineValues()) {
- // Apply sample-accurate gain scaling for precise envelopes, grain windows, etc.
- ASSERT(framesToProcess <= m_sampleAccurateGainValues.size());
- if (framesToProcess <= m_sampleAccurateGainValues.size()) {
- float* gainValues = m_sampleAccurateGainValues.data();
- gain()->calculateSampleAccurateValues(gainValues, framesToProcess);
- outputBus->copyWithSampleAccurateGainValuesFrom(*inputBus, gainValues, framesToProcess);
- }
- } else {
- // Apply the gain with de-zippering into the output bus.
- outputBus->copyWithGainFrom(*inputBus, &m_lastGain, gain()->value());
+ if (gain()->hasTimelineValues()) {
+ // Apply sample-accurate gain scaling for precise envelopes, grain windows, etc.
+ ASSERT(framesToProcess <= m_sampleAccurateGainValues.size());
+ if (framesToProcess <= m_sampleAccurateGainValues.size()) {
+ float* gainValues = m_sampleAccurateGainValues.data();
+ gain()->calculateSampleAccurateValues(gainValues, framesToProcess);
+ outputBus->copyWithSampleAccurateGainValuesFrom(*inputBus, gainValues, framesToProcess);
}
+ } else {
+ // Apply the gain with de-zippering into the output bus.
+ outputBus->copyWithGainFrom(*inputBus, &m_lastGain, gain()->value());
}
-
- m_processLock.unlock();
- } else {
- // Too bad - the tryLock() failed. We must be in the middle of re-connecting and were already outputting silence anyway...
- outputBus->zero();
}
}
@@ -100,6 +92,8 @@
// uninitialize and then re-initialize with the new channel count.
void AudioGainNode::checkNumberOfChannelsForInput(AudioNodeInput* input)
{
+ ASSERT(context()->isAudioThread() && context()->isGraphOwner());
+
ASSERT(input && input == this->input(0));
if (input != this->input(0))
return;
@@ -108,8 +102,6 @@
if (isInitialized() && numberOfChannels != output(0)->numberOfChannels()) {
// We're already initialized but the channel count has changed.
- // We need to be careful since we may be actively processing right now, so synchronize with process().
- MutexLocker locker(m_processLock);
uninitialize();
}
Modified: trunk/Source/WebCore/webaudio/AudioGainNode.h (106419 => 106420)
--- trunk/Source/WebCore/webaudio/AudioGainNode.h 2012-02-01 01:55:03 UTC (rev 106419)
+++ trunk/Source/WebCore/webaudio/AudioGainNode.h 2012-02-01 03:04:48 UTC (rev 106420)
@@ -61,10 +61,6 @@
RefPtr<AudioGain> m_gain;
AudioFloatArray m_sampleAccurateGainValues;
-
- // This synchronizes live channel count changes which require an uninitialization / re-initialization.
- // FIXME: this can go away when we implement optimization for mixing with gain directly in summing junction of AudioNodeInput.
- mutable Mutex m_processLock;
};
} // namespace WebCore