Describe the bug
Errors appear in the Xcode console about creating publisher from main thread. However, if I move it to a background thread as advised, its internal access to UIView throws an error because it's not on the main thread. Seems like the SDK is doing both UIView operations and AVCaptureSession startRunning inside one SDK call.
Purple triangles also appear in Xcode to warn of the issue.
To Reproduce
Steps to reproduce the behavior:
Run the Basic Video Chat example on iOS 16.1.1 / Xcode 14.1
Expected behavior
The call to create a publisher should internally handle correct thread assignments - UIView operation on main, AVCaptureSession on background.
Device (please compete the following information):
iOS SDK version: 13.0
OS and version: iOS 16.1.1
Xcode version: 14.1
Pods:
OpenTok (2.22.1):
VonageWebRTC (84.0.20)
Additional context
*********************** OpenTok iOS SDK ****************************
**** Version/Revision: ios-2.22.1/10d48c0bce7415ddee31e4765ada799ba09069e9
**** Library built on: Mar 25 2022
**** Copyright 2022 TokBox, Inc.
**** Licensed under the Apache License, Version 2.0
****
2022-11-27 14:59:46.904387-0500 App[11501:3595338] [Client] Updating selectors after delegate addition failed with: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service with pid 99 named com.apple.commcenter.coretelephony.xpc was invalidated from this process." UserInfo={NSDebugDescription=The connection to service with pid 99 named com.apple.commcenter.coretelephony.xpc was invalidated from this process.}
2022-11-27 14:59:48.262547-0500 App[11501:3595136] Metal GPU Frame Capture Enabled
2022-11-27 14:59:48.266020-0500 App[11501:3595136] Metal API Validation Enabled
Thread Performance Checker: -[AVCaptureSession startRunning] should be called from background thread. Calling it on the main thread can lead to UI unresponsiveness
PID: 11558, TID: 3610305
Backtrace
=================================================================
3 Basic-Video-Chat 0x0000000104a6cd3c -[OTVideoCaptureIOSDefault setupAudioVideoSession] + 1384
4 libdispatch.dylib 0x0000000105c6605c _dispatch_client_callout + 20
5 libdispatch.dylib 0x0000000105c77884 _dispatch_lane_barrier_sync_invoke_and_complete + 172
6 Basic-Video-Chat 0x0000000104a6cef8 -[OTVideoCaptureIOSDefault initCapture] + 76
7 Basic-Video-Chat 0x0000000104a5fd0c -[OTVideoCaptureProxy setVideoCapture:] + 336
8 Basic-Video-Chat 0x0000000104a597c8 -[OTPublisherKit setVideoCapture:] + 32
9 Basic-Video-Chat 0x0000000104a6658c -[OTPublisher setVideoCapture:] + 144
10 Basic-Video-Chat 0x0000000104a661c4 -[OTPublisher initWithDelegate:settings:] + 352
11 Basic-Video-Chat 0x0000000104a50bdc $sSo11OTPublisherC8delegate8settingsABSgSo0A11KitDelegate_pSg_So0A8SettingsCtcfcTO + 44
12 Basic-Video-Chat 0x0000000104a4d8d0 $sSo11OTPublisherC8delegate8settingsABSgSo0A11KitDelegate_pSg_So0A8SettingsCtcfC + 52
13 Basic-Video-Chat 0x0000000104a4d7d8 $s16Basic_Video_Chat14ViewControllerC9publisherSo11OTPublisherCvgAFyXEfU_ + 284
14 Basic-Video-Chat 0x0000000104a4d63c $s16Basic_Video_Chat14ViewControllerC9publisherSo11OTPublisherCvg + 164
15 Basic-Video-Chat 0x0000000104a4df1c $s16Basic_Video_Chat14ViewControllerC9doPublish33_E090156FDA9BE2DFEE1CE78B6965C16ALLyyF + 156
16 Basic-Video-Chat 0x0000000104a4f3cc $s16Basic_Video_Chat14ViewControllerC17sessionDidConnectyySo9OTSessionCF + 216
17 Basic-Video-Chat 0x0000000104a4f4a4 $s16Basic_Video_Chat14ViewControllerC17sessionDidConnectyySo9OTSessionCFTo + 52
18 Basic-Video-Chat 0x0000000104a642f0 __on_connected_block_invoke + 208
19 libdispatch.dylib 0x0000000105c645a8 _dispatch_call_block_and_release + 32
20 libdispatch.dylib 0x0000000105c6605c _dispatch_client_callout + 20
21 libdispatch.dylib 0x0000000105c76810 _dispatch_main_queue_drain + 1196
22 libdispatch.dylib 0x0000000105c76354 _dispatch_main_queue_callback_4CF + 44
23 CoreFoundation 0x00000001be4ae6f8 5CDC5D9A-E506-3740-B64E-BB30867B4F1B + 632568
24 CoreFoundation 0x00000001be490058 5CDC5D9A-E506-3740-B64E-BB30867B4F1B + 507992
25 CoreFoundation 0x00000001be494ed4 CFRunLoopRunSpecific + 612
26 GraphicsServices 0x00000001f7792368 GSEventRunModal + 164
27 UIKitCore 0x00000001c09733d0 179501B6-0FC2-344A-B969-B4E3961EBE10 + 3810256
28 UIKitCore 0x00000001c0973034 UIApplicationMain + 340
29 Basic-Video-Chat 0x0000000104a519c8 main + 64
30 dyld 0x00000001dcafc960 CB3FF411-4762-34D2-86A4-ECA13F9FB6C3 + 88416
Publishing
Describe the bug Errors appear in the Xcode console about creating publisher from main thread. However, if I move it to a background thread as advised, its internal access to UIView throws an error because it's not on the main thread. Seems like the SDK is doing both UIView operations and AVCaptureSession startRunning inside one SDK call.
Purple triangles also appear in Xcode to warn of the issue.
To Reproduce Steps to reproduce the behavior:
Run the Basic Video Chat example on iOS 16.1.1 / Xcode 14.1
Expected behavior
The call to create a publisher should internally handle correct thread assignments - UIView operation on main, AVCaptureSession on background.
Device (please compete the following information):
Pods:
Additional context