androidx / androidx/media

Decoder init failed error on some AndroidTV devices

Open
#936 7 comments 0 reactions 1 assignee View on GitHub

@icbaker is already working on this.

Since Jan 3, 2024.

bug: device specific
Dominant language
Java
Stars
3k
Forks
955
Avg merge
12d 14h
Merged PRs (30d)
2

Description

Version

ExoPlayer 2.18.5

More version details

I'm following this doc(https://developer.android.com/guide/topics/media/exoplayer/ad-insertion#client-using-third-party)
implementing a custom AdsLoader that wraps our ads SDK.
Previously, we implemented seamless content and ad switching using two ExoPlayer instances.
Now, we have achieved the same seamless switching using a custom AdsLoader with a single-player instance.
We tested this solution on the production environment and put it under an experiment. We noticed that this approach resulted in a significant increase in "Decoder init failed" errors on Android TV, roughly seven times more than before.

Error cause
Decoder init failed: OMX.amlogic.hevc.decoder.awesome2.secure, Format(1, null, null, video/hevc, hvc1.1.6.L90.90, 1205048, null, [854, 480, 23.974], [-1, -1])
Error message
com.google.android.exoplayer2.ExoPlaybackException: MediaCodecVideoRenderer error, index=0, format=Format(1, null, null, video/hevc, hvc1.1.6.L90.90, 1205048, null, [854, 480, 23.974], [-1, -1]), format_supported=YES

Below is the code I used to build the DrmConfiguration

val drmConfiguration = MediaItem.DrmConfiguration.Builder(C.WIDEVINE_UUID)
                        .setLicenseUri(videoResource.getLaUrl())
                        .setLicenseRequestHeaders(
                            mapOf(videoResource.getAuthHeaderKey() to videoResource.getAuthHeaderValue())
                        )
                        .setMultiSession(true)
                        .setPlayClearContentWithoutKey(true)
                        .build()

The error led to interruptions in playback for many users. It happened when switching from Widevine-encrypted video content to clear ads.
However, this error doesn't increase on Android phones.
The differing behavior between Android phones and TVs suggests a potential hardware-related issue.
I've observed a previous issue that might be related to the problem I'm experiencing now. The previous solution involved sleeping for 50ms when creating a decoder fails and then attempting to create it again.

I have a few ideas for addressing this issue, and I'd like to hear your thoughts:

  1. Increase the sleep duration and make it a user-configurable parameter.
  2. After a decoder initialization failure, attempt initialization multiple times, with the number of retries being a user-configurable parameter.

If these approaches are viable, I can submit a pull request (PR) to implement these changes.
Also, would you happen to have a better solution in mind?

Devices that reproduce the issue

Not a device specific issue:
SmartTV 4K, Hisense
Philips 4K A1
Smart TV, TCL

Devices that do not reproduce the issue

No response

Reproducible in the demo app?

Yes

Reproduction steps

This issue is not 100% reproducible, but It should be reproduceable with the demo app.
I will try to reproduce it in the demo app.

Expected result

No PlaybackException with decoder init failed when switching from WideoVide video content to clear ad.

Actual result

Some times there is an PlaybackException with decoder init failed when switching from WideoVide video content to clear ad.

Media

Any WideVine media stream

 {
        "name": "HD (cenc)",
        "uri": "https://storage.googleapis.com/wvmedia/cenc/h264/tears/tears.mpd",
        "drm_scheme": "widevine",
        "drm_license_uri": "https://proxy.uat.widevine.com/proxy?video_id=2015_tears&provider=widevine_test"
      }
Bug Report
  • You will email the zip file produced by adb bugreport to android-media-github@google.com after filing this issue.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.