Index: third_party/WebKit/Source/modules/webaudio/AnalyserNode.cpp |
diff --git a/third_party/WebKit/Source/modules/webaudio/AnalyserNode.cpp b/third_party/WebKit/Source/modules/webaudio/AnalyserNode.cpp |
index 8076910c8a384269d1cd837c34308fd4035ff0f2..45f9ce26d8cbf67a051799bc48a7277a3993e518 100644 |
--- a/third_party/WebKit/Source/modules/webaudio/AnalyserNode.cpp |
+++ b/third_party/WebKit/Source/modules/webaudio/AnalyserNode.cpp |
@@ -50,16 +50,23 @@ AnalyserHandler::~AnalyserHandler() { |
void AnalyserHandler::process(size_t framesToProcess) { |
AudioBus* outputBus = output(0).bus(); |
- if (!isInitialized() || !input(0).isConnected()) { |
+ if (!isInitialized()) { |
outputBus->zero(); |
return; |
} |
+ // Must update the internal state even if there are no inputs. |
hongchan
2017/02/01 01:12:11
Not sure where this comment should be placed.
Raymond Toy
2017/02/01 21:23:47
Would it help to rephrase it? Or just remove it? (
hongchan
2017/02/03 18:47:40
The comment is not really relevant to what's happe
Raymond Toy
2017/02/03 18:50:00
How about:
// Must always update internal state w
|
AudioBus* inputBus = input(0).bus(); |
// Give the analyser the audio which is passing through this AudioNode. |
m_analyser.writeInput(inputBus, framesToProcess); |
+ if (!input(0).isConnected()) { |
+ // No inputs, so clear the output, and propagate the silence hint. |
+ outputBus->zero(); |
+ return; |
+ } |
+ |
// For in-place processing, our override of pullInputs() will just pass the |
// audio data through unchanged if the channel count matches from input to |
// output (resulting in inputBus == outputBus). Otherwise, do an up-mix to |