Skip to content

Commit 6dc59ac

Browse files
youennfphiln
authored andcommitted
webrtc/datachannel/multiple-connections.html is sometimes timing out after M120 upgrade
https://bugs.webkit.org/show_bug.cgi?id=267281 rdar://problem/120725671 Reviewed by Eric Carlson. We were sometimes deadlocking when: - main thread asks something to the webrtc stack by hopping to the signalling thread. - signaling thread is destroying the LibWebRTCAudioModule which was calling callOnMainThreadAndWait to do its cleanup. Instead of cleaning things in LibWebRTCAudioModule destructor synchronsouly, we are doing the clean-up asynchronously in LibWebRTCAudioModule::Terminate. Setting m_logTimer to nullptr there is fine since m_logTimer is used in Start/Stop via callOnMainThread. * Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCAudioModule.cpp: (WebCore::LibWebRTCAudioModule::~LibWebRTCAudioModule): (WebCore::LibWebRTCAudioModule::Terminate): * Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCAudioModule.h: Canonical link: https://commits.webkit.org/272828@main
1 parent f0148ee commit 6dc59ac

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCAudioModule.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,15 @@ LibWebRTCAudioModule::LibWebRTCAudioModule()
4747

4848
LibWebRTCAudioModule::~LibWebRTCAudioModule()
4949
{
50-
callOnMainThreadAndWait([&] {
50+
ASSERT(!m_logTimer);
51+
}
52+
53+
int32_t LibWebRTCAudioModule::Terminate()
54+
{
55+
callOnMainThread([this, protectedThis = rtc::scoped_refptr<webrtc::AudioDeviceModule>(this)] {
5156
m_logTimer = nullptr;
5257
});
58+
return 0;
5359
}
5460

5561
int32_t LibWebRTCAudioModule::RegisterAudioCallback(webrtc::AudioTransport* audioTransport)

Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCAudioModule.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class LibWebRTCAudioModule : public webrtc::AudioDeviceModule {
7777

7878
int32_t ActiveAudioLayer(AudioLayer*) const final { return shouldNotBeCalled(-1); }
7979
int32_t Init() final { return 0; }
80-
int32_t Terminate() final { return 0; }
80+
int32_t Terminate() final;
8181
bool Initialized() const final { return true; }
8282
int16_t PlayoutDevices() final { return 0; }
8383
int16_t RecordingDevices() final { return 0; }

0 commit comments

Comments
 (0)