Skip to content

Latest commit

 

History

History
22 lines (18 loc) · 1.27 KB

File metadata and controls

22 lines (18 loc) · 1.27 KB

Campus local patch

Base: flutter_webrtc 0.12.12+hotfix.1 (pub.dev).

Off-platform-thread method handling

-[FlutterWebRTCPlugin handleMethodCall:result:] ran on the platform/main thread, where flutter_webrtc's synchronous WebRTC BlockingCalls ([pc close], RTCMediaStream videoTracks/audioTracks via streamDispose, getStats, …) freeze the macOS UI and reentrantly deadlock during teardown (companion reconnect).

Patch: handleMethodCall is now a thin wrapper that dispatch_async's the whole handler (wcHandleMethodCallImpl) onto a serial background queue (flutter_webrtc.method) and marshals the FlutterResult back to the main thread (the macOS embedder requires it there). Applied to macos/, common/darwin/, ios/. Upstreamable; not yet fixed upstream (HEAD 1.5.x still synchronous).

iOS gating (#if TARGET_OS_OSX). The off-thread hop is macOS-only. On iOS, backgrounding the whole handler aborts (SIGABRT) during initialize — RTCPeerConnectionFactory / RTCDefaultAudioProcessingModule must be created on the main thread there. iOS keeps upstream synchronous-on-platform-thread handling (the reconnect freeze this patch fixes is a macOS desktop-embedder problem; the iOS companion is unaffected). WCWebRTCMethodQueue is likewise compiled out on iOS.