-
Notifications
You must be signed in to change notification settings - Fork 452
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
MediaSessionService onCreate ANR error #2030
Comments
From the stack traces it looks like calls into the framework are taking too long and causing the ANR?
|
There's already a couple of other reported issues, audioManager use IPC binding to access and can ANR, there's a few other places where it's problematic. |
@icbaker Yes. The service is started externally in a normal way, with nothing special and no other tasks. Online users report a large number of ANRs. |
@Tolriq Thanks. Is there any way to solve this or reduce the number of ANR? |
Do not instantiate ExoPlayer on mainthread until all those are fixed. I would recommend using a dedicated thread for the whole player access and callbacks, but just instantiate on background and pass the mainthread looper will remove a couple of ANRs due to IPC. I use the dedicated thread approach + wrote a custom component to workaround #1550 that happens even in that case. No more ANRs due to Media3. |
We are currently working on changes that move all potentially blocking system calls away from the main thread, so that hopefully none of these workarounds should be needed in the future. |
@Tolriq Thanks for reply. Some of it can be done in a non-main thread, which should alleviate ANR. |
@tonihei Thanks. Looking forward to this solution. |
@tonihei Hi, by the way, which version is expected to add these changes? |
Media3 Version
1.3.1
Devices that reproduce the issue
Google Play and Firebase report these devices:
including Android 11, 12, 13, 14
Reproduction steps
(online production environment)
Expected result
not ANR crash
Actual result
many ANR errors
Description
When using media3 exoplayer to implement an audio player, a large number of ANRs are encountered. The basic implementation is as follows.
AudioConnection is a singleton. Initialize AudioConnection and use it to play audio after initialization is complete.
AudioConnection.getInstance(context, ComponentName(context, AudioService::class.java))
Two examples of stack trace are as follows. There are some other stack traces with slightly different contents.
The text was updated successfully, but these errors were encountered: