mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Make parallel adaptive track selection more robust.
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
This commit is contained in:
parent
f9d6f314e2
commit
090f359895
2 changed files with 6 additions and 2 deletions
|
|
@ -47,6 +47,9 @@
|
||||||
([#5834](https://github.com/google/ExoPlayer/issues/5834)).
|
([#5834](https://github.com/google/ExoPlayer/issues/5834)).
|
||||||
* Allow enabling decoder fallback with `DefaultRenderersFactory`
|
* Allow enabling decoder fallback with `DefaultRenderersFactory`
|
||||||
([#5942](https://github.com/google/ExoPlayer/issues/5942)).
|
([#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 ###
|
### 2.10.1 ###
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -758,7 +758,7 @@ public class AdaptiveTrackSelection extends BaseTrackSelection {
|
||||||
for (int i = 0; i < values.length; i++) {
|
for (int i = 0; i < values.length; i++) {
|
||||||
logValues[i] = new double[values[i].length];
|
logValues[i] = new double[values[i].length];
|
||||||
for (int j = 0; j < values[i].length; j++) {
|
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;
|
return logValues;
|
||||||
|
|
@ -780,7 +780,8 @@ public class AdaptiveTrackSelection extends BaseTrackSelection {
|
||||||
double totalBitrateDiff = logBitrates[i][logBitrates[i].length - 1] - logBitrates[i][0];
|
double totalBitrateDiff = logBitrates[i][logBitrates[i].length - 1] - logBitrates[i][0];
|
||||||
for (int j = 0; j < logBitrates[i].length - 1; j++) {
|
for (int j = 0; j < logBitrates[i].length - 1; j++) {
|
||||||
double switchBitrate = 0.5 * (logBitrates[i][j] + logBitrates[i][j + 1]);
|
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;
|
return switchPoints;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue