RESOLVED FIXED171711
RELEASE_ASSERT at WebAudioSourceProviderAVFObjC::provideInput()
https://bugs.webkit.org/show_bug.cgi?id=171711
Summary RELEASE_ASSERT at WebAudioSourceProviderAVFObjC::provideInput()
Jer Noble
Reported 2017-05-04 20:56:12 PDT
RELEASE_ASSERT at WebAudioSourceProviderAVFObjC::provideInput()
Attachments
Patch (2.58 KB, patch)
2017-05-04 20:59 PDT, Jer Noble
no flags
Patch (2.68 KB, patch)
2017-05-10 14:03 PDT, Jer Noble
no flags
Patch for landing (2.74 KB, patch)
2017-05-10 14:21 PDT, Jer Noble
no flags
Patch for landing (2.71 KB, patch)
2017-05-10 18:11 PDT, Jer Noble
no flags
Jer Noble
Comment 1 2017-05-04 20:59:32 PDT
Jer Noble
Comment 2 2017-05-04 20:59:52 PDT
youenn fablet
Comment 3 2017-05-04 23:36:31 PDT
Comment on attachment 309140 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=309140&action=review > Source/WebCore/ChangeLog:10 > + format of WebAudioSourceProviderAVFObjC, notify the MediaStreamAudioSourceNode that the number of The last sentence is mssing a verb. > Source/WebCore/platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm:83 > + unsigned channelCount = std::min(list.bufferCount(), bus->numberOfChannels()); I do not clearly understand why the outputDescription is different from the input in terms of number of channels. Is it the case that they are different sometimes or could it stay like this for multiple calls? If it is something that can stay stable, could we enforce them to be equal in some ways? Maybe worth beefing up the change log if I am not missing something obvious. > Source/WebCore/platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm:142 > + m_client->setFormat(numberOfChannels, sampleRate); Why do we always need to call setFormat both synchronously and asynchronously? > Source/WebCore/platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm:145 > callOnMainThread([protectedThis = WTFMove(protectedThis), numberOfChannels, sampleRate] { If we are to touch this code, we could modernize it by using makeRef and removing protectedThis definition.
Jer Noble
Comment 4 2017-05-10 14:03:00 PDT
Comment on attachment 309140 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=309140&action=review >> Source/WebCore/ChangeLog:10 >> + format of WebAudioSourceProviderAVFObjC, notify the MediaStreamAudioSourceNode that the number of > > The last sentence is mssing a verb. Changed. >> Source/WebCore/platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm:83 >> + unsigned channelCount = std::min(list.bufferCount(), bus->numberOfChannels()); > > I do not clearly understand why the outputDescription is different from the input in terms of number of channels. > Is it the case that they are different sometimes or could it stay like this for multiple calls? > If it is something that can stay stable, could we enforce them to be equal in some ways? > Maybe worth beefing up the change log if I am not missing something obvious. In practice, it may never be. But since we are writing data to a variable length structure, we should guarantee that we never iterate over the end of it, and this is a cheap way of doing so. >> Source/WebCore/platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm:142 >> + m_client->setFormat(numberOfChannels, sampleRate); > > Why do we always need to call setFormat both synchronously and asynchronously? Calling synchronously means we're holding our own lock, so we don't need to worry about making changes out from underneath provideInput() in another thread. MediaElementAudioSourceNode has its own lock it uses to synchronize against the main thread, so calling setFormat() on a background thread should be safe here. I'll remove the async call below. >> Source/WebCore/platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm:145 >> callOnMainThread([protectedThis = WTFMove(protectedThis), numberOfChannels, sampleRate] { > > If we are to touch this code, we could modernize it by using makeRef and removing protectedThis definition. Ok.
Jer Noble
Comment 5 2017-05-10 14:03:45 PDT
youenn fablet
Comment 6 2017-05-10 14:08:54 PDT
> >> Source/WebCore/platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm:83 > >> + unsigned channelCount = std::min(list.bufferCount(), bus->numberOfChannels()); > > > > I do not clearly understand why the outputDescription is different from the input in terms of number of channels. > > Is it the case that they are different sometimes or could it stay like this for multiple calls? > > If it is something that can stay stable, could we enforce them to be equal in some ways? > > Maybe worth beefing up the change log if I am not missing something obvious. > > In practice, it may never be. But since we are writing data to a variable > length structure, we should guarantee that we never iterate over the end of > it, and this is a cheap way of doing so. OK, maybe add a debug assert then?
Jer Noble
Comment 7 2017-05-10 14:21:23 PDT
Created attachment 309634 [details] Patch for landing
WebKit Commit Bot
Comment 8 2017-05-10 15:03:18 PDT
Comment on attachment 309634 [details] Patch for landing Clearing flags on attachment: 309634 Committed r216630: <http://trac.webkit.org/changeset/216630>
WebKit Commit Bot
Comment 9 2017-05-10 15:03:20 PDT
All reviewed patches have been landed. Closing bug.
Ryan Haddad
Comment 10 2017-05-10 17:29:12 PDT
Ryan Haddad
Comment 11 2017-05-10 17:33:01 PDT
Reverted r216630 for reason: This change caused assertion failures with webrtc LayoutTests. Committed r216642: <http://trac.webkit.org/changeset/216642>
Jer Noble
Comment 12 2017-05-10 17:56:31 PDT
(In reply to Ryan Haddad from comment #11) > Reverted r216630 for reason: > > This change caused assertion failures with webrtc LayoutTests. > > Committed r216642: <http://trac.webkit.org/changeset/216642> Looks like two ASSERTs are happening: 1) AudioContext doesn't like to be reconfigured off the main thread; their lock is explicitly main thread only. 2) The RealtimeAudioInputSource isn't calling prepare() on its audio provider, which leads to a mismatch in the channel count between the provider and the audio node. I'll post a new patch.
Jer Noble
Comment 13 2017-05-10 18:03:04 PDT
(In reply to Jer Noble from comment #12) > (In reply to Ryan Haddad from comment #11) > > Reverted r216630 for reason: > > > > This change caused assertion failures with webrtc LayoutTests. > > > > Committed r216642: <http://trac.webkit.org/changeset/216642> > > Looks like two ASSERTs are happening: > > 1) AudioContext doesn't like to be reconfigured off the main thread; their > lock is explicitly main thread only. > > 2) The RealtimeAudioInputSource isn't calling prepare() on its audio > provider, which leads to a mismatch in the channel count between the > provider and the audio node. Correction, after the change to fix 1), 2) is not called before we start getting asked for samples. > I'll post a new patch.
Jer Noble
Comment 14 2017-05-10 18:11:10 PDT
Created attachment 309668 [details] Patch for landing
WebKit Commit Bot
Comment 15 2017-05-10 18:51:40 PDT
Comment on attachment 309668 [details] Patch for landing Clearing flags on attachment: 309668 Committed r216645: <http://trac.webkit.org/changeset/216645>
WebKit Commit Bot
Comment 16 2017-05-10 18:51:41 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.