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

Crash when connect to Room: [TVIVideoTrack addRenderer:applyRotation:] #638

Open
minash-purohit opened this issue Dec 6, 2021 · 0 comments

Comments

@minash-purohit
Copy link

minash-purohit commented Dec 6, 2021

Description

I am getting crash when subscribing the Remote Participates. Please find the below crash log for more details.

Incident Identifier: 58A0DC98-709E-4F1A-AA11-0ECC82A48CBC
CrashReporter Key:   5b2a0f8c1bb676b112e4df70cbf1d0792361b1f5
Hardware Model:      iPhone13,2
Process:             Invictus [3023]
Path:                /private/var/containers/Bundle/Application/8D285721-E5E0-445F-AAAF-97C841E6C9C8/Invictus.app/Invictus
Identifier:          net.invictusmanagement.invictus
Version:             2.5 (1)
Code Type:           ARM-64 (Native)
Role:                Foreground
Parent Process:      launchd [1]
Coalition:           net.invictusmanagement.invictus [698]

Date/Time:           2021-12-05 12:05:34.7789 +0530
Launch Time:         2021-12-05 12:04:36.3810 +0530
OS Version:          iPhone OS 15.0 (19A346)
Release Type:        User
Baseband Version:    2.09.10
Report Version:      104

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note:  EXC_CORPSE_NOTIFY
Triggered by Thread:  0

Application Specific Information:
abort() called


Last Exception Backtrace:
0   CoreFoundation                	       0x18319005c 0x1830f7000 + 626780
1   libobjc.A.dylib               	       0x19b6aaf54 0x19b695000 + 89940
2   CoreFoundation                	       0x183266494 0x1830f7000 + 1504404
3   TwilioVideo                   	       0x1096cb48c -[TVIVideoTrack addRenderer:applyRotation:] + 341132 (TVIVideoTrack.mm:99)
4   TwilioVideo                   	       0x1096cb3d0 -[TVIVideoTrack addRenderer:] + 340944 (TVIVideoTrack.mm:88)
5   Invictus                      	       0x10307fab0 0x102fe8000 + 621232
6   Invictus                      	       0x10308171c 0x102fe8000 + 628508
7   TwilioVideo                   	       0x10968b58c -[TVIRemoteParticipant subscribedToVideoTrack:publication:forParticipant:] + 79244 (TVIRemoteParticipant.mm:280)
8   TwilioVideo                   	       0x10968e0fc twilio::video::TVIRemoteParticipantObserver::onVideoTrackSubscribed(twilio::video::RemoteParticipant*, std::__1::shared_ptr<twilio::media::RemoteVideoTrackPublication>, std::__1::shared_ptr<twilio::media::RemoteVideoTrack>) + 90364 (TVICocoaObservers.h:281)
9   TwilioVideo                   	       0x10984e8e8 twilio::video::RemoteParticipantImpl::onVideoTrackSubscribed+ 1927400 (webrtc::VideoTrackInterface*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) + 671
10  TwilioVideo                   	       0x1098bc040 std::__1::__function::__func<twilio::signaling::RemoteParticipantSignaling::raiseMediaTrackSubscribed(rtc::scoped_refptr<webrtc::MediaStreamTrackInterface>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, twilio::signaling::Track::Kind)::$_10, std::__1::allocator<twilio::signaling::RemoteParticipantSignaling::raiseMediaTrackSubscribed(rtc::scoped_refptr<webrtc::MediaStreamTrackInterface>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, twilio::signaling::Track::Kind)::$_10>, void ()>::operator()+ 2375744 () + 607
11  libdispatch.dylib             	       0x182e00c04 0x182dff000 + 7172
12  libdispatch.dylib             	       0x182e02950 0x182dff000 + 14672
13  libdispatch.dylib             	       0x182e10d30 0x182dff000 + 73008
14  CoreFoundation                	       0x183148ce4 0x1830f7000 + 335076
15  CoreFoundation                	       0x183102ebc 0x1830f7000 + 48828
16  CoreFoundation                	       0x1831163c8 0x1830f7000 + 127944
17  GraphicsServices              	       0x19e92738c 0x19e926000 + 5004
18  UIKitCore                     	       0x185abc0bc 0x1855a1000 + 5353660
19  UIKitCore                     	       0x185839be8 0x1855a1000 + 2722792
20  Invictus                      	       0x102fefbec 0x102fe8000 + 31724
21  dyld                          	       0x1039a9a24 start + 519

Thread 0 name:   Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libsystem_kernel.dylib        	       0x1b9bdc9c4 0x1b9bd5000 + 31172
1   libsystem_pthread.dylib       	       0x1f35cb434 0x1f35c4000 + 29748
2   libsystem_c.dylib             	       0x18df8bf64 0x18df6c000 + 130916
3   Invictus                      	       0x10317f818 0x102fe8000 + 1669144
4   CoreFoundation                	       0x183210c18 0x1830f7000 + 1154072
5   libobjc.A.dylib               	       0x19b6b1058 0x19b695000 + 114776
6   Invictus                      	       0x1031750b8 0x102fe8000 + 1626296
7   libc++abi.dylib               	       0x19b7b1f58 0x19b79f000 + 77656
8   libc++abi.dylib               	       0x19b7b1ef4 0x19b79f000 + 77556
9   libdispatch.dylib             	       0x182e02964 0x182dff000 + 14692
10  libdispatch.dylib             	       0x182e10d30 0x182dff000 + 73008
11  CoreFoundation                	       0x183148ce4 0x1830f7000 + 335076
12  CoreFoundation                	       0x183102ebc 0x1830f7000 + 48828
13  CoreFoundation                	       0x1831163c8 0x1830f7000 + 127944
14  GraphicsServices              	       0x19e92738c 0x19e926000 + 5004
15  UIKitCore                     	       0x185abc0bc 0x1855a1000 + 5353660
16  UIKitCore                     	       0x185839be8 0x1855a1000 + 2722792
17  Invictus                      	       0x102fefbec 0x102fe8000 + 31724
18  dyld                          	       0x1039a9a24 start + 519

Thread 1 name:   Dispatch queue: SwiftWebSocket
Thread 1:
0   libsystem_kernel.dylib        	       0x1b9bd6ff0 0x1b9bd5000 + 8176
1   libsystem_pthread.dylib       	       0x1f35cc274 0x1f35c4000 + 33396
2   SwiftSignalRClient            	       0x10452effc Manager.wait(_:) + 225276 (WebSocket.swift:1635)
3   SwiftSignalRClient            	       0x10452e9e0 closure #1 in Manager.init() + 223712 (WebSocket.swift:1609)
4   SwiftSignalRClient            	       0x104522cfc thunk for @escaping @callee_guaranteed () -> () + 175356 (<compiler-generated>:0)
5   libdispatch.dylib             	       0x182e00c04 0x182dff000 + 7172
6   libdispatch.dylib             	       0x182e02950 0x182dff000 + 14672
7   libdispatch.dylib             	       0x182e0a0ac 0x182dff000 + 45228
8   libdispatch.dylib             	       0x182e0ac10 0x182dff000 + 48144
9   libdispatch.dylib             	       0x182e15318 0x182dff000 + 90904
10  libsystem_pthread.dylib       	       0x1f35c51b0 0x1f35c4000 + 4528
11  libsystem_pthread.dylib       	       0x1f35c4f50 0x1f35c4000 + 3920

Thread 2 name:  com.apple.uikit.eventfetch-thread
Thread 2:
0   libsystem_kernel.dylib        	       0x1b9bd6564 0x1b9bd5000 + 5476
1   libsystem_kernel.dylib        	       0x1b9bd6bfc 0x1b9bd5000 + 7164
2   CoreFoundation                	       0x1830fe698 0x1830f7000 + 30360
3   CoreFoundation                	       0x18310298c 0x1830f7000 + 47500
4   CoreFoundation                	       0x1831163c8 0x1830f7000 + 127944
5   Foundation                    	       0x184939d54 0x184921000 + 101716
6   Foundation                    	       0x18497b6a8 0x184921000 + 370344
7   UIKitCore                     	       0x185a3507c 0x1855a1000 + 4800636
8   Foundation                    	       0x18498995c 0x184921000 + 428380
9   libsystem_pthread.dylib       	       0x1f35c5a60 0x1f35c4000 + 6752
10  libsystem_pthread.dylib       	       0x1f35c4f5c 0x1f35c4000 + 3932

Thread 3 name:  AVAudioSession Notify Thread
Thread 3:
0   libsystem_kernel.dylib        	       0x1b9bd6564 0x1b9bd5000 + 5476
1   libsystem_kernel.dylib        	       0x1b9bd6bfc 0x1b9bd5000 + 7164
2   CoreFoundation                	       0x1830fe698 0x1830f7000 + 30360
3   CoreFoundation                	       0x18310298c 0x1830f7000 + 47500
4   CoreFoundation                	       0x1831163c8 0x1830f7000 + 127944
5   AudioSession                  	       0x18c47d308 0x18c477000 + 25352
6   AudioSession                  	       0x18c486d64 0x18c477000 + 64868
7   libsystem_pthread.dylib       	       0x1f35c5a60 0x1f35c4000 + 6752
8   libsystem_pthread.dylib       	       0x1f35c4f5c 0x1f35c4000 + 3932

Thread 4 name:  com.apple.NSURLConnectionLoader
Thread 4:
0   libsystem_kernel.dylib        	       0x1b9bd6564 0x1b9bd5000 + 5476
1   libsystem_kernel.dylib        	       0x1b9bd6bfc 0x1b9bd5000 + 7164
2   CoreFoundation                	       0x1830fe698 0x1830f7000 + 30360
3   CoreFoundation                	       0x18310298c 0x1830f7000 + 47500
4   CoreFoundation                	       0x1831163c8 0x1830f7000 + 127944
5   CFNetwork                     	       0x183b878d0 0x18390d000 + 2599120
6   Foundation                    	       0x18498995c 0x184921000 + 428380
7   libsystem_pthread.dylib       	       0x1f35c5a60 0x1f35c4000 + 6752
8   libsystem_pthread.dylib       	       0x1f35c4f5c 0x1f35c4000 + 3932

Thread 5 name:  com.apple.CoreMotion.MotionThread
Thread 5:
0   libsystem_kernel.dylib        	       0x1b9bd6564 0x1b9bd5000 + 5476
1   libsystem_kernel.dylib        	       0x1b9bd6bfc 0x1b9bd5000 + 7164
2   CoreFoundation                	       0x1830fe698 0x1830f7000 + 30360
3   CoreFoundation                	       0x18310298c 0x1830f7000 + 47500
4   CoreFoundation                	       0x1831163c8 0x1830f7000 + 127944
5   CoreFoundation                	       0x183196a88 0x1830f7000 + 653960
6   CoreMotion                    	       0x1900923ec 0x19007f000 + 78828
7   libsystem_pthread.dylib       	       0x1f35c5a60 0x1f35c4000 + 6752
8   libsystem_pthread.dylib       	       0x1f35c4f5c 0x1f35c4000 + 3932

Thread 6:
0   libsystem_pthread.dylib       	       0x1f35c4f48 0x1f35c4000 + 3912

Thread 7 name:  com.apple.CFSocket.private
Thread 7:
0   libsystem_kernel.dylib        	       0x1b9bd7230 0x1b9bd5000 + 8752
1   CoreFoundation                	       0x1831a1750 0x1830f7000 + 698192
2   libsystem_pthread.dylib       	       0x1f35c5a60 0x1f35c4000 + 6752
3   libsystem_pthread.dylib       	       0x1f35c4f5c 0x1f35c4000 + 3932

Thread 8:
0   libsystem_pthread.dylib       	       0x1f35c4f48 0x1f35c4000 + 3912

Thread 9:
0   libsystem_pthread.dylib       	       0x1f35c4f48 0x1f35c4000 + 3912

Thread 10 name:   Dispatch queue: room.worker
Thread 10:
0   libc++.1.dylib                	       0x19b749b90 0x19b73b000 + 60304
1   TwilioVideo                   	       0x109ae4a4c webrtc::HasAttribute+ 4639308 (std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) + 56
2   TwilioVideo                   	       0x109ae68e0 webrtc::ParseContent+ 4647136 (std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, cricket::MediaType, int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::vector<int, std::__1::allocator<int> > const&, unsigned long*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, bool*, int*, cricket::MediaContentDescription*, cricket::TransportDescription*, std::__1::vector<std::__1::unique_ptr<webrtc::JsepIceCandidate, std::__1::default_delete<webrtc::JsepIceCandidate> >, std::__1::allocator<std::__1::unique_ptr<webrtc::JsepIceCandidate, std::__1::default_delete<webrtc::JsepIceCandidate> > > >*, webrtc::SdpParseError*) + 5168
3   TwilioVideo                   	       0x109ae2060 webrtc::SdpDeserialize+ 4628576 (std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, webrtc::JsepSessionDescription*, webrtc::SdpParseError*) + 2292
4   TwilioVideo                   	       0x109a94274 webrtc::CreateSessionDescription+ 4309620 (webrtc::SdpType, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, webrtc::SdpParseError*) + 88
5   TwilioVideo                   	       0x1098ae058 twilio::signaling::PeerConnectionSignaling::onCreateSessionLocalDescription(std::__1::unique_ptr<webrtc::SessionDescriptionInterface, std::__1::default_delete<webrtc::SessionDescriptionInterface> >, int, twilio::BaseError)::$_20::operator()+ 2318424 () const + 4276
6   TwilioVideo                   	       0x109913d40 twilio::TimerCancellationFlag twilio::postTimer<twilio::TimerCancellationFlag twilio::SafePoster::postTimer<std::__1::function<void ()>&, long long, std::__1::ratio<1l, 1l> >(rtc::TaskQueue&, std::__1::function<void ()>&, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1l> > const&, twilio::TimerPeriodicity, std::__1::function<void ()>)::'lambda'(), long long, std::__1::ratio<1l, 1l> >(rtc::TaskQueue&, std::__1::function<void ()>&, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1l> > const&, twilio::TimerPeriodicity, twilio::TimerCancellationFlag const&, std::__1::function<void ()>)::Timer::Run+ 2735424 () + 216
7   TwilioVideo                   	       0x109c185f8 webrtc::(anonymous namespace)::TaskQueueGcd::RunTask+ 5899768 (void*) + 64
8   libdispatch.dylib             	       0x182e02950 0x182dff000 + 14672
9   libdispatch.dylib             	       0x182e0a0ac 0x182dff000 + 45228
10  libdispatch.dylib             	       0x182e0ac10 0x182dff000 + 48144
11  libdispatch.dylib             	       0x182e15318 0x182dff000 + 90904
12  libsystem_pthread.dylib       	       0x1f35c51b0 0x1f35c4000 + 4528
13  libsystem_pthread.dylib       	       0x1f35c4f50 0x1f35c4000 + 3920

Thread 11:
0   libsystem_pthread.dylib       	       0x1f35c4f48 0x1f35c4000 + 3912

Thread 12 name:  com.apple.coremedia.rootQueue.47
Thread 12:
0   libsystem_kernel.dylib        	       0x1b9bd65b8 0x1b9bd5000 + 5560
1   libdispatch.dylib             	       0x182e02f5c 0x182dff000 + 16220
2   libdispatch.dylib             	       0x182e03560 0x182dff000 + 17760
3   libdispatch.dylib             	       0x182e13d24 0x182dff000 + 85284
4   libsystem_pthread.dylib       	       0x1f35c5a60 0x1f35c4000 + 6752
5   libsystem_pthread.dylib       	       0x1f35c4f5c 0x1f35c4000 + 3932

Thread 13 name:  com.apple.coremedia.rootQueue.47
Thread 13:
0   libsystem_kernel.dylib        	       0x1b9bd65b8 0x1b9bd5000 + 5560
1   libdispatch.dylib             	       0x182e02f5c 0x182dff000 + 16220
2   libdispatch.dylib             	       0x182e03560 0x182dff000 + 17760
3   libdispatch.dylib             	       0x182e13d24 0x182dff000 + 85284
4   libsystem_pthread.dylib       	       0x1f35c5a60 0x1f35c4000 + 6752
5   libsystem_pthread.dylib       	       0x1f35c4f5c 0x1f35c4000 + 3932

Thread 14 name:  com.apple.coremedia.rootQueue.47
Thread 14:
0   libsystem_kernel.dylib        	       0x1b9bd65b8 0x1b9bd5000 + 5560
1   libdispatch.dylib             	       0x182e02f5c 0x182dff000 + 16220
2   libdispatch.dylib             	       0x182e03560 0x182dff000 + 17760
3   libdispatch.dylib             	       0x182e13d24 0x182dff000 + 85284
4   libsystem_pthread.dylib       	       0x1f35c5a60 0x1f35c4000 + 6752
5   libsystem_pthread.dylib       	       0x1f35c4f5c 0x1f35c4000 + 3932

Thread 15 name:  MediaFactoryImpl::signaling 0x0x281661570
Thread 15:
0   libsystem_kernel.dylib        	       0x1b9bd6ff0 0x1b9bd5000 + 8176
1   libsystem_pthread.dylib       	       0x1f35cc274 0x1f35c4000 + 33396
2   TwilioVideo                   	       0x109b56050 rtc::Event::Wait(int, int)::$_0::operator()+ 5103696 (absl::optional<timespec>) const + 92
3   TwilioVideo                   	       0x109b55f1c rtc::Event::Wait+ 5103388 (int, int) + 260
4   TwilioVideo                   	       0x109b1edf4 rtc::NullSocketServer::Wait+ 4877812 (int, bool) + 20
5   TwilioVideo                   	       0x109b2e0e8 rtc::Thread::Send+ 4940008 (rtc::Location const&, rtc::MessageHandler*, unsigned int, rtc::MessageData*) + 320
6   TwilioVideo                   	       0x109b2e21c rtc::Thread::InvokeInternal(rtc::Location const&, rtc::FunctionView<void + 4940316 ()>) + 168
7   TwilioVideo                   	       0x109a9b3e4 bool rtc::Thread::Invoke<bool, void>(rtc::Location const&, rtc::FunctionView<bool + 4338660 ()>) + 40
8   TwilioVideo                   	       0x109af135c cricket::BaseChannel::SetLocalContent+ 4690780 (cricket::MediaContentDescription const*, webrtc::SdpType, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*) + 148
9   TwilioVideo                   	       0x109aca85c webrtc::SdpOfferAnswerHandler::PushdownMediaDescription+ 4532316 (webrtc::SdpType, cricket::ContentSource) + 248
10  TwilioVideo                   	       0x109ac51c4 webrtc::SdpOfferAnswerHandler::UpdateSessionState+ 4510148 (webrtc::SdpType, cricket::ContentSource, cricket::SessionDescription const*) + 176
11  TwilioVideo                   	       0x109ac4348 webrtc::SdpOfferAnswerHandler::ApplyLocalDescription+ 4506440 (std::__1::unique_ptr<webrtc::SessionDescriptionInterface, std::__1::default_delete<webrtc::SessionDescriptionInterface> >) + 1044
12  TwilioVideo                   	       0x109ac714c webrtc::SdpOfferAnswerHandler::DoSetLocalDescription+ 4518220 (std::__1::unique_ptr<webrtc::SessionDescriptionInterface, std::__1::default_delete<webrtc::SessionDescriptionInterface> >, rtc::scoped_refptr<webrtc::SetLocalDescriptionObserverInterface>) + 744
13  TwilioVideo                   	       0x109ad2b94 rtc::rtc_operations_chain_internal::OperationWithFunctor<webrtc::SdpOfferAnswerHandler::SetLocalDescription(webrtc::SetSessionDescriptionObserver*, webrtc::SessionDescriptionInterface*)::$_4>::Run+ 4565908 () + 84
14  TwilioVideo                   	       0x109ac3c18 webrtc::SdpOfferAnswerHandler::SetLocalDescription+ 4504600 (webrtc::SetSessionDescriptionObserver*, webrtc::SessionDescriptionInterface*) + 124
15  TwilioVideo                   	       0x109aab2d4 webrtc::PeerConnectionProxyWithInternal<webrtc::PeerConnectionInterface>::SetLocalDescription+ 4403924 (webrtc::SetSessionDescriptionObserver*, webrtc::SessionDescriptionInterface*) + 112
16  TwilioVideo                   	       0x109893f60 twilio::signaling::PeerConnectionSignaling::doSetLocalSdp+ 2211680 (twilio::signaling::PeerConnectionSignaling::SetLocalSdpMessageData*) + 656
17  TwilioVideo                   	       0x109893028 twilio::signaling::PeerConnectionSignaling::OnMessage+ 2207784 (rtc::Message*) + 232
18  TwilioVideo                   	       0x109b2daf4 rtc::Thread::Dispatch+ 4938484 (rtc::Message*) + 136
19  TwilioVideo                   	       0x109b2ca94 rtc::Thread::ProcessMessages+ 4934292 (int) + 168
20  TwilioVideo                   	       0x109b2ded4 rtc::Thread::PreRun+ 4939476 (void*) + 60
21  libsystem_pthread.dylib       	       0x1f35c5a60 0x1f35c4000 + 6752
22  libsystem_pthread.dylib       	       0x1f35c4f5c 0x1f35c4000 + 3932

Thread 16 name:  MediaFactoryImpl::worker 0x0x281661570
Thread 16:
0   libsystem_kernel.dylib        	       0x1b9bd6ff0 0x1b9bd5000 + 8176
1   libsystem_pthread.dylib       	       0x1f35cc274 0x1f35c4000 + 33396
2   TwilioVideo                   	       0x109b56050 rtc::Event::Wait(int, int)::$_0::operator()+ 5103696 (absl::optional<timespec>) const + 92
3   TwilioVideo                   	       0x109b55f1c rtc::Event::Wait+ 5103388 (int, int) + 260
4   TwilioVideo                   	       0x109b1edf4 rtc::NullSocketServer::Wait+ 4877812 (int, bool) + 20
5   TwilioVideo                   	       0x109b2e0e8 rtc::Thread::Send+ 4940008 (rtc::Location const&, rtc::MessageHandler*, unsigned int, rtc::MessageData*) + 320
6   TwilioVideo                   	       0x109b2e21c rtc::Thread::InvokeInternal(rtc::Location const&, rtc::FunctionView<void + 4940316 ()>) + 168
7   TwilioVideo                   	       0x109af2014 cricket::BaseChannel::UpdateRtpHeaderExtensionMap+ 4694036 (std::__1::vector<webrtc::RtpExtension, std::__1::allocator<webrtc::RtpExtension> > const&) + 80
8   TwilioVideo                   	       0x109af3acc cricket::VideoChannel::SetLocalContent_w+ 4700876 (cricket::MediaContentDescription const*, webrtc::SdpType, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*) + 220
9   TwilioVideo                   	       0x109aa43d8 void rtc::FunctionView<void ()>::CallVoidPtr<bool rtc::Thread::Invoke<bool, void>(rtc::Location const&, rtc::FunctionView<bool ()>)::'lambda'()>(rtc::FunctionView<void + 4375512 ()>::VoidUnion) + 28
10  TwilioVideo                   	       0x109b2efa8 webrtc::webrtc_new_closure_impl::ClosureTask<rtc::Thread::Send(rtc::Location const&, rtc::MessageHandler*, unsigned int, rtc::MessageData*)::$_0>::Run+ 4943784 () + 28
11  TwilioVideo                   	       0x109b2e290 rtc::Thread::QueuedTaskHandler::OnMessage+ 4940432 (rtc::Message*) + 48
12  TwilioVideo                   	       0x109b2daf4 rtc::Thread::Dispatch+ 4938484 (rtc::Message*) + 136
13  TwilioVideo                   	       0x109b2ca94 rtc::Thread::ProcessMessages+ 4934292 (int) + 168
14  TwilioVideo                   	       0x109b2ded4 rtc::Thread::PreRun+ 4939476 (void*) + 60
15  libsystem_pthread.dylib       	       0x1f35c5a60 0x1f35c4000 + 6752
16  libsystem_pthread.dylib       	       0x1f35c4f5c 0x1f35c4000 + 3932

Thread 17 name:  MediaFactoryImpl::networking 0x0x281661570
Thread 17:
0   libsystem_kernel.dylib        	       0x1b9bd8a10 0x1b9bd5000 + 14864
1   libsystem_pthread.dylib       	       0x1f35c91b0 0x1f35c4000 + 20912
2   TwilioVideo                   	       0x109b55df0 rtc::Event::Set+ 5103088 () + 28
3   TwilioVideo                   	       0x109b2ef5c webrtc::webrtc_new_closure_impl::ClosureTaskWithCleanup<rtc::Thread::Send(rtc::Location const&, rtc::MessageHandler*, unsigned int, rtc::MessageData*)::$_0, rtc::Thread::Send(rtc::Location const&, rtc::MessageHandler*, unsigned int, rtc::MessageData*)::$_1>::~ClosureTaskWithCleanup+ 4943708 () + 72
4   TwilioVideo                   	       0x109b2ef84 webrtc::webrtc_new_closure_impl::ClosureTaskWithCleanup<rtc::Thread::Send(rtc::Location const&, rtc::MessageHandler*, unsigned int, rtc::MessageData*)::$_0, rtc::Thread::Send(rtc::Location const&, rtc::MessageHandler*, unsigned int, rtc::MessageData*)::$_1>::~ClosureTaskWithCleanup+ 4943748 () + 12
5   TwilioVideo                   	       0x109b2daf4 rtc::Thread::Dispatch+ 4938484 (rtc::Message*) + 136
6   TwilioVideo                   	       0x109b2ca94 rtc::Thread::ProcessMessages+ 4934292 (int) + 168
7   TwilioVideo                   	       0x109b2ded4 rtc::Thread::PreRun+ 4939476 (void*) + 60
8   libsystem_pthread.dylib       	       0x1f35c5a60 0x1f35c4000 + 6752
9   libsystem_pthread.dylib       	       0x1f35c4f5c 0x1f35c4000 + 3932

Thread 18:
0   libsystem_kernel.dylib        	       0x1b9bd7edc 0x1b9bd5000 + 11996
1   TwilioVideo                   	       0x10992cf5c boost_1_73_0::asio::detail::kqueue_reactor::run+ 2838364 (long, boost_1_73_0::asio::detail::op_queue<boost_1_73_0::asio::detail::scheduler_operation>&) + 280
2   TwilioVideo                   	       0x10992cadc boost_1_73_0::asio::detail::scheduler::do_run_one+ 2837212 (boost_1_73_0::asio::detail::conditionally_enabled_mutex::scoped_lock&, boost_1_73_0::asio::detail::scheduler_thread_info&, boost_1_73_0::system::error_code const&) + 396
3   TwilioVideo                   	       0x10992c7cc boost_1_73_0::asio::detail::scheduler::run+ 2836428 (boost_1_73_0::system::error_code&) + 196
4   TwilioVideo                   	       0x109977508 boost_1_73_0::asio::io_context::run+ 3142920 () + 52
5   TwilioVideo                   	       0x109978988 void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, boost_1_73_0::_bi::bind_t<unsigned long, boost_1_73_0::_mfi::mf0<unsigned long, boost_1_73_0::asio::io_context>, boost_1_73_0::_bi::list1<boost_1_73_0::_bi::value<boost_1_73_0::asio::io_context*> > > > >+ 3148168 (void*) + 64
6   libsystem_pthread.dylib       	       0x1f35c5a60 0x1f35c4000 + 6752
7   libsystem_pthread.dylib       	       0x1f35c4f5c 0x1f35c4000 + 3932

Thread 19:
0   libsystem_pthread.dylib       	       0x1f35c4f48 0x1f35c4000 + 3912

Thread 20 name:  Thread 0x0x104f90a40
Thread 20:
0   libsystem_kernel.dylib        	       0x1b9bd6ff0 0x1b9bd5000 + 8176
1   libsystem_pthread.dylib       	       0x1f35cc274 0x1f35c4000 + 33396
2   TwilioVideo                   	       0x109b56050 rtc::Event::Wait(int, int)::$_0::operator()+ 5103696 (absl::optional<timespec>) const + 92
3   TwilioVideo                   	       0x109b55f1c rtc::Event::Wait+ 5103388 (int, int) + 260
4   TwilioVideo                   	       0x109b1edf4 rtc::NullSocketServer::Wait+ 4877812 (int, bool) + 20
5   TwilioVideo                   	       0x109b2d528 rtc::Thread::Get+ 4937000 (rtc::Message*, int, bool) + 556
6   TwilioVideo                   	       0x109b2ca80 rtc::Thread::ProcessMessages+ 4934272 (int) + 148
7   TwilioVideo                   	       0x109b2ded4 rtc::Thread::PreRun+ 4939476 (void*) + 60
8   libsystem_pthread.dylib       	       0x1f35c5a60 0x1f35c4000 + 6752
9   libsystem_pthread.dylib       	       0x1f35c4f5c 0x1f35c4000 + 3932

Thread 21 name:  Thread 0x0x104f915c0
Thread 21:
0   libsystem_kernel.dylib        	       0x1b9bd6ff0 0x1b9bd5000 + 8176
1   libsystem_pthread.dylib       	       0x1f35cc274 0x1f35c4000 + 33396
2   TwilioVideo                   	       0x109b56050 rtc::Event::Wait(int, int)::$_0::operator()+ 5103696 (absl::optional<timespec>) const + 92
3   TwilioVideo                   	       0x109b55f1c rtc::Event::Wait+ 5103388 (int, int) + 260
4   TwilioVideo                   	       0x109b1edf4 rtc::NullSocketServer::Wait+ 4877812 (int, bool) + 20
5   TwilioVideo                   	       0x109b2d528 rtc::Thread::Get+ 4937000 (rtc::Message*, int, bool) + 556
6   TwilioVideo                   	       0x109b2ca80 rtc::Thread::ProcessMessages+ 4934272 (int) + 148
7   TwilioVideo                   	       0x109b2ded4 rtc::Thread::PreRun+ 4939476 (void*) + 60
8   libsystem_pthread.dylib       	       0x1f35c5a60 0x1f35c4000 + 6752
9   libsystem_pthread.dylib       	       0x1f35c4f5c 0x1f35c4000 + 3932

Thread 22 name:  Thread 0x0x104f93780
Thread 22:
0   libsystem_kernel.dylib        	       0x1b9bd6ff0 0x1b9bd5000 + 8176
1   libsystem_pthread.dylib       	       0x1f35cc274 0x1f35c4000 + 33396
2   TwilioVideo                   	       0x109b56050 rtc::Event::Wait(int, int)::$_0::operator()+ 5103696 (absl::optional<timespec>) const + 92
3   TwilioVideo                   	       0x109b55f1c rtc::Event::Wait+ 5103388 (int, int) + 260
4   TwilioVideo                   	       0x109b1edf4 rtc::NullSocketServer::Wait+ 4877812 (int, bool) + 20
5   TwilioVideo                   	       0x109b2d528 rtc::Thread::Get+ 4937000 (rtc::Message*, int, bool) + 556
6   TwilioVideo                   	       0x109b2ca80 rtc::Thread::ProcessMessages+ 4934272 (int) + 148
7   TwilioVideo                   	       0x109b2ded4 rtc::Thread::PreRun+ 4939476 (void*) + 60
8   libsystem_pthread.dylib       	       0x1f35c5a60 0x1f35c4000 + 6752
9   libsystem_pthread.dylib       	       0x1f35c4f5c 0x1f35c4000 + 3932

Thread 23 name:  Thread 0x0x104f938e0
Thread 23:
0   libsystem_kernel.dylib        	       0x1b9bd6ff0 0x1b9bd5000 + 8176
1   libsystem_pthread.dylib       	       0x1f35cc274 0x1f35c4000 + 33396
2   TwilioVideo                   	       0x109b56050 rtc::Event::Wait(int, int)::$_0::operator()+ 5103696 (absl::optional<timespec>) const + 92
3   TwilioVideo                   	       0x109b55f1c rtc::Event::Wait+ 5103388 (int, int) + 260
4   TwilioVideo                   	       0x109b1edf4 rtc::NullSocketServer::Wait+ 4877812 (int, bool) + 20
5   TwilioVideo                   	       0x109b2d528 rtc::Thread::Get+ 4937000 (rtc::Message*, int, bool) + 556
6   TwilioVideo                   	       0x109b2ca80 rtc::Thread::ProcessMessages+ 4934272 (int) + 148
7   TwilioVideo                   	       0x109b2ded4 rtc::Thread::PreRun+ 4939476 (void*) + 60
8   libsystem_pthread.dylib       	       0x1f35c5a60 0x1f35c4000 + 6752
9   libsystem_pthread.dylib       	       0x1f35c4f5c 0x1f35c4000 + 3932

Thread 24 name:  Thread 0x0x104f93a40
Thread 24:
0   libsystem_kernel.dylib        	       0x1b9bd6ff0 0x1b9bd5000 + 8176
1   libsystem_pthread.dylib       	       0x1f35cc274 0x1f35c4000 + 33396
2   TwilioVideo                   	       0x109b56050 rtc::Event::Wait(int, int)::$_0::operator()+ 5103696 (absl::optional<timespec>) const + 92
3   TwilioVideo                   	       0x109b55f1c rtc::Event::Wait+ 5103388 (int, int) + 260
4   TwilioVideo                   	       0x109b1edf4 rtc::NullSocketServer::Wait+ 4877812 (int, bool) + 20
5   TwilioVideo                   	       0x109b2d528 rtc::Thread::Get+ 4937000 (rtc::Message*, int, bool) + 556
6   TwilioVideo                   	       0x109b2ca80 rtc::Thread::ProcessMessages+ 4934272 (int) + 148
7   TwilioVideo                   	       0x109b2ded4 rtc::Thread::PreRun+ 4939476 (void*) + 60
8   libsystem_pthread.dylib       	       0x1f35c5a60 0x1f35c4000 + 6752
9   libsystem_pthread.dylib       	       0x1f35c4f5c 0x1f35c4000 + 3932

Thread 25 name:  Thread 0x0x104f93ba0
Thread 25:
0   libsystem_kernel.dylib        	       0x1b9bd6ff0 0x1b9bd5000 + 8176
1   libsystem_pthread.dylib       	       0x1f35cc274 0x1f35c4000 + 33396
2   TwilioVideo                   	       0x109b56050 rtc::Event::Wait(int, int)::$_0::operator()+ 5103696 (absl::optional<timespec>) const + 92
3   TwilioVideo                   	       0x109b55f1c rtc::Event::Wait+ 5103388 (int, int) + 260
4   TwilioVideo                   	       0x109b1edf4 rtc::NullSocketServer::Wait+ 4877812 (int, bool) + 20
5   TwilioVideo                   	       0x109b2d528 rtc::Thread::Get+ 4937000 (rtc::Message*, int, bool) + 556
6   TwilioVideo                   	       0x109b2ca80 rtc::Thread::ProcessMessages+ 4934272 (int) + 148
7   TwilioVideo                   	       0x109b2ded4 rtc::Thread::PreRun+ 4939476 (void*) + 60
8   libsystem_pthread.dylib       	       0x1f35c5a60 0x1f35c4000 + 6752
9   libsystem_pthread.dylib       	       0x1f35c4f5c 0x1f35c4000 + 3932

Thread 26 name:  SharedModThread
Thread 26:
0   libsystem_kernel.dylib        	       0x1b9bd6ff0 0x1b9bd5000 + 8176
1   libsystem_pthread.dylib       	       0x1f35cc274 0x1f35c4000 + 33396
2   TwilioVideo                   	       0x109b56040 rtc::Event::Wait(int, int)::$_0::operator()+ 5103680 (absl::optional<timespec>) const + 76
3   TwilioVideo                   	       0x109b55f1c rtc::Event::Wait+ 5103388 (int, int) + 260
4   TwilioVideo                   	       0x109c09a28 webrtc::ProcessThreadImpl::Process+ 5839400 () + 656
5   TwilioVideo                   	       0x109c09330 webrtc::ProcessThreadImpl::Run+ 5837616 (void*) + 40
6   TwilioVideo                   	       0x109b55a30 rtc::PlatformThread::StartThread+ 5102128 (void*) + 12
7   libsystem_pthread.dylib       	       0x1f35c5a60 0x1f35c4000 + 6752
8   libsystem_pthread.dylib       	       0x1f35c4f5c 0x1f35c4000 + 3932

Thread 27 name:  PacerThread
Thread 27:
0   libsystem_kernel.dylib        	       0x1b9bd6ff0 0x1b9bd5000 + 8176
1   libsystem_pthread.dylib       	       0x1f35cc274 0x1f35c4000 + 33396
2   TwilioVideo                   	       0x109b56040 rtc::Event::Wait(int, int)::$_0::operator()+ 5103680 (absl::optional<timespec>) const + 76
3   TwilioVideo                   	       0x109b55f1c rtc::Event::Wait+ 5103388 (int, int) + 260
4   TwilioVideo                   	       0x109c09a28 webrtc::ProcessThreadImpl::Process+ 5839400 () + 656
5   TwilioVideo                   	       0x109c09330 webrtc::ProcessThreadImpl::Run+ 5837616 (void*) + 40
6   TwilioVideo                   	       0x109b55a30 rtc::PlatformThread::StartThread+ 5102128 (void*) + 12
7   libsystem_pthread.dylib       	       0x1f35c5a60 0x1f35c4000 + 6752
8   libsystem_pthread.dylib       	       0x1f35c4f5c 0x1f35c4000 + 3932


Thread 0 crashed with ARM Thread State (64-bit):
    x0: 0x0000000000000000   x1: 0x0000000000000000   x2: 0x0000000000000000   x3: 0x0000000000000000
    x4: 0x0000000000000010   x5: 0x0000000000000020   x6: 0x0000000000000000   x7: 0x0000000000000000
    x8: 0x197cd952e0c31c87   x9: 0x197cd953e35c5907  x10: 0x00000001165cfb51  x11: 0x007f000107826c00
   x12: 0x0000000000000023  x13: 0x0000000107826e20  x14: 0x0000000000000004  x15: 0x00000001dcdcf918
   x16: 0x0000000000000148  x17: 0x00000001039f4580  x18: 0x0000000110fb194c  x19: 0x0000000000000006
   x20: 0x0000000000000103  x21: 0x00000001039f4660  x22: 0x0000000104f97ec0  x23: 0x00000001dde0c1b8
   x24: 0x00000001d98b0000  x25: 0x00000001cda1c019  x26: 0x00000001ccf90f99  x27: 0x00000001834af643
   x28: 0x00000001d98ae298   fp: 0x000000016ce162a0   lr: 0x00000001f35cb434
    sp: 0x000000016ce16280   pc: 0x00000001b9bdc9c4 cpsr: 0x40000000
   far: 0xffffffeb0d9bc024  esr: 0x56000080  Address size fault

Binary Images:
       0x1b9bd5000 -        0x1b9c08fff libsystem_kernel.dylib arm64e  <d2476f74d204348d8d386165d0485c7c> /usr/lib/system/libsystem_kernel.dylib
       0x1f35c4000 -        0x1f35cffff libsystem_pthread.dylib arm64e  <bc1ce0c6a9f2396b9afb623d3acd5881> /usr/lib/system/libsystem_pthread.dylib
       0x18df6c000 -        0x18dfeafff libsystem_c.dylib arm64e  <059fc305234a3025a1555473cf3a0e9b> /usr/lib/system/libsystem_c.dylib
       0x102fe8000 -        0x1031fffff Invictus arm64  <550b731842db34b790b93714880c4873> /private/var/containers/Bundle/Application/8D285721-E5E0-445F-AAAF-97C841E6C9C8/Invictus.app/Invictus
       0x1830f7000 -        0x18354afff CoreFoundation arm64e  <6174789ae88c3f5cba39de2e9edc0750> /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
       0x19b695000 -        0x19b6cefff libobjc.A.dylib arm64e  <6d12ade560653900a6bc80677ccac819> /usr/lib/libobjc.A.dylib
       0x19b79f000 -        0x19b7b8fff libc++abi.dylib arm64e  <96151f5b129d3ec79ed0f96c21cf09f6> /usr/lib/libc++abi.dylib
       0x182dff000 -        0x182e44fff libdispatch.dylib arm64e  <959cd6e40ce73022b73c8b36f79f4745> /usr/lib/system/libdispatch.dylib
       0x19e926000 -        0x19e92efff GraphicsServices arm64e  <0f7424f6bde5311aa3fac0e0c4c28d72> /System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices
       0x1855a1000 -        0x186e23fff UIKitCore arm64e  <0e2d8679d5f13c0390107f6ce3662789> /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore
       0x103990000 -        0x1039e7fff dyld arm64e  <d48c31ee061f370ba6f78391a1b53ed8> /usr/lib/dyld
       0x1044f8000 -        0x10454bfff SwiftSignalRClient arm64  <b114eb9c13dc39c6ba4f3211b600de0b> /private/var/containers/Bundle/Application/8D285721-E5E0-445F-AAAF-97C841E6C9C8/Invictus.app/Frameworks/SwiftSignalRClient.framework/SwiftSignalRClient
       0x184921000 -        0x184c25fff Foundation arm64e  <efbca2ff8b8c3227abbc154ba851d23c> /System/Library/Frameworks/Foundation.framework/Foundation
       0x18c477000 -        0x18c4a0fff AudioSession arm64e  <abd54d35666937df90b922ddf1183098> /System/Library/PrivateFrameworks/AudioSession.framework/AudioSession
       0x18390d000 -        0x183dd1fff CFNetwork arm64e  <570aad29ce5c3cd9ab01ad21e1440ddb> /System/Library/Frameworks/CFNetwork.framework/CFNetwork
       0x19007f000 -        0x19038afff CoreMotion arm64e  <9d82cede6b9d36b3a8f8ba0c9782d328> /System/Library/Frameworks/CoreMotion.framework/CoreMotion
       0x19b73b000 -        0x19b79efff libc++.1.dylib arm64e  <ad83bb4ecfd63d39a9e2b8e115bef247> /usr/lib/libc++.1.dylib
       0x109678000 -        0x10a05bfff TwilioVideo arm64  <8ccb732ac7b13187b438b7fc0783154e> /private/var/containers/Bundle/Application/8D285721-E5E0-445F-AAAF-97C841E6C9C8/Invictus.app/Frameworks/TwilioVideo.framework/TwilioVideo

EOF

Steps to Reproduce

  1. Getting notification and we call the methods "connectToRoom"

as soon as user accept the call then application crash with above details.

Code

import UIKit
import TwilioVideo

class VideoChatVC: UIViewController {
	
	var room: Room?
	var camera: CameraSource?
	var localVideoTrack: LocalVideoTrack?
	var localAudioTrack: LocalAudioTrack?
	var remoteParticipant: RemoteParticipant?
	
	@IBOutlet weak var remoteView: VideoView!
	@IBOutlet weak var previewView: VideoView!
	
     func connectToRoom() {
		self.showHUD(message: NSLocalizedString("Connecting...", comment: ""))
		InvictusAPI.get(path: "chat?room=\(self.roomName)") { (code, object) in
			if let data = object as? [String: String], let token = data["token"] {
				self.accessToken = token
				self.connect()
				self.hideHUD()
			}
			//self.reportEndCall() Do not remove this code it's for handle Video call using APNS
		}
	}
	
	func connect() {
		// Preparing the connect options with the access token that we fetched (or hardcoded).
		let connectOptions = ConnectOptions(token: accessToken) { (builder) in
			builder.roomName = self.roomName
		}
		
		// Connect to the Room using the options we provided.
		room = TwilioVideoSDK.connect(options: connectOptions, delegate: self)
		
		logMessage(messageText: "Attempting to connect to room \(String(describing: self.roomName))")
		UIApplication.shared.isIdleTimerDisabled = true
	}

	func prepareLocalMedia() {
		// Create an audio track.
		if (localAudioTrack == nil) {
			localAudioTrack = LocalAudioTrack(options: nil, enabled: true, name: "Microphone")

			if (localAudioTrack == nil) {
				logMessage(messageText: "Failed to create audio track")
			}
		}

		// Create a video track which captures from the camera.
		if (localVideoTrack == nil) {
			startPreview()
		}
		
		GCD.main(closure: {
			 if let localAudio = self.localAudioTrack {
				 self.room?.localParticipant?.publishAudioTrack(localAudio)
				 //self.room?.localParticipant?.addAudioTrack(localAudio)
			 }
		 })
		 if let localVideo = self.localVideoTrack {
			 self.room?.localParticipant?.publishVideoTrack(localVideo)
			 //self.room?.localParticipant?.addVideoTrack(localVideo)
			 //self.previewView.updateVideoSize(self.previewView.videoDimensions, orientation: .up)
		 }
	}
	
	// MARK:- Private
	func startPreview() {
		if PlatformUtils.isSimulator {
			return
		}

		let frontCamera = CameraSource.captureDevice(position: .front)
		let backCamera = CameraSource.captureDevice(position: .back)

		if (frontCamera != nil || backCamera != nil) {

			let options = CameraSourceOptions { (builder) in
				if #available(iOS 13.0, *) {
					builder.orientationTracker = UserInterfaceTracker(scene: UIApplication.shared.keyWindow!.windowScene!)
				}
			}
			// Preview our local camera track in the local video preview view.
			camera = CameraSource(options: options, delegate: self)
			localVideoTrack = LocalVideoTrack(source: camera!, enabled: true, name: "Camera")

			// Add renderer to video track for local preview
			localVideoTrack!.addRenderer(self.previewView)
			logMessage(messageText: "Video track created")

			if (frontCamera != nil && backCamera != nil) {
				// We will flip camera on tap.
				let tap = UITapGestureRecognizer(target: self, action: #selector(VideoChatVC.flipCamera))
				self.previewView.addGestureRecognizer(tap)
			}

			camera!.startCapture(device: frontCamera != nil ? frontCamera! : backCamera!) { (captureDevice, videoFormat, error) in
				if let error = error {
					self.logMessage(messageText: "Capture failed with error.\ncode = \((error as NSError).code) error = \(error.localizedDescription)")
				} else {
					self.previewView.shouldMirror = (captureDevice.position == .front)
				}
			}
		}
		else {
			self.logMessage(messageText:"No front or back capture device found!")
		}
	}
	
	func disconnect() {
		self.room?.disconnect()
		self.localAudioTrack?.isEnabled = false
		self.localVideoTrack?.isEnabled = false
		
		// TODO - For Audio..
		//TVIAudioController.shared().stopAudio()
		self.camera?.stopCapture()
		self.cleanupRemoteParticipant()
		logMessage(messageText: "Attempting to disconnect from room \(room?.name ?? "")")
	}

        func renderRemoteParticipant(participant : RemoteParticipant) -> Bool {
		// This example renders the first subscribed RemoteVideoTrack from the RemoteParticipant.
		let videoPublications = participant.remoteVideoTracks
		for publication in videoPublications {
			if let subscribedVideoTrack = publication.remoteTrack,
				publication.isTrackSubscribed {
				subscribedVideoTrack.addRenderer(self.remoteView!)
				self.remoteParticipant = participant
				return true
			}
		}
		return false
	}

	func renderRemoteParticipants(participants : Array<RemoteParticipant>) {
		for participant in participants {
			// Find the first renderable track.
			if participant.remoteVideoTracks.count > 0,
				renderRemoteParticipant(participant: participant) {
				break
			}
		}
	}

	func cleanupRemoteParticipant() {
		if self.remoteParticipant != nil {
			self.remoteView?.removeFromSuperview()
			self.remoteView = nil
			self.remoteParticipant = nil
			self.room = nil
		}
	}
	
	func logMessage(messageText: String) {
		print(messageText)
	}

        @IBAction func answer() {
		self.leftButtonView.removeFromSuperview()
		self.rightButtonView.removeFromSuperview()
		self.centerButton.autolayout.pinLeft().pinRight()

		self.previewView.isHidden = false
		GCD.main {
			// Prepare local media which we will share with Room Participants.
			self.prepareLocalMedia()
		}
		
	}

}

// MARK:- RoomDelegate
extension VideoChatVC : RoomDelegate {
	func roomDidConnect(room: Room) {
		logMessage(messageText: "Connected to room \(room.name) as \(room.localParticipant?.identity ?? "")")

		// This example only renders 1 RemoteVideoTrack at a time. Listen for all events to decide which track to render.
		for remoteParticipant in room.remoteParticipants {
			remoteParticipant.delegate = self
		}
	}

	func roomDidDisconnect(room: Room, error: Error?) {
		logMessage(messageText: "Disconnected from room \(room.name), error = \(String(describing: error))")
		
		self.cleanupRemoteParticipant()
		self.room = nil
	}

	func roomDidFailToConnect(room: Room, error: Error) {
		logMessage(messageText: "Failed to connect to room with error = \(String(describing: error))")
		self.room = nil
	}

	func roomIsReconnecting(room: Room, error: Error) {
		logMessage(messageText: "Reconnecting to room \(room.name), error = \(String(describing: error))")
	}

	func roomDidReconnect(room: Room) {
		logMessage(messageText: "Reconnected to room \(room.name)")
	}

	func participantDidConnect(room: Room, participant: RemoteParticipant) {
		// Listen for events from all Participants to decide which RemoteVideoTrack to render.
		participant.delegate = self

		logMessage(messageText: "Participant \(participant.identity) connected with \(participant.remoteAudioTracks.count) audio and \(participant.remoteVideoTracks.count) video tracks")
	}

	func participantDidDisconnect(room: Room, participant: RemoteParticipant) {
		logMessage(messageText: "Room \(room.name), Participant \(participant.identity) disconnected")

		// Nothing to do in this example. Subscription events are used to add/remove renderers.
	}
}

// MARK:- RemoteParticipantDelegate
extension VideoChatVC : RemoteParticipantDelegate {

	func remoteParticipantDidPublishVideoTrack(participant: RemoteParticipant, publication: RemoteVideoTrackPublication) {
		// Remote Participant has offered to share the video Track.
		
		logMessage(messageText: "Participant \(participant.identity) published \(publication.trackName) video track")
	}

	func remoteParticipantDidUnpublishVideoTrack(participant: RemoteParticipant, publication: RemoteVideoTrackPublication) {
		// Remote Participant has stopped sharing the video Track.

		logMessage(messageText: "Participant \(participant.identity) unpublished \(publication.trackName) video track")
	}

	func remoteParticipantDidPublishAudioTrack(participant: RemoteParticipant, publication: RemoteAudioTrackPublication) {
		// Remote Participant has offered to share the audio Track.

		logMessage(messageText: "Participant \(participant.identity) published \(publication.trackName) audio track")
	}

	func remoteParticipantDidUnpublishAudioTrack(participant: RemoteParticipant, publication: RemoteAudioTrackPublication) {
		// Remote Participant has stopped sharing the audio Track.

		logMessage(messageText: "Participant \(participant.identity) unpublished \(publication.trackName) audio track")
	}

	func didSubscribeToVideoTrack(videoTrack: RemoteVideoTrack, publication: RemoteVideoTrackPublication, participant: RemoteParticipant) {
		// The LocalParticipant is subscribed to the RemoteParticipant's video Track. Frames will begin to arrive now.

		logMessage(messageText: "Subscribed to \(publication.trackName) video track for Participant \(participant.identity)")

		if (self.remoteParticipant == nil) {
			_ = renderRemoteParticipant(participant: participant)
		}
	}
	
	func didUnsubscribeFromVideoTrack(videoTrack: RemoteVideoTrack, publication: RemoteVideoTrackPublication, participant: RemoteParticipant) {
		// We are unsubscribed from the remote Participant's video Track. We will no longer receive the
		// remote Participant's video.
		
		logMessage(messageText: "Unsubscribed from \(publication.trackName) video track for Participant \(participant.identity)")

		if self.remoteParticipant == participant {
			cleanupRemoteParticipant()

			// Find another Participant video to render, if possible.
			if var remainingParticipants = room?.remoteParticipants,
				let index = remainingParticipants.firstIndex(of: participant) {
				remainingParticipants.remove(at: index)
				renderRemoteParticipants(participants: remainingParticipants)
			}
		}
	}

	func didSubscribeToAudioTrack(audioTrack: RemoteAudioTrack, publication: RemoteAudioTrackPublication, participant: RemoteParticipant) {
		// We are subscribed to the remote Participant's audio Track. We will start receiving the
		// remote Participant's audio now.
	   
		logMessage(messageText: "Subscribed to \(publication.trackName) audio track for Participant \(participant.identity)")
	}
	
	func didUnsubscribeFromAudioTrack(audioTrack: RemoteAudioTrack, publication: RemoteAudioTrackPublication, participant: RemoteParticipant) {
		// We are unsubscribed from the remote Participant's audio Track. We will no longer receive the
		// remote Participant's audio.
		
		logMessage(messageText: "Unsubscribed from \(publication.trackName) audio track for Participant \(participant.identity)")
	}

	func remoteParticipantDidEnableVideoTrack(participant: RemoteParticipant, publication: RemoteVideoTrackPublication) {
		logMessage(messageText: "Participant \(participant.identity) enabled \(publication.trackName) video track")
	}

	func remoteParticipantDidDisableVideoTrack(participant: RemoteParticipant, publication: RemoteVideoTrackPublication) {
		logMessage(messageText: "Participant \(participant.identity) disabled \(publication.trackName) video track")
	}

	func remoteParticipantDidEnableAudioTrack(participant: RemoteParticipant, publication: RemoteAudioTrackPublication) {
		logMessage(messageText: "Participant \(participant.identity) enabled \(publication.trackName) audio track")
	}

	func remoteParticipantDidDisableAudioTrack(participant: RemoteParticipant, publication: RemoteAudioTrackPublication) {
		logMessage(messageText: "Participant \(participant.identity) disabled \(publication.trackName) audio track")
	}

	func didFailToSubscribeToAudioTrack(publication: RemoteAudioTrackPublication, error: Error, participant: RemoteParticipant) {
		logMessage(messageText: "FailedToSubscribe \(publication.trackName) audio track, error = \(String(describing: error))")
	}

	func didFailToSubscribeToVideoTrack(publication: RemoteVideoTrackPublication, error: Error, participant: RemoteParticipant) {
		logMessage(messageText: "FailedToSubscribe \(publication.trackName) video track, error = \(String(describing: error))")
	}
}

// MARK:- VideoViewDelegate
extension VideoChatVC : VideoViewDelegate {
	func videoViewDimensionsDidChange(view: VideoView, dimensions: CMVideoDimensions) {
		self.view.setNeedsLayout()
	}
}

// MARK:- CameraSourceDelegate
extension VideoChatVC : CameraSourceDelegate {
	func cameraSourceDidFail(source: CameraSource, error: Error) {
		logMessage(messageText: "Camera source failed with error: \(error.localizedDescription)")
	}
}

Expected Behavior

Call should connect and able to join the Room.

Reproduces How Often

Happen every time.

Versions

All relevant version information for the issue.

Video iOS SDK

pod 'TwilioVideo', '~> 4.6'

Xcode

Xcode 13.0

iOS Version

iOS 15.1

iOS Device

iPhone 12

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

1 participant