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

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

Issue 12478015: Merge 143565 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1410/
Patch Set: Created 7 years, 9 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/ChannelMergerNode.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/ChannelMergerNode.cpp
===================================================================
--- Source/WebCore/Modules/webaudio/ChannelMergerNode.cpp (revision 146256)
+++ Source/WebCore/Modules/webaudio/ChannelMergerNode.cpp (working copy)
@@ -36,6 +36,8 @@
#include "AudioNodeInput.h"
#include "AudioNodeOutput.h"
+const unsigned DefaultNumberOfOutputChannels = 1;
+
namespace WebCore {
PassRefPtr<ChannelMergerNode> ChannelMergerNode::create(AudioContext* context, float sampleRate, unsigned numberOfInputs)
@@ -48,6 +50,7 @@
ChannelMergerNode::ChannelMergerNode(AudioContext* context, float sampleRate, unsigned numberOfInputs)
: AudioNode(context, sampleRate)
+ , m_desiredNumberOfOutputChannels(DefaultNumberOfOutputChannels)
{
// Create the requested number of inputs.
for (unsigned i = 0; i < numberOfInputs; ++i)
@@ -64,7 +67,13 @@
{
AudioNodeOutput* output = this->output(0);
ASSERT(output);
- ASSERT_UNUSED(framesToProcess, framesToProcess == output->bus()->length());
+ ASSERT_UNUSED(framesToProcess, framesToProcess == output->bus()->length());
+
+ // Output bus not updated yet, so just output silence.
+ if (m_desiredNumberOfOutputChannels != output->numberOfChannels()) {
+ output->bus()->zero();
+ return;
+ }
// Merge all the channels from all the inputs into one output.
unsigned outputChannelIndex = 0;
@@ -109,6 +118,10 @@
AudioNodeOutput* output = this->output(0);
ASSERT(output);
output->setNumberOfChannels(numberOfOutputChannels);
+ // There can in rare cases be a slight delay before the output bus is updated to the new number of
+ // channels because of tryLocks() in the context's updating system. So record the new number of
+ // output channels here.
+ m_desiredNumberOfOutputChannels = numberOfOutputChannels;
AudioNode::checkNumberOfChannelsForInput(input);
}
« no previous file with comments | « Source/WebCore/Modules/webaudio/ChannelMergerNode.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698