Title: [251356] branches/safari-608-branch/Source/WebCore
- Revision
- 251356
- Author
- bshaf...@apple.com
- Date
- 2019-10-20 17:44:32 -0700 (Sun, 20 Oct 2019)
Log Message
Cherry-pick r251188. rdar://problem/56340816
WebAudioSourceProviderAVFObjC::provideInput should set its WebAudioBufferList parameters correctly
https://bugs.webkit.org/show_bug.cgi?id=202930
<rdar://problem/56006776>
Reviewed by Eric Carlson.
Source/WebCore:
There is a time where the bus channel number and audio source channel numbers may be different.
In case the bus channel number is less than the audio source channel number, initialization of
the WebAudioBufferList might not be fully done.
In that case, output silence and return early.
Reduce the number of frames to process based on the number of frames the output audio bus plans to process.
Partially covered by new API test (this a race so we cannot reproduce the crash easily).
* Modules/webaudio/MediaStreamAudioSourceNode.cpp:
(WebCore::MediaStreamAudioSourceNode::process):
Make sure to process the number of frames the output bus expect.
* platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm:
(WebCore::WebAudioSourceProviderAVFObjC::provideInput):
Tools:
Add a test that has an audio track that goes from 1 to 2 channels while being piped to a WebAudio pipeline.
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit/GetUserMedia.mm:
(-[GUMMessageHandler userContentController:didReceiveScriptMessage:]):
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WebKit/getUserMedia-webaudio.html: Added.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@251188 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Modified Paths
Diff
Modified: branches/safari-608-branch/Source/WebCore/ChangeLog (251355 => 251356)
--- branches/safari-608-branch/Source/WebCore/ChangeLog 2019-10-21 00:44:30 UTC (rev 251355)
+++ branches/safari-608-branch/Source/WebCore/ChangeLog 2019-10-21 00:44:32 UTC (rev 251356)
@@ -1,5 +1,65 @@
2019-10-20 Babak Shafiei <bshaf...@apple.com>
+ Cherry-pick r251188. rdar://problem/56340816
+
+ WebAudioSourceProviderAVFObjC::provideInput should set its WebAudioBufferList parameters correctly
+ https://bugs.webkit.org/show_bug.cgi?id=202930
+ <rdar://problem/56006776>
+
+ Reviewed by Eric Carlson.
+
+ Source/WebCore:
+
+ There is a time where the bus channel number and audio source channel numbers may be different.
+ In case the bus channel number is less than the audio source channel number, initialization of
+ the WebAudioBufferList might not be fully done.
+ In that case, output silence and return early.
+ Reduce the number of frames to process based on the number of frames the output audio bus plans to process.
+
+ Partially covered by new API test (this a race so we cannot reproduce the crash easily).
+
+ * Modules/webaudio/MediaStreamAudioSourceNode.cpp:
+ (WebCore::MediaStreamAudioSourceNode::process):
+ Make sure to process the number of frames the output bus expect.
+ * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm:
+ (WebCore::WebAudioSourceProviderAVFObjC::provideInput):
+
+ Tools:
+
+ Add a test that has an audio track that goes from 1 to 2 channels while being piped to a WebAudio pipeline.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/WebKit/GetUserMedia.mm:
+ (-[GUMMessageHandler userContentController:didReceiveScriptMessage:]):
+ (TestWebKitAPI::TEST):
+ * TestWebKitAPI/Tests/WebKit/getUserMedia-webaudio.html: Added.
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@251188 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2019-10-16 Youenn Fablet <you...@apple.com>
+
+ WebAudioSourceProviderAVFObjC::provideInput should set its WebAudioBufferList parameters correctly
+ https://bugs.webkit.org/show_bug.cgi?id=202930
+ <rdar://problem/56006776>
+
+ Reviewed by Eric Carlson.
+
+ There is a time where the bus channel number and audio source channel numbers may be different.
+ In case the bus channel number is less than the audio source channel number, initialization of
+ the WebAudioBufferList might not be fully done.
+ In that case, output silence and return early.
+ Reduce the number of frames to process based on the number of frames the output audio bus plans to process.
+
+ Partially covered by new API test (this a race so we cannot reproduce the crash easily).
+
+ * Modules/webaudio/MediaStreamAudioSourceNode.cpp:
+ (WebCore::MediaStreamAudioSourceNode::process):
+ Make sure to process the number of frames the output bus expect.
+ * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm:
+ (WebCore::WebAudioSourceProviderAVFObjC::provideInput):
+
+2019-10-20 Babak Shafiei <bshaf...@apple.com>
+
Apply patch. rdar://problem/56427498
2019-10-20 John Wilander <wilan...@apple.com>
Modified: branches/safari-608-branch/Source/WebCore/Modules/webaudio/MediaStreamAudioSourceNode.cpp (251355 => 251356)
--- branches/safari-608-branch/Source/WebCore/Modules/webaudio/MediaStreamAudioSourceNode.cpp 2019-10-21 00:44:30 UTC (rev 251355)
+++ branches/safari-608-branch/Source/WebCore/Modules/webaudio/MediaStreamAudioSourceNode.cpp 2019-10-21 00:44:32 UTC (rev 251356)
@@ -131,6 +131,9 @@
return;
}
+ if (numberOfFrames > outputBus->length())
+ numberOfFrames = outputBus->length();
+
if (m_multiChannelResampler.get()) {
ASSERT(m_sourceSampleRate != sampleRate());
m_multiChannelResampler->process(provider, outputBus, numberOfFrames);
Modified: branches/safari-608-branch/Source/WebCore/platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm (251355 => 251356)
--- branches/safari-608-branch/Source/WebCore/platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm 2019-10-21 00:44:30 UTC (rev 251355)
+++ branches/safari-608-branch/Source/WebCore/platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm 2019-10-21 00:44:32 UTC (rev 251356)
@@ -79,8 +79,13 @@
}
WebAudioBufferList list { m_outputDescription.value() };
+ if (bus->numberOfChannels() < list.bufferCount()) {
+ bus->zero();
+ return;
+ }
+
for (unsigned i = 0; i < bus->numberOfChannels(); ++i) {
- AudioChannel& channel = *bus->channel(i);
+ auto& channel = *bus->channel(i);
if (i >= list.bufferCount()) {
channel.zero();
continue;
@@ -91,6 +96,7 @@
buffer->mDataByteSize = channel.length() * sizeof(float);
}
+ ASSERT(framesToProcess <= bus->length());
m_dataSource->pullSamples(*list.list(), framesToProcess, m_readCount, 0, AudioSampleDataSource::Copy);
m_readCount += framesToProcess;
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes