Title: [214505] trunk/Source/WebCore
- Revision
- 214505
- Author
- [email protected]
- Date
- 2017-03-28 16:12:45 -0700 (Tue, 28 Mar 2017)
Log Message
Audio indicator is visible on uni-watch.com but there is no audible audio
https://bugs.webkit.org/show_bug.cgi?id=170200
<rdar://problem/31289132>
Reviewed by Eric Carlson.
Cherry-pick the following patch from Blink by <[email protected]>:
- https://chromium.googlesource.com/chromium/src.git/+/439de5bb2a31384666db1a0e2dadb2b97d2f3ce4
When the gain of a GainNode is 0 or 1, the operation of the node can
be optimized. When gain = 1, just copy the input to the output. When
gain = 0; just zero out the output. Currently, the input is
multiplied by the gain to produce the output. This just optimizes the
multiplication away for the two special cases.
Also, have the GainNode set the silence hint if the gain is 0.
And fix a bug in processIfNecessary when unsilenceOutputs was causing the
silence hint to be cleared after the node's process method was finished
and may have set the silence hint. The processing should come after
unsilenceOutputs to preserve any hints from processing the node.
* Modules/webaudio/AudioNode.cpp:
(WebCore::AudioNode::processIfNecessary):
* Modules/webaudio/GainNode.cpp:
(WebCore::GainNode::process):
* platform/audio/AudioBus.cpp:
(WebCore::AudioBus::copyWithGainFrom):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (214504 => 214505)
--- trunk/Source/WebCore/ChangeLog 2017-03-28 23:12:11 UTC (rev 214504)
+++ trunk/Source/WebCore/ChangeLog 2017-03-28 23:12:45 UTC (rev 214505)
@@ -1,5 +1,36 @@
2017-03-28 Chris Dumez <[email protected]>
+ Audio indicator is visible on uni-watch.com but there is no audible audio
+ https://bugs.webkit.org/show_bug.cgi?id=170200
+ <rdar://problem/31289132>
+
+ Reviewed by Eric Carlson.
+
+ Cherry-pick the following patch from Blink by <[email protected]>:
+ - https://chromium.googlesource.com/chromium/src.git/+/439de5bb2a31384666db1a0e2dadb2b97d2f3ce4
+
+ When the gain of a GainNode is 0 or 1, the operation of the node can
+ be optimized. When gain = 1, just copy the input to the output. When
+ gain = 0; just zero out the output. Currently, the input is
+ multiplied by the gain to produce the output. This just optimizes the
+ multiplication away for the two special cases.
+
+ Also, have the GainNode set the silence hint if the gain is 0.
+
+ And fix a bug in processIfNecessary when unsilenceOutputs was causing the
+ silence hint to be cleared after the node's process method was finished
+ and may have set the silence hint. The processing should come after
+ unsilenceOutputs to preserve any hints from processing the node.
+
+ * Modules/webaudio/AudioNode.cpp:
+ (WebCore::AudioNode::processIfNecessary):
+ * Modules/webaudio/GainNode.cpp:
+ (WebCore::GainNode::process):
+ * platform/audio/AudioBus.cpp:
+ (WebCore::AudioBus::copyWithGainFrom):
+
+2017-03-28 Chris Dumez <[email protected]>
+
Animated SVG images are not paused when outside viewport
https://bugs.webkit.org/show_bug.cgi?id=170155
<rdar://problem/31288893>
Modified: trunk/Source/WebCore/Modules/webaudio/AudioNode.cpp (214504 => 214505)
--- trunk/Source/WebCore/Modules/webaudio/AudioNode.cpp 2017-03-28 23:12:11 UTC (rev 214504)
+++ trunk/Source/WebCore/Modules/webaudio/AudioNode.cpp 2017-03-28 23:12:45 UTC (rev 214505)
@@ -305,8 +305,11 @@
if (silentInputs && propagatesSilence())
silenceOutputs();
else {
+ // Unsilence the outputs first because the processing of the node may cause the outputs
+ // to go silent and we want to propagate that hint to the downstream nodes! (For
+ // example, a Gain node with a gain of 0 will want to silence its output.)
+ unsilenceOutputs();
process(framesToProcess);
- unsilenceOutputs();
}
}
}
Modified: trunk/Source/WebCore/Modules/webaudio/GainNode.cpp (214504 => 214505)
--- trunk/Source/WebCore/Modules/webaudio/GainNode.cpp 2017-03-28 23:12:11 UTC (rev 214504)
+++ trunk/Source/WebCore/Modules/webaudio/GainNode.cpp 2017-03-28 23:12:45 UTC (rev 214505)
@@ -73,7 +73,12 @@
}
} else {
// Apply the gain with de-zippering into the output bus.
- outputBus->copyWithGainFrom(*inputBus, &m_lastGain, gain()->value());
+ if (!m_lastGain && m_lastGain == m_gain->value()) {
+ // If the gain is 0 (and we've converged on dezippering), just zero the bus and set
+ // the silence hint.
+ outputBus->zero();
+ } else
+ outputBus->copyWithGainFrom(*inputBus, &m_lastGain, gain()->value());
}
}
}
Modified: trunk/Source/WebCore/platform/audio/AudioBus.cpp (214504 => 214505)
--- trunk/Source/WebCore/platform/audio/AudioBus.cpp 2017-03-28 23:12:11 UTC (rev 214504)
+++ trunk/Source/WebCore/platform/audio/AudioBus.cpp 2017-03-28 23:12:45 UTC (rev 214505)
@@ -511,8 +511,17 @@
// Apply constant gain after de-zippering has converged on target gain.
if (framesToDezipper < framesToProcess) {
- for (unsigned channelIndex = 0; channelIndex < numberOfChannels; ++channelIndex)
- vsmul(sources[channelIndex], 1, &gain, destinations[channelIndex], 1, framesToProcess - framesToDezipper);
+ // Handle gains of 0 and 1 (exactly) specially.
+ if (gain == 1) {
+ for (unsigned channelIndex = 0; channelIndex < numberOfChannels; ++channelIndex)
+ memcpy(destinations[channelIndex], sources[channelIndex], (framesToProcess - framesToDezipper) * sizeof(*destinations[channelIndex]));
+ } else if (!gain) {
+ for (unsigned channelIndex = 0; channelIndex < numberOfChannels; ++channelIndex)
+ memset(destinations[channelIndex], 0, (framesToProcess - framesToDezipper) * sizeof(*destinations[channelIndex]));
+ } else {
+ for (unsigned channelIndex = 0; channelIndex < numberOfChannels; ++channelIndex)
+ vsmul(sources[channelIndex], 1, &gain, destinations[channelIndex], 1, framesToProcess - framesToDezipper);
+ }
}
// Save the target gain as the starting point for next time around.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes