mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Fix handling of ad tags where ad groups are out of order
IMA's cue points may not be in order, so sort them. It looks like IMA events use time ordered ad indices, so it is not necessary to map between the original cue point order and the time order. Issue: #3716 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=185495798
This commit is contained in:
parent
3ec96aee17
commit
4fec24294a
@ -88,6 +88,8 @@
|
||||
* Add support for playing non-Extractor content MediaSources in
|
||||
the IMA demo app
|
||||
([#3676](https://github.com/google/ExoPlayer/issues/3676)).
|
||||
* Fix handling of ad tags where ad groups are out of order
|
||||
([#3716](https://github.com/google/ExoPlayer/issues/3716)).
|
||||
* `EventLogger` moved from the demo app into the core library.
|
||||
* Fix ANR issue on Huawei P8 Lite
|
||||
([#3724](https://github.com/google/ExoPlayer/issues/3724)).
|
||||
|
@ -970,11 +970,17 @@ public final class ImaAdsLoader extends Player.DefaultEventListener implements A
|
||||
|
||||
int count = cuePoints.size();
|
||||
long[] adGroupTimesUs = new long[count];
|
||||
int adGroupIndex = 0;
|
||||
for (int i = 0; i < count; i++) {
|
||||
double cuePoint = cuePoints.get(i);
|
||||
adGroupTimesUs[i] =
|
||||
cuePoint == -1.0 ? C.TIME_END_OF_SOURCE : (long) (C.MICROS_PER_SECOND * cuePoint);
|
||||
if (cuePoint == -1.0) {
|
||||
adGroupTimesUs[count - 1] = C.TIME_END_OF_SOURCE;
|
||||
} else {
|
||||
adGroupTimesUs[adGroupIndex++] = (long) (C.MICROS_PER_SECOND * cuePoint);
|
||||
}
|
||||
}
|
||||
// Cue points may be out of order, so sort them.
|
||||
Arrays.sort(adGroupTimesUs, 0, adGroupIndex);
|
||||
return adGroupTimesUs;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user