From faff5ec910d4f8bc8c1f7b2e709a325dc3ebe4a9 Mon Sep 17 00:00:00 2001 From: olly Date: Tue, 3 Jan 2017 05:02:01 -0800 Subject: [PATCH] Add masking to correctly select renderer Issue: #2269 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=143433012 --- .../trackselection/MappingTrackSelector.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/library/src/main/java/com/google/android/exoplayer2/trackselection/MappingTrackSelector.java b/library/src/main/java/com/google/android/exoplayer2/trackselection/MappingTrackSelector.java index 77df9a2173a..0dda5656b77 100644 --- a/library/src/main/java/com/google/android/exoplayer2/trackselection/MappingTrackSelector.java +++ b/library/src/main/java/com/google/android/exoplayer2/trackselection/MappingTrackSelector.java @@ -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; }