Title: [267530] trunk/Source/WebCore
- Revision
- 267530
- Author
- [email protected]
- Date
- 2020-09-24 08:11:31 -0700 (Thu, 24 Sep 2020)
Log Message
Regression(r265280) Web Audio sources malfunction when disconnected from the audio graph
https://bugs.webkit.org/show_bug.cgi?id=216703
<rdar://problem/69158436>
Reviewed by Eric Carlson.
In case of an audio source that stops producing data, but does not end or mute the track,
we would continuously try to read the data until getting to the end of the data.
When reaching the end of the data, we would return silence and go back in time a little bit
to restart playing with some margin. This allows to read just one chunk of audio until we are back to the end of data.
We fix this by storing the end of the data counter when reaching it.
When trying to pull some more data, we will go back in time a little bit only if some more data was added in the meantime.
Otherwise, we just output silence.
Covered by manual test.
* platform/audio/mac/AudioSampleDataSource.h:
* platform/audio/mac/AudioSampleDataSource.mm:
(WebCore::AudioSampleDataSource::pullSamplesInternal):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (267529 => 267530)
--- trunk/Source/WebCore/ChangeLog 2020-09-24 14:17:22 UTC (rev 267529)
+++ trunk/Source/WebCore/ChangeLog 2020-09-24 15:11:31 UTC (rev 267530)
@@ -1,3 +1,26 @@
+2020-09-24 Youenn Fablet <[email protected]>
+
+ Regression(r265280) Web Audio sources malfunction when disconnected from the audio graph
+ https://bugs.webkit.org/show_bug.cgi?id=216703
+ <rdar://problem/69158436>
+
+ Reviewed by Eric Carlson.
+
+ In case of an audio source that stops producing data, but does not end or mute the track,
+ we would continuously try to read the data until getting to the end of the data.
+ When reaching the end of the data, we would return silence and go back in time a little bit
+ to restart playing with some margin. This allows to read just one chunk of audio until we are back to the end of data.
+
+ We fix this by storing the end of the data counter when reaching it.
+ When trying to pull some more data, we will go back in time a little bit only if some more data was added in the meantime.
+ Otherwise, we just output silence.
+
+ Covered by manual test.
+
+ * platform/audio/mac/AudioSampleDataSource.h:
+ * platform/audio/mac/AudioSampleDataSource.mm:
+ (WebCore::AudioSampleDataSource::pullSamplesInternal):
+
2020-09-24 Antti Koivisto <[email protected]>
currentColor isn't recalculated when a text node doesn't exist
Modified: trunk/Source/WebCore/platform/audio/mac/AudioSampleDataSource.h (267529 => 267530)
--- trunk/Source/WebCore/platform/audio/mac/AudioSampleDataSource.h 2020-09-24 14:17:22 UTC (rev 267529)
+++ trunk/Source/WebCore/platform/audio/mac/AudioSampleDataSource.h 2020-09-24 15:11:31 UTC (rev 267530)
@@ -114,6 +114,7 @@
float m_volume { 1.0 };
bool m_muted { false };
bool m_shouldComputeOutputSampleOffset { true };
+ uint64_t m_endFrameWhenNotEnoughData { 0 };
#if !RELEASE_LOG_DISABLED
Ref<const Logger> m_logger;
Modified: trunk/Source/WebCore/platform/audio/mac/AudioSampleDataSource.mm (267529 => 267530)
--- trunk/Source/WebCore/platform/audio/mac/AudioSampleDataSource.mm 2020-09-24 14:17:22 UTC (rev 267529)
+++ trunk/Source/WebCore/platform/audio/mac/AudioSampleDataSource.mm 2020-09-24 15:11:31 UTC (rev 267530)
@@ -232,7 +232,7 @@
if (m_shouldComputeOutputSampleOffset) {
uint64_t buffered = endFrame - startFrame;
- if (buffered < sampleCount * 2) {
+ if (buffered < sampleCount * 2 || (m_endFrameWhenNotEnoughData && m_endFrameWhenNotEnoughData == endFrame)) {
AudioSampleBufferList::zeroABL(buffer, byteCount);
sampleCount = 0;
return false;
@@ -239,6 +239,7 @@
}
m_shouldComputeOutputSampleOffset = false;
+ m_endFrameWhenNotEnoughData = 0;
m_outputSampleOffset = (endFrame - sampleCount) - timeStamp;
m_outputSampleOffset -= computeOffsetDelay(m_outputDescription->sampleRate(), m_lastPushedSampleCount);
@@ -257,6 +258,9 @@
if (timeStamp < startFrame || timeStamp >= endFrame) {
// We are out of the window, let's restart the offset computation.
m_shouldComputeOutputSampleOffset = true;
+
+ if (timeStamp >= endFrame)
+ m_endFrameWhenNotEnoughData = endFrame;
} else {
// We are too close from endFrame, let's back up a little bit.
uint64_t framesAvailable = endFrame - timeStamp;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes