iOS 14 crash after calling play() for each streaming source

andrew.n

Member
The video call feature worked well on iOS 13.x.x.
After I made the update to iOS 14 and start testing again the video call, in some cases, after I call the play() function for each streaming source the app crashes.
It looks like it's an issue with the UI setup that is not performed on the main thread.

This crash is not happening every time. Sometimes the video call setup works the same as on iOS 13.
On iOS 13.x.x I didn't have this issue.

Screenshot 2020-09-22 at 12.23.42.png


Debug logs:
[2263:467636] Metal GPU Frame Capture Enabled
[2263:467636] Metal API Validation Enabled
[2263:467636] Failed to bind EAGLDrawable: <CAEAGLLayer: 0x13b9485e0> to GL_RENDERBUFFER 1
[2263:467636] Failed to make complete framebuffer object 8cd6
[2263:467636] Failed to bind EAGLDrawable: <CAEAGLLayer: 0x13b96c490> to GL_RENDERBUFFER 1
[2263:467636] Failed to make complete framebuffer object 8cd6
[2263:467636] Video mandatory constraints:{
minHeight = 1792;
minWidth = 828;
}
[2263:468165] *** Assertion failure in -[FBSSerialQueue assertBarrierOnQueue], FBSSerialQueue.m:127
[2263:467636] Source is running 0
[2263:468165] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'threading violation: expected the main thread'
*** First throw call stack:
(0x19e5b65ac 0x1b263042c 0x19e4bf1b4 0x19f81d7bc 0x1ad5b97f8 0x1ad566260 0x1ad5664e0 0x1ad5663e0 0x1a09c3f7c 0x1a0acd1a4 0x1a0acdf20 0x100aaa6d4 0x105733b68 0x1057355f0 0x10573cfa8 0x10573dcb4 0x105749e38 0x1e5b08908 0x1e5b0f77c)
libc++abi.dylib: terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'threading violation: expected the main thread'
terminating with uncaught exception of type NSException
 
Last edited:

andrew.n

Member
I build the two-way streaming demo app on an iPhone with iOS 14.0 and I used the demo web page to set up the connection.
On the device, I couldn't see the streaming source video (from mac) and also in the debugger I saw some issues regarding the UI changes that were done on a background thread:

Main Thread Checker: UI API called on a background thread: -[UIApplication applicationState]
PID: 4068, TID: 1041665, Thread name: (none), Queue name: EncoderQueue, QoS: 0


The first time when I run the demo app on my device having iOS 13, everything was fine, I could see both local streaming video and remote streaming video.

full debugging logs:
 

Max

Administrator
Staff member
On the device, I couldn't see the streaming source video (from mac)
Recently, we found some regression in latest build that was installed to demo server demo.flashphoner.com. For example, stream publishing from latest Chrome on MacOS did not work (and player see no video in this case). We just rolled back demo server to last working build.
Also, some customers use demp server as production, so it may be under high load in some hours. We solving this problem now.
also in the debugger I saw some issues regarding the UI changes that were done on a background thread:
Main Thread Checker: UI API called on a background thread: -[UIApplication applicationState]
PID: 4068, TID: 1041665, Thread name: (none), Queue name: EncoderQueue, QoS: 0
There is the ticket WCS-2641 to fix it, but this issue does not affect stream publishing or playing in application. We'll let yuo know when fix it.
 

andrew.n

Member
@Max I found something during the debugging sessions that is related to this thread.
As you can see the exception is caused by SocketRocket (com.squareup.SocketRocket.NetworkThread)

Also, I found out that this issue can also happen for ios 13: https://github.com/facebookarchive/SocketRocket/issues/616

The ugly part on this is that SocketRocket is no longer maintained for a while: https://github.com/facebookarchive/SocketRocket/issues/576

I want to know, is there any estimated date for an update of this framework, including iOS 14 updates? (such as updating to the "New Build System", and demo projects updated for iOS 14?)
 

Attachments

Max

Administrator
Staff member
I want to know, is there any estimated date for an update of this framework, including iOS 14 updates? (such as updating to the "New Build System", and demo projects updated for iOS 14?)
Unfortunately, we cannot provide any ETA for simple licence support tickets.
Currently, we have the following roadmap:
1. Ticket WCS-2794: update WebRTC library and switch from RTCEAGLVideoView to RTCMTLVideoView to resolve scaling issues. This will be a new minor iOS SDK release. Please note we do not work with SocketRocket directly, but WebRTC library code does. Probably, new WebRTC library versions have a workaround for this issue.
2. Ticket WCS-2878: allow to connect to custom image capturer implementation (GPUImage library support)
3. Ticket WCS-2641: fix background UI thread issue
4. Ticket WCS-2853: migrate from Objective C to Swift. This will be a new major iOS SDK release. At this stage, we'll update to new build system.
 

andrew.n

Member
Any updates regarding points 1 and 3, @Max? We have to release the app but one of the core features of the app is not working properly.
 

Max

Administrator
Staff member
Good day.
Both tickets WCS-2794 and WCS-2878 are on testing stage now. Please be patient.
 

Max

Administrator
Staff member
Good day.
We released iOS SDK build 2.6.1 as mentioned earlier. SocketRocket is also updated to latest build from CocoaPods, and example apps are not crashing in our tests.
The tickets WCS-2641 and WCS-2853 still in progress.
 

Max

Administrator
Staff member
Good day.
Hi, can you guys tell something about Ticket WCS-2853, waiting for it)
The ticket WCS-2853 is on testing stage. We'll let you know in this topic when Swift SDK implementation and examples will be ready.
 

Max

Administrator
Staff member
Good day.
Since build 2.6.19, iOS SDK includes two frameworks: Objective C and Swift
Please review Swift framework examples description here and source code here
 

andrew.n

Member
Hey @Max I just included the Swift version of the SDK and when I launch the app it crashes with this issue Version 2.6.19:
Code:
dyld: Library not loaded: @rpath/FPWCSApi2Swift.framework/FPWCSApi2Swift
  Referenced from: /private/var/containers/Bundle/Application/D8BAEE7C-249B-473E-A054-1E66334F3D93/AppName.app/AppName
  Reason: image not found
dyld: launch, loading dependent libraries
DYLD_LIBRARY_PATH=/usr/lib/system/introspection
DYLD_INSERT_LIBRARIES=/Developer/usr/lib/libBacktraceRecording.dylib:/Developer/usr/lib/libMainThreadChecker.dylib:/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib
Also, I have those warnings:
Screenshot 2021-02-08 at 11.54.17.png



Also I tried to update from 2.6.8 to 2.6.10 but it looks the situation was even worst:
Code:
dyld: Library not loaded: @rpath/FPWCSApi2.framework/FPWCSApi2
  Referenced from: /Users/username/Library/Developer/CoreSimulator/Devices/8C666943-9BE2-439C-A433-00C26123870F/data/Containers/Bundle/Application/1481598B-F43D-4840-8ADE-F47BA44F7D82/AppName.app/AppName
  Reason: image not found
dyld: launch, loading dependent libraries
DYLD_SHARED_CACHE_DIR=/Users/username/Library/Developer/CoreSimulator/Caches/dyld/20D64/com.apple.CoreSimulator.SimRuntime.iOS-14-2.18B79
DYLD_ROOT_PATH=/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 14.2.simruntime/Contents/Resources/RuntimeRoot
DYLD_LIBRARY_PATH=/Users/username/Library/Developer/Xcode/DerivedData/AppName-bxwkikkxazzdiqegsfonrunjorom/Build/Products/Debug-iphonesimulator:/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 14.2.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/introspection
DYLD_INSERT_LIBRARIES=/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 14.2.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libBacktraceRecording.dylib:/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 14.2.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libMainThreadChecker.dylib:/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 14.2.simruntime/Contents/Resources/RuntimeRoot/Developer/Library/PrivateFrameworks/DTDDISupport.
(lldb)
 
Last edited:

Max

Administrator
Staff member
Please check if the problem is reproducing while building TwoWayStreamingSwift or MediaDevicesSwift examples by this guide. If not, please modify TwoWayStreamingSwift example code to reproduce the issue and send using this private form.
 

andrew.n

Member
So, we have built Two Way Streaming example on Mac OS Mojave using Xcode 10.1 from the source code using the iOS SDK (FPWCSApi2.framework) and executed this example on iPhone 6. The example demonstrated successful streaming of a video through Web Call Server 5.
Small note, I updated to macOS 11.2 Big Sur... Have you tried this on Big Sur?
 

Max

Administrator
Staff member
Small note, I updated to macOS 11.2 Big Sur... Have you tried this on Big Sur?
Yes, our sample project is successfully build on 11.1 Bug Sur in XCode 12.3
We checked your project, but it even cannot be build due to WebRTC conflict. Since iOS SDK build 2.6.10 we revert back to build-in WebRTC framework because it needs to be patched to prevent microphone permissions request for playback only. So GoogleWebRTC pod is not needed.
Please get the latest sample project sources from GitHub and try to build TwoWayStreamingSwift example according to the manual. If this example is built and run successfully, use the project setup as sample.
 
Top