Closed sweiss435 closed 4 months ago
Thread checker says that -[UIView setSize:]
is invoked on non-UI thread. I'd start debugging from this point. Check how it is utilized in your code. It seems to be invoked in capturer thread.
I wouldn't disagree, but I never call -[UIView setSize:] so I don't have said point from where to debug from
In such case it would be great to have a minimal project with reproduced issue. Could you prepare it?
I have a function and whether I use
mainScope.launch(CoroutineExceptionHandler { _, throwable -> }) { ...}
or go to main within the swiftUI project like:
private func addRenderer(_ track: VideoStreamTrack, renderer: RTCMTLVideoView) { DispatchQueue.main.async { renderer.isHidden = false track.addRenderer(renderer: renderer) } }
I get Main Thread Checker: UI API called on a background thread: -[UIView setSize:] PID: 966, TID: 163195, Thread name: (none), Queue name: org.webrtc.cameravideocapturer.video, QoS: 25
I can comment out nothing else but the call to addRenderer and this seems to be where it's coming from. I create the peerConnection on a main thread as well. Can't figure out what is calling a background thread, but it doesn't seem to be anything in my codebase, and the stack trace is unhelpful from Xcode.
Main Thread Checker: UI API called on a background thread: -[UIView setSize:] PID: 966, TID: 163195, Thread name: (none), Queue name: org.webrtc.cameravideocapturer.video, QoS: 25 Backtrace: 4 WebRTC 0x00000001085ecd00 _ZN6webrtc16CreateH264FormatENS_11H264ProfileENS_9H264LevelERKNSt4Cr12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEb + 2399896 5 WebRTC 0x00000001081019fc _ZN6webrtc14RateStatistics13SetWindowSizeExx + 10144 6 WebRTC 0x00000001080f6524 _ZN3rtc23AdaptedVideoTrackSource7OnFrameERKN6webrtc10VideoFrameE + 332 7 WebRTC 0x000000010807d6e8 RTCFileName + 31512 8 WebRTC 0x00000001085ed130 _ZN6webrtc16CreateH264FormatENS_11H264ProfileENS_9H264LevelERKNSt4__Cr12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEb + 2400968 9 WebRTC 0x000000010809f3f4 RTCShutdownInternalTracer + 10956 10 AVFCapture 0x00000001bba04030 7A5920AF-E765-36AA-B885-DA076E5EE0D7 + 163888 11 AVFCapture 0x00000001bba27d74 7A5920AF-E765-36AA-B885-DA076E5EE0D7 + 310644 12 CMCapture 0x00000001bf2743a0 A4F448B2-296A-38E9-BA78-14C5B2475BA4 + 844704 13 CMCapture 0x00000001bf274010 A4F448B2-296A-38E9-BA78-14C5B2475BA4 + 843792 14 libclang_rt.asan_ios_dynamic.dylib 0x0000000106536bd4 wrap_dispatch_source_set_event_handler_block_invoke + 196 15 libdispatch.dylib 0x00000001061927bc _dispatch_client_callout + 20 16 libdispatch.dylib 0x00000001061958e0 _dispatch_continuation_pop + 676 17 libdispatch.dylib 0x00000001061accc8 _dispatch_source_latch_and_call + 480 18 libdispatch.dylib 0x00000001061ab718 _dispatch_source_invoke + 860 19 libdispatch.dylib 0x000000010619a4a4 _dispatch_lane_serial_drain + 376 20 libdispatch.dylib 0x000000010619b408 _dispatch_lane_invoke + 408 21 libdispatch.dylib 0x00000001061a8404 _dispatch_root_queue_drain_deferred_wlh + 328 22 libdispatch.dylib 0x00000001061a7a38 _dispatch_workloop_worker_thread + 444 23 libsystem_pthread.dylib 0x00000001fb897934 _pthread_wqthread + 288 24 libsystem_pthread.dylib 0x00000001fb8940cc start_wqthread + 8
and further down I'll see Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIView renderFrame:]: unrecognized selector sent to instance 0x10c923e40' First throw call stack: (0x19ea40f20 0x1968f6018 0x19eb4a480 0x1a1b1c2d0 0x19e9ddfb4 0x19e9dd8d0 0x106458d4c 0x105f6d9fc 0x105f62524 0x105ee96e8 0x106459130 0x105f0b3f4 0x1bba04030 0x1bba27d74 0x1bf2743a0 0x1bf274010 0x1043a2bd4 0x10413e7bc 0x1041418e0 0x104158cc8 0x104157718 0x1041464a4 0x104147408 0x104154404 0x104153a38 0x1fb897934 0x1fb8940cc)