Recreate the AudioUnit when restarting capture
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 Jul 2017 00:03:37 +0000 (00:03 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 Jul 2017 00:03:37 +0000 (00:03 +0000)
commita4df6b3941fa9aa95006ed2c823d09cde541eb3c
treee91cf5eb253b39c996f8a7476a467ccd0703abb4
parent57fe3013ade14acfbe8c22fdb15fc6ea5418a9f9
Recreate the AudioUnit when restarting capture
https://bugs.webkit.org/show_bug.cgi?id=174439

Patch by Youenn Fablet <youenn@apple.com> on 2017-07-12
Reviewed by Jer Noble.

Sometimes other applications in the system like FaceTime may make the audio unit not functional.
Reloading the tab capturing audio will trigger a call to stop the audio shared unit.
When the tab requests again audio, the shared unit will restart.
At that time, the AudioUnit shared unit will be fully recreated.

Manually tested by doing a webrtc call and then doing a FaceTime call.
Remote WebRTC endpoints may not receive any audio.
With the patch, reloading the web page will get back the audio.
Previously, restarting the UIProcess was the only way.

* platform/mediastream/mac/CoreAudioCaptureSource.cpp:
(WebCore::CoreAudioSharedUnit::startProducingData): Cleaning the audio unit when starting to produce data if there is a preexisting audio unit.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@219435 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.cpp