media: Adding `player#setVideoEffect(emptyList())` workaround causes hevc video to be stuck
Version
Media3 1.4.0
More version details
commit hash: b01c6ffcb3fca3d038476dab5d3bc9c9f2010781
Devices that reproduce the issue
Sony BRAVIA device build-in Android 9
Devices that do not reproduce the issue
CCwGTV
Reproducible in the demo app?
Yes
Reproduction steps
This is a workaround from https://github.com/google/ExoPlayer/issues/11038
This can be reproduce on demo app.
-
Add the
lib-effectdependency tobuild.gradle(:demo). -
Add
player.setVideoEffects(new ArrayList<>());toPlayerActivity#initializePlayer(). -
Build the demo app and select any H.265 codec video to play. (Here, I selected
clear dash HD (mp4, H.265)). -
Observe the issue.
Expected result
play correctly, each frame correct and player will stop(ended) when content finish.
Actual result
PlayerView frame display stucked, but (progress bar time /upper log rb:<value>) keep growing.
When Play to end, the progress bar time still go over
(e.g. timer display will show 13:38-12:14, even video only got 12m14s)
Media
demo app clear dash HD (mp4, H.265)
Bug Report
- You will email the zip file produced by
adb bugreportto android-media-github@google.com after filing this issue.
About this issue
- Original URL
- State: open
- Created 2 years ago
- Comments: 22 (10 by maintainers)
There could be two causes,
They are both device-specific lacking capability and unfortunately I don’t think there’s a easy way to workaround it.
This is because OpenGL failed to launch and MediaCodecVideoRenderer did not start the codec
My apologies 🤦🏻 The correct logging point is in
MediaCodecVideoRenderer,https://github.com/androidx/media/blob/76088cd6af7f263aba238b7a48d64bd4f060cb8b/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/video/MediaCodecVideoRenderer.java#L1041C45-L1041C71
But the log gives some hint too:
This is a sign - it’s likely that the phone is not capable to decode such video. Later the device reported
eglCreateContext() failed to create a valid context. The device may not support EGL version 2, this might have caused the failure too.To see if 4K DV decoding is supported, you could try playing the video without effects. I don’t know what to do if EGL is not supported though. I wonder what device are you testing on? Do you have another device to test against?
This is expected - it only works when effects are used.
This is very strange - it should be set regardless of video effects, let me try to see if something’s obviously wrong, but I’m very surprised to see this.
This one is an adaptive stream - meaning the resolution could switch during playback, as you can see from the log.
I think this might be an extractor/decoder issue then rather than a video frame processing issue. It seems the problem is the decoder/extractor didn’t mark the last frame in the file as the last one. But before I can be 100% sure, could you double check this only happens when you use
setVideoEffects()?It actually can be called multiple times on one buffer before that buffer is fully processed. So the fact that it is called multiple times doesn’t necessarily mean there’s a problem in there
Yes, it’s not automatically logged. I think you can call it when you exit the PlayerView, maybe
onDestroy()?No rush!
Hmm I cannot reproduce locally, can you try turn on the
DebugTraceUtil, capture the log and report it here?https://github.com/androidx/media/blob/b01c6ffcb3fca3d038476dab5d3bc9c9f2010781/libraries/effect/src/main/java/androidx/media3/effect/DebugTraceUtil.java#L57