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.

  1. Add the lib-effect dependency to build.gradle (:demo). image

  2. Add player.setVideoEffects(new ArrayList<>()); to PlayerActivity#initializePlayer(). image

  3. Build the demo app and select any H.265 codec video to play. (Here, I selected clear dash HD (mp4, H.265)).

  4. 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) image

Media

demo app clear dash HD (mp4, H.265)

Bug Report

  • You will email the zip file produced by adb bugreport to 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)

Most upvoted comments

There could be two causes,

  1. The video is Dolby-Vision and the device is unable to decode it
  2. The device has insufficient OpenGL support to play HDR (Dolby-Vision) video

They are both device-specific lacking capability and unfortunately I don’t think there’s a easy way to workaround it.

I tried without adding player.setVideoEffects(new ArrayList<>()); then got log below.

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:

  • You are using a MTK chipset,
  • You are decoding a 4K video
    • And the video is Dolby-Vision (DV)

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?

generateTraceSummary() gives all fields “No events”.

This is expected - it only works when effects are used.

isLastBuffer is set to true correctly

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.

Clear Dash UHD (mp4, H.265)

This one is an adaptive stream - meaning the resolution could switch during playback, as you can see from the log.

Then check the log, it seems it has not been set to true.

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()?

processOutputBuffer() has been called somewhere too many times, causing the issue?

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

So, should I call generateTraceSummary() then logging strings to somewhere them provide it?

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