Skip to content

Commit

Permalink
Add masking to correctly select renderer
Browse files Browse the repository at this point in the history
Issue: #2269

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=143433012
  • Loading branch information
ojw28 committed Jan 4, 2017
1 parent 39827fa commit faff5ec
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -345,15 +345,16 @@ protected abstract TrackSelection[] selectTracks(RendererCapabilities[] renderer
private static int findRenderer(RendererCapabilities[] rendererCapabilities, TrackGroup group)
throws ExoPlaybackException {
int bestRendererIndex = rendererCapabilities.length;
int bestSupportLevel = RendererCapabilities.FORMAT_UNSUPPORTED_TYPE;
int bestFormatSupportLevel = RendererCapabilities.FORMAT_UNSUPPORTED_TYPE;
for (int rendererIndex = 0; rendererIndex < rendererCapabilities.length; rendererIndex++) {
RendererCapabilities rendererCapability = rendererCapabilities[rendererIndex];
for (int trackIndex = 0; trackIndex < group.length; trackIndex++) {
int trackSupportLevel = rendererCapability.supportsFormat(group.getFormat(trackIndex));
if (trackSupportLevel > bestSupportLevel) {
int formatSupportLevel = rendererCapability.supportsFormat(group.getFormat(trackIndex))
& RendererCapabilities.FORMAT_SUPPORT_MASK;
if (formatSupportLevel > bestFormatSupportLevel) {
bestRendererIndex = rendererIndex;
bestSupportLevel = trackSupportLevel;
if (bestSupportLevel == RendererCapabilities.FORMAT_HANDLED) {
bestFormatSupportLevel = formatSupportLevel;
if (bestFormatSupportLevel == RendererCapabilities.FORMAT_HANDLED) {
// We can't do better.
return bestRendererIndex;
}
Expand Down

0 comments on commit faff5ec

Please sign in to comment.