From 2072793ae365a86a34dfe5dac0833e876935aa42 Mon Sep 17 00:00:00 2001 From: Jacob Date: Tue, 19 Mar 2019 13:46:01 -0400 Subject: [PATCH 1/2] Fix Android audio crash Why: * There is a case where groupIndex may be unset This change addresses the need by: * Don't chain check for INDEX_UNSET to previous conditional --- .../java/com/brentvatne/exoplayer/ReactExoplayerView.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java b/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java index 52edc86a..9bac62e4 100644 --- a/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java +++ b/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java @@ -984,7 +984,9 @@ class ReactExoplayerView extends FrameLayout implements tracks[j] = j; } } - } else if (groupIndex == C.INDEX_UNSET) { + } + + if (groupIndex == C.INDEX_UNSET) { trackSelector.setParameters(disableParameters); return; } From da8a202a0f81dd0cf6d1106dda7e84f4bac1d0f8 Mon Sep 17 00:00:00 2001 From: Hampton Maxwell Date: Wed, 3 Apr 2019 23:24:02 -0700 Subject: [PATCH 2/2] Make video auto track selection more readable --- .../brentvatne/exoplayer/ReactExoplayerView.java | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java b/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java index 9bac62e4..175ef84f 100644 --- a/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java +++ b/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java @@ -975,14 +975,13 @@ class ReactExoplayerView extends FrameLayout implements groupIndex = getGroupIndexForDefaultLocale(groups); } - if (groupIndex == C.INDEX_UNSET && trackType == C.TRACK_TYPE_VIDEO) { // Video auto - if (groups.length != 0) { - TrackGroup group = groups.get(0); - tracks = new int[group.length]; - groupIndex = 0; - for (int j = 0; j < group.length; j++) { - tracks[j] = j; - } + if (groupIndex == C.INDEX_UNSET && trackType == C.TRACK_TYPE_VIDEO && groups.length != 0) { // Video auto + // Add all tracks as valid options for ABR to choose from + TrackGroup group = groups.get(0); + tracks = new int[group.length]; + groupIndex = 0; + for (int j = 0; j < group.length; j++) { + tracks[j] = j; } }