Skip to content

Commit

Permalink
Make parallel adaptive track selection more robust.
Browse files Browse the repository at this point in the history
Using parallel adaptation for Formats without bitrate information currently
causes an exception. Handle this gracefully and also cases where all formats
have the same bitrate.

Issue:#5971
PiperOrigin-RevId: 250682127
  • Loading branch information
tonihei authored and ojw28 committed May 31, 2019
1 parent d626e4b commit b9f3fd4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
([#5915](https://github.com/google/ExoPlayer/issues/5915)).
* Allow enabling decoder fallback with `DefaultRenderersFactory`
([#5942](https://github.com/google/ExoPlayer/issues/5942)).
* Fix bug caused by parallel adaptive track selection using `Format`s without
bitrate information
([#5971](https://github.com/google/ExoPlayer/issues/5971)).

### 2.10.1 ###

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@ private static double[][] getLogArrayValues(long[][] values) {
for (int i = 0; i < values.length; i++) {
logValues[i] = new double[values[i].length];
for (int j = 0; j < values[i].length; j++) {
logValues[i][j] = Math.log(values[i][j]);
logValues[i][j] = values[i][j] == Format.NO_VALUE ? 0 : Math.log(values[i][j]);
}
}
return logValues;
Expand All @@ -779,7 +779,8 @@ private static double[][] getSwitchPoints(double[][] logBitrates) {
double totalBitrateDiff = logBitrates[i][logBitrates[i].length - 1] - logBitrates[i][0];
for (int j = 0; j < logBitrates[i].length - 1; j++) {
double switchBitrate = 0.5 * (logBitrates[i][j] + logBitrates[i][j + 1]);
switchPoints[i][j] = (switchBitrate - logBitrates[i][0]) / totalBitrateDiff;
switchPoints[i][j] =
totalBitrateDiff == 0.0 ? 1.0 : (switchBitrate - logBitrates[i][0]) / totalBitrateDiff;
}
}
return switchPoints;
Expand Down

0 comments on commit b9f3fd4

Please sign in to comment.