-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Android 11 IncorrectContextUseViolation in VideoFrameReleaseTimeHelper #8246
Comments
This is probably a result of changes in Android to better support multi-display devices. These changes mean that visual services should be retrieved in a way that identifies the display on which the app is running. This is somewhat tricky to fix in ExoPlayer's case. For now, you should be fine to ignore/disable the warning. We'll need to figure out a way of addressing this at some point though, so thanks for filing the issue! |
Would love to see this addressed. Following through the stack trace it appears (at a quick glance) that replacing |
I agree it's quite straightforward for the common case of video playback in a single activity. However, there are some complications for other cases. For example, it's quite easy to accidentally leak an activity context with the suggested approach, particularly for use cases where playback may transition between activities, or be detached from an activity altogether (e.g., for transitioning into background playback). If the player is initially constructed for background playback, then the application may not have a suitable context to provide at construction time. More generally, |
As a short term fix, it looks like we can just replace use of |
Thank you very much for the additional context, that makes a lot of sense. I would be happy with the mentioned short-term fix. |
Issue: #8246 PiperOrigin-RevId: 378606475
Issue: #8246 PiperOrigin-RevId: 378606475
An application context is used to retrieve window manager in VideoFrameReleaseTimeHelper, which Android 11 StrictMode warns about.
Seems there's another way that should be used on recent android versions: https://github.com/microsoft/appcenter-sdk-android/pull/1429/files#diff-aeda387f31bf19cc06b12c402a17da91e0fc84cd47675e1d74164ca2fd164fdfR153-R166
version 2.11.7
The text was updated successfully, but these errors were encountered: