Open haroldh17 opened 11 months ago
I'm experiencing this issue as well, would love some feedback here from the team.
iPhone 15 iOS 17 AmazonChimeSDK Version: 023.3 AmazonChimeSDKMedia Version: 0.18.3
I too have iOS 17 and it also happens with the react native demo! Just run the demo and toggle the camera on and off a few times, you will see it.
We are actively investigating this issue and will update here as soon as we have more information to provide. Thank you for your patience.
Our RN demo does not have a switch camera button, but I am not able to reproduce the issue on iOS 17 by quickly toggling the video on/off button.
I am also unable to repro this on the iOS SDK demo app with iOS 17 either by quickly toggling the camera switch button or quickly toggling the video on/off button.
I used iPhone 12 with iOS 17 for both tests. For the RN Demo we only support up to 0.22.7 version of AmazonChimeSDK, so that is what I used to test. For iOS SDK Demo, I used AmazonChimeSDK version 0.23.3. I'll try to locate an iPhone 15 for testing.
Is the iPhone model the only difference in setup? Did I get the repo steps right?
Here is a similar issue that was resolved by using NSLock in start and stop functions: https://github.com/aws/amazon-chime-sdk-ios/issues/231
I was also unable to reproduce this issue on iPhone 15.
Are there any variations in your setup or environment that might allow us to reproduce this issue?
We've been having the same issue and it seems to be happening more frequently since iOS 17. We can repro by toggling the camera on/off a few times in a row.
We have a serial dispatch queue on which we run all our interactions with the Chime SDK client. I believe this might not repro if functions like startLocalVideo
are called directly from the main thread.
The issue is a race in DefaultCameraCaptureSource if start
is called from a background thread:
updateOrientation
is called between commitConfiguration
and startRunning
(link)updateOrientation
dispatches to the main thread and sets the video orientation. (link) Internally, setting the orientation on the connection also triggers begin
/commitConfiguration
events.start
is called from a background thread, there's a risk that the update to the video orientation (on the main thread) happens in parallel to the call to startRunning
(on the background thread), which will then trigger the exception.Hi team,
Got the same issue in iOS version 16.6
when we toggled (ON/OFF) the camera multiple times.
We are using:-
AmazoneChimeSDK-0.22.3
AmazoneChimeSDKMedia-0.17.7
"react-native": "^0.71.11",
setCameraOn--*** -[AVCaptureSession startRunning] startRunning may not be called between calls to beginConfiguration and commitConfiguration
Hi team We face the same issue in Android sometimes.
Adding that we're also seeing this inconsistently (maybe 1/3 of the time) if attempting to start local video on a background thread. Can be as simple as
DispatchQueue.global().async {
do {
try meetingSession.audioVideo.startLocalVideo()
} catch {
// the error is not actually caught
}
}
Switching to main thread seems to mitigate the issue, we just get a runtime warning then that
-[AVCaptureSession startRunning] should be called from background thread. Calling it on the main thread can lead to UI unresponsiveness
which is expected, but not ideal
DispatchQueue.global() is concurrent queue, please use serial queue, please also make sure always use the same serial queue.
@georgezy-amzn thanks for the suggestion! Unfortunately I'm still seeing the issue. I implemented a serial queue, and am still seeing the same result:
private static var serialQueue = DispatchQueue(label: "chime.video.provider") // static class var to ensure that I'm not accidentally using multiple queues
...
func refreshVideo() {
Self.serialQueue.async { in
...
do {
try meetingSession.audioVideo.startLocalVideo() // hits the exception
} catch {
// does not catch
}
}
}
We call startLocalVideo
in our primary connection function, as well as in this "refreshVideo" function - our application has some scenarios where we have to pause a user's connection to a session and then refresh their connection. I'm seeing it sometimes crash on the first call in the connection function, but sometimes that succeeds, and it still fails then when we refresh the connection
I poked around Chime's DefaultCameraCaptureSource.start()
source code, and it seems like all paths should be safe in terms of not being able to escape without committing the configuration, even if there were an error. FWIW, I have the ChimeLogger logging all errors and faults, and I'm not seeing any before we hit this crash.
I also took a look at the usage of startLocalVideo
in the ViewModel
in the demo code - it doesn't seem that any special thread configurations are being used around that function call. Is there somewhere this is configured that I'm missing?
It does seem like this is a thread configuration issue - it works when using DispatchQueue.main.async
, and from what I understand, that's just a globally available serial queue, albeit with come special configurations I'm sure. Any ideas on what else I could try here? I'm not the most familiar with customizing serial queues, so I'm sure there's something here I just don't know to look for
Hi, we will release the fix in next release. Meanwhile, you can create a custom source by duplicate the DefaultCameraCaptureSource from this commit, and inject it when start local video.
Describe the bug I have a React Native App using AWS Chime SDK based on your demo code amazon-chime-react-native-demo
When I use the switchCamera function, it works but if I do it several times in a row, I eventually get the following native exception:
It also happens when I toggle on and off the camera too many times. or when I start the session (or any native functions that I can call)
To Reproduce Steps to reproduce the behavior: Flip the local video from front camera to back camera multiple times on iOS.
Expected behavior No exception is thrown
Screenshots
Test environment Info (please complete the following information):
Let me know if you need more information