Changeset 251356 in webkit


Ignore:
Timestamp:
Oct 20, 2019 5:44:32 PM (5 years ago)
Author:
bshafiei@apple.com
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

Location:
branches/safari-608-branch/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-608-branch/Source/WebCore/ChangeLog

    r251353 r251356  
     12019-10-20  Babak Shafiei  <bshafiei@apple.com>
     2
     3        Cherry-pick r251188. rdar://problem/56340816
     4
     5    WebAudioSourceProviderAVFObjC::provideInput should set its WebAudioBufferList parameters correctly
     6    https://bugs.webkit.org/show_bug.cgi?id=202930
     7    <rdar://problem/56006776>
     8   
     9    Reviewed by Eric Carlson.
     10   
     11    Source/WebCore:
     12   
     13    There is a time where the bus channel number and audio source channel numbers may be different.
     14    In case the bus channel number is less than the audio source channel number, initialization of
     15    the WebAudioBufferList might not be fully done.
     16    In that case, output silence and return early.
     17    Reduce the number of frames to process based on the number of frames the output audio bus plans to process.
     18   
     19    Partially covered by new API test (this a race so we cannot reproduce the crash easily).
     20   
     21    * Modules/webaudio/MediaStreamAudioSourceNode.cpp:
     22    (WebCore::MediaStreamAudioSourceNode::process):
     23    Make sure to process the number of frames the output bus expect.
     24    * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm:
     25    (WebCore::WebAudioSourceProviderAVFObjC::provideInput):
     26   
     27    Tools:
     28   
     29    Add a test that has an audio track that goes from 1 to 2 channels while being piped to a WebAudio pipeline.
     30   
     31    * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
     32    * TestWebKitAPI/Tests/WebKit/GetUserMedia.mm:
     33    (-[GUMMessageHandler userContentController:didReceiveScriptMessage:]):
     34    (TestWebKitAPI::TEST):
     35    * TestWebKitAPI/Tests/WebKit/getUserMedia-webaudio.html: Added.
     36   
     37    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@251188 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     38
     39    2019-10-16  Youenn Fablet  <youenn@apple.com>
     40
     41            WebAudioSourceProviderAVFObjC::provideInput should set its WebAudioBufferList parameters correctly
     42            https://bugs.webkit.org/show_bug.cgi?id=202930
     43            <rdar://problem/56006776>
     44
     45            Reviewed by Eric Carlson.
     46
     47            There is a time where the bus channel number and audio source channel numbers may be different.
     48            In case the bus channel number is less than the audio source channel number, initialization of
     49            the WebAudioBufferList might not be fully done.
     50            In that case, output silence and return early.
     51            Reduce the number of frames to process based on the number of frames the output audio bus plans to process.
     52
     53            Partially covered by new API test (this a race so we cannot reproduce the crash easily).
     54
     55            * Modules/webaudio/MediaStreamAudioSourceNode.cpp:
     56            (WebCore::MediaStreamAudioSourceNode::process):
     57            Make sure to process the number of frames the output bus expect.
     58            * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm:
     59            (WebCore::WebAudioSourceProviderAVFObjC::provideInput):
     60
    1612019-10-20  Babak Shafiei  <bshafiei@apple.com>
    262
  • branches/safari-608-branch/Source/WebCore/Modules/webaudio/MediaStreamAudioSourceNode.cpp

    r248090 r251356  
    132132    }
    133133
     134    if (numberOfFrames > outputBus->length())
     135        numberOfFrames = outputBus->length();
     136
    134137    if (m_multiChannelResampler.get()) {
    135138        ASSERT(m_sourceSampleRate != sampleRate());
  • branches/safari-608-branch/Source/WebCore/platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm

    r239427 r251356  
    8080
    8181    WebAudioBufferList list { m_outputDescription.value() };
     82    if (bus->numberOfChannels() < list.bufferCount()) {
     83        bus->zero();
     84        return;
     85    }
     86
    8287    for (unsigned i = 0; i < bus->numberOfChannels(); ++i) {
    83         AudioChannel& channel = *bus->channel(i);
     88        auto& channel = *bus->channel(i);
    8489        if (i >= list.bufferCount()) {
    8590            channel.zero();
     
    9297    }
    9398
     99    ASSERT(framesToProcess <= bus->length());
    94100    m_dataSource->pullSamples(*list.list(), framesToProcess, m_readCount, 0, AudioSampleDataSource::Copy);
    95101    m_readCount += framesToProcess;
Note: See TracChangeset for help on using the changeset viewer.