Is there a reliable* way to determine if HEVC and VP9 are supported in hardware in a given device? We need to know it before playback starts, because a given asset is available in H264, HEVC and VP9 -- but not in the same DASH/HLD stream. We want to select the best stream for the device, and avoid playing HEVC in software because it kills the CPU/battery.
(*) Reading #4757 and #4833, I understand the common method of looking at "OMX.google" is not reliable. In a stream that has both H264 and HEVC, how does ExoPlayer choose what to play?
In a stream that has both H264 and HEVC, how does ExoPlayer choose what to play?
I might be wrong but it looks like:
Exoplayer will iterate through all available groups for video renderer and choose the first one with adaptive support. This group will be used for adaptive playback.
If allowMixedMimeAdaptiveness set to false - this selected group will contain only tracks with mimeType which appears more on the group itself (of course only tracks with adaptive support will count.)
So if you have 5 avc and 6 hevc mimeTypes on the same group, allowMixedMimeAdaptiveness = false and we assume that all of them are adaptive and meet viewport requirements -> your adaptive group will contain only 6 hvc codecs.
If allowMixedMimeAdaptiveness set to true your adaptive group will contain 11 tracks.
And if you have 2 groups for video renderer lets say group[0] with avc only and group[1] with hevc only and all of the tracks support adaptive and viewport requirements exoplayer will prefer group[0].
As for reliable way to determine if HEVC or VP9 supported in hardware for specific device, I cannot think about any other way to decide - except of some sort of "stress-test" on the first launch of the application. Tracking cpu usage while playing some specific codec will give most reliable answer if this device is optimized for hardware acceleration or not. :)
As you can see in the comments of #4833: Codec name check is a best effort test. There is no 100% reliable way to determine whether a codec is hardware supported.
I've created a feature-request in Android's issue tracker, asking for a hardware support flag on MediaCodecInfo:
https://issuetracker.google.com/issues/123015413
Note that MediaCodecInfo in Android Q has more info about a codec, including the fact that a codec is software only, etc.
@ojw28 are there any plans of using this new information for better codec selection?
That's interesting; thanks! I've filed https://github.com/google/ExoPlayer/issues/5839 to look at this.