androidx / androidx/media

How to prevent HDR tracks from being selected when connected to a non-HDR display

Open
#1,074 1 comment 0 reactions 1 assignee View on GitHub

Nobody has claimed this yet.

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

Description

We have HDR (HLG) streams and when these streams are played on a TV that does not support HDR, and ExoPlayer selects the HDR tracks, the colors look noticeably more washed/grayed than if a "normal" SDR track is played.

We have tested this on an LG TV that supports HLG connected to a Chromecast with Google TV (Android 12) and when disabling HDR (from the settings on the CC) the same HDR tracks are selected by ExoPlayer.

When HDR is enabled on CC display.getHdrCapabilities().getSupportedHdrTypes() contains HDR_TYPE_DOLBY_VISION and HDR_TYPE_HLG, and when disabled it is empty (as expected).

So my question is twofold:

  1. Why does ExoPlayer select HDR tracks (at least when SDR tracks are also present) when getSupportedHdrTypes() does not indicate HDR support? Based on the HDR video playback section it's not clear to me if calling getSupportedHdrTypes() is something the users of ExoPlayer has responsibility of doing, but my initial expecation was that ExoPlayer would handle this for us.
    I found this comment which indicates that this will be ExoPlayers responsibility (ExoPlayer does not avoid HDR tracks when connected to a display that does not support them, and this is something that we plan to address soon.), if so is this something we can expect to change in the near future?
  2. How could we disable HDR tracks ourself based on getSupportedHdrTypes()? Maybe it's possible to compare Format.colorInfo.colorTransfer to COLOR_TRANSFER_HLG and disabling the respective tracks, but I'm not sure where I would put that logic (doing it in onTracksChanged() might be a bit weird as it would possibly result in the track being selected and disabled right away and would probably result in losing the benefits of adaptive track selection). Not sure if there are other indications of a track being HDR, looking at HlsPlaylistParser it doesn't seem like the VIDEO-RANGE=HLG tag is parsed and kept

An option we could consider is to tell our backend the state of getSupportedHdrTypes() and only get back streams with SDR tracks if we can't display HDR, but if ExoPlayer could just ignore the tracks that seems like a better solution

Here are two streams to test with:

I've taken some pictures of these streams from the demo app to demonstrate the problem (the interesting ones to compare are HDR track with HDR disabled to SDR track, the proper HDR are there for completeness)

Example 1

HDR track with HDR enabled

HDR track with HDR disabled

SDR track

Example 2

HDR track with HDR enabled

HDR track with HDR disabled

SDR track

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.