ANR When Camera Stopped
cyodrew opened this issue · 4 comments
Before filing an issue please check that the issue is not already addressed by the following:
Please ensure that you are not sharing any
Personally Identifiable Information(PII)
or sensitive account information (API keys, credentials, etc.) when reporting an issue.
Description
I'm getting some reports in Crashlytics of ANRs when stopCapture
is called on Camera2Capturer
, usually when the local video track is released during the onPause
lifecycle event.
Steps to Reproduce
- Have the app call
onPause
either due to placing the app in the background or finishing the activity - This causes the camera track to be released
- The
Camera2Capturer
callsstopCapture
and blocks the main thread due to thewait
call not being notified.
Code
N/A
Expected Behavior
The camera is released and not blocking the main thread.
Actual Behavior
The app gets stuck waiting for the camera to be released.
Reproduces how Often
Not often, but could be due to some sort of race condition. There's been 42 occurrences in the last 90 days of our app.
Logs
// Log output when issue occurs
main (waiting): tid=1 systid=15989
at java.lang.Object.wait(Native method)
at java.lang.Object.wait(Object.java:442)
at java.lang.Object.wait(Object.java:568)
at tvi.webrtc.CameraCapturer.stopCapture(CameraCapturer.java:286)
at tvi.webrtc.Camera2Capturer.stopCapture(Camera2Capturer.java:18)
at com.twilio.video.Camera2Capturer.stopCapture(Camera2Capturer.java:279)
...
at com.twilio.video.LocalVideoTrack.release(LocalVideoTrack.java:281)
Versions
All relevant version information for issue.
Video Android SDK
7.3.1
Android API
33
Android Device
Mostly Samsung devices (>90%), a few Pixel devices and others
Same here!
Some progress?
@cyodrew @flipper09112 Thank you for the bug report, two questions...
- Are you using code from the Quickstart?
- We have fixed many camera issues between 7.3.1 & 7.5.1. Have you tested with latest version?
@afalls-twilio I have not been able to produce the issue in the Quickstart but it doesn't happen often in our app either. I will update our app with the latest SDK version and report back here, thanks!
@cyodrew Thank you for attempting with the QuickStart, is the issue still happening post upgrade?