SIGN IN SIGN UP

REGRESSION(316360@main):[macOS] fast/mediastream/microphone-interruption-and-audio-session.html is a constant TEXT failure

rdar://181852376
https://bugs.webkit.org/show_bug.cgi?id=319003

Reviewed by Jer Noble.

Like we are exiting early in BaseAudioCaptureUnit::resume if not suspended,we also exit early in BaseAudioCaptureUnit::suspend if already suspended.
This ensures that we would not reset the canResumeAdterInterruption flag back to false in case of two suspends
This is a speculative fix as I was not able to reproduce.

As a fly-by fix, we no longer set m_producingCount to 0 in suspend/captureFailed since m_producingCount is also updated asynchronously in BaseAudioCaptureUnit::stopProducingData, and this can trigger a DEBUG assert in BaseAudioCaptureUnit::stopProducingData. This was sometimes triggered when running LayoutTests/fast/mediastream/microphone-change-while-muted.html, which runs just before LayoutTests/fast/mediastream/microphone-interruption-and-audio-session.html.

* Source/WebCore/platform/mediastream/cocoa/BaseAudioCaptureUnit.cpp:
(WebCore::BaseAudioCaptureUnit::captureFailed):
(WebCore::BaseAudioCaptureUnit::resume):
(WebCore::BaseAudioCaptureUnit::suspend):
* Source/WebCore/platform/mediastream/cocoa/CoreAudioCaptureSource.cpp:
(WebCore::CoreAudioCaptureSource::stopProducingData):
* Source/WebCore/platform/mediastream/cocoa/CoreAudioCaptureSource.h:
(WebCore::CoreAudioCaptureSource::setCanResumeAfterInterruption):

Canonical link: https://commits.webkit.org/317299@main
Y
Youenn Fablet committed
a450ebfaf60acf22583f90cddc23e407578f40cd
Parent: ae0687b
Committed by Youenn Fablet <youennf@gmail.com> on 7/16/2026, 8:16:31 AM