Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switching camera causes crash in TwilioVideo TVICameraSource #263

Open
Dinalli opened this issue Sep 19, 2023 · 3 comments
Open

Switching camera causes crash in TwilioVideo TVICameraSource #263

Dinalli opened this issue Sep 19, 2023 · 3 comments

Comments

@Dinalli
Copy link

Dinalli commented Sep 19, 2023

Description

When switching to the camera front/back & back/front the App crashes in Twilio Video SDK.

Steps to Reproduce

Intermittent issue.
Switching camera back to front.
Issue occurs on calling selectCaptureDevice.

Code

if let frontCamera = CameraSource.captureDevice(position: .front) {
                camera?.selectCaptureDevice(frontCamera, completion: { [self] (captureDevice, _, error) in
                    if error == nil {
                        self.currentCaptureDevice = captureDevice
                        shouldMirror = true
                    }
                })
            }

Expected Behavior

No crash to occur and camera to switch

Actual Behavior

App crashes and quits

Reproduces How Often

1 in 100 sessions according to logs

Logs

Debug level logs are helpful when investigating issues. To enable debug level logging, add the following code to your application:

TwilioVideoSDK.setLogLevel(.debug)
Fatal Exception: NSInternalInconsistencyException
The capture pipeline should have already been created when selecting a device.

Fatal Exception: NSInternalInconsistencyException
0  CoreFoundation                 0x9d94 __exceptionPreprocess
1  libobjc.A.dylib                0x183d0 objc_exception_throw
2  Foundation                     0x4e16cc _userInfoForFileAndLine
3  TwilioVideo                    0x3532c -[TVICameraSource selectCaptureDevice:format:completion:] + 396 (TVICameraSource.m:396)
4  TwilioVideo                    0x35148 -[TVICameraSource selectCaptureDevice:completion:] + 385 (TVICameraSource.m:385)
5  V3Shared                       0x370f0 TwilioVideoViewModel.switchCamera() + 167 (TwilioVideoViewModel.swift:167)
6  V3Shared                       0xa9748 closure #4 in closure #2 in closure #1 in closure #3 in TwilioSessionView.twilioVideoView(twilioSession:)
7  SwiftUI                        0x92b688 objectdestroyTm
8  SwiftUI                        0x92bc10 objectdestroy.11Tm
9  SwiftUI                        0x92bb14 objectdestroy.11Tm
10 SwiftUI                        0x107b540 OUTLINED_FUNCTION_46
11 SwiftUI                        0xdc368 OUTLINED_FUNCTION_242
12 SwiftUI                        0x394d4 OUTLINED_FUNCTION_97
13 SwiftUI                        0xdc368 OUTLINED_FUNCTION_242
14 SwiftUI                        0xa65870 OUTLINED_FUNCTION_15
15 SwiftUI                        0x197a8 OUTLINED_FUNCTION_28
16 SwiftUI                        0x1590c OUTLINED_FUNCTION_103
17 SwiftUI                        0x131f788 OUTLINED_FUNCTION_1
18 SwiftUI                        0x18a54 OUTLINED_FUNCTION_148
19 SwiftUI                        0x1b96c OUTLINED_FUNCTION_122
20 UIKitCore                      0xb6388 -[UIGestureRecognizer _componentsEnded:withEvent:]
21 UIKitCore                      0xb2ec0 -[UITouchesEvent _sendEventToGestureRecognizer:]
22 UIKitCore                      0x9be274 -[UIGestureEnvironment _deliverEvent:toGestureRecognizers:usingBlock:]
23 UIKitCore                      0xf46b0 -[UIGestureEnvironment _updateForEvent:window:]
24 UIKitCore                      0xf8f20 -[UIWindow sendEvent:]
25 UIKitCore                      0xf81e4 -[UIApplication sendEvent:]
26 UIKitCore                      0xf64d0 __dispatchPreprocessedEventFromEventQueue
27 UIKitCore                      0x13f130 __processEventQueue
28 UIKitCore                      0xdb09a4 updateCycleEntry
29 UIKitCore                      0x64de00 _UIUpdateSequenceRun
30 UIKitCore                      0xcb1944 schedulerStepScheduledMainSection
31 UIKitCore                      0xcb0ea0 runloopSourceCallback
32 CoreFoundation                 0xd3208 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
33 CoreFoundation                 0xdf864 __CFRunLoopDoSource0
34 CoreFoundation                 0x646c8 __CFRunLoopDoSources0
35 CoreFoundation                 0x7a1c4 __CFRunLoopRun
36 CoreFoundation                 0x7f4dc CFRunLoopRunSpecific
37 GraphicsServices               0x135c GSEventRunModal
38 UIKitCore                      0x39d37c -[UIApplication _run]
39 UIKitCore                      0x39cfe0 UIApplicationMain
40 SwiftUI                        0x1bc3d8 OUTLINED_FUNCTION_895
41 SwiftUI                        0x1229b0 block_copy_helper.1
42 SwiftUI                        0x10ca54 OUTLINED_FUNCTION_901
43 VICTVS V3                      0x8ce4 main + 29 (V3App.swift:29)
44 ???                            0x1b1d28dec (Missing)

Versions

All relevant version information for the issue.

Video iOS SDK

5.5.X

Xcode

14.X / 15.X

iOS Version

15/16 & 17

iOS Device

iPhone numerous devices.

@donald-boosted
Copy link

This error still persists in the most recent SDK. Any chance of a fix for this?

@chadbag
Copy link

chadbag commented Jul 11, 2024

Any update. Our QA is flagging this same error intermittently.

@nardonef
Copy link

Any update?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants