- Added realracing3-community.apk (71.57 MB) - Removed 32-bit support (armeabi-v7a) - Only includes arm64-v8a libraries - Decompiled source code included - Added README-community.md with analysis
89 lines
2.9 KiB
Java
89 lines
2.9 KiB
Java
package com.mbridge.msdk.playercommon.exoplayer2.trackselection;
|
|
|
|
import android.os.SystemClock;
|
|
import androidx.annotation.Nullable;
|
|
import com.mbridge.msdk.playercommon.exoplayer2.source.TrackGroup;
|
|
import com.mbridge.msdk.playercommon.exoplayer2.trackselection.TrackSelection;
|
|
import java.util.Random;
|
|
|
|
/* loaded from: classes4.dex */
|
|
public final class RandomTrackSelection extends BaseTrackSelection {
|
|
private final Random random;
|
|
private int selectedIndex;
|
|
|
|
@Override // com.mbridge.msdk.playercommon.exoplayer2.trackselection.TrackSelection
|
|
public final int getSelectedIndex() {
|
|
return this.selectedIndex;
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.playercommon.exoplayer2.trackselection.TrackSelection
|
|
@Nullable
|
|
public final Object getSelectionData() {
|
|
return null;
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.playercommon.exoplayer2.trackselection.TrackSelection
|
|
public final int getSelectionReason() {
|
|
return 3;
|
|
}
|
|
|
|
public static final class Factory implements TrackSelection.Factory {
|
|
private final Random random;
|
|
|
|
public Factory() {
|
|
this.random = new Random();
|
|
}
|
|
|
|
public Factory(int i) {
|
|
this.random = new Random(i);
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.playercommon.exoplayer2.trackselection.TrackSelection.Factory
|
|
public final RandomTrackSelection createTrackSelection(TrackGroup trackGroup, int... iArr) {
|
|
return new RandomTrackSelection(trackGroup, iArr, this.random);
|
|
}
|
|
}
|
|
|
|
public RandomTrackSelection(TrackGroup trackGroup, int... iArr) {
|
|
super(trackGroup, iArr);
|
|
Random random = new Random();
|
|
this.random = random;
|
|
this.selectedIndex = random.nextInt(this.length);
|
|
}
|
|
|
|
public RandomTrackSelection(TrackGroup trackGroup, int[] iArr, long j) {
|
|
this(trackGroup, iArr, new Random(j));
|
|
}
|
|
|
|
public RandomTrackSelection(TrackGroup trackGroup, int[] iArr, Random random) {
|
|
super(trackGroup, iArr);
|
|
this.random = random;
|
|
this.selectedIndex = random.nextInt(this.length);
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.playercommon.exoplayer2.trackselection.TrackSelection
|
|
public final void updateSelectedTrack(long j, long j2, long j3) {
|
|
long elapsedRealtime = SystemClock.elapsedRealtime();
|
|
int i = 0;
|
|
for (int i2 = 0; i2 < this.length; i2++) {
|
|
if (!isBlacklisted(i2, elapsedRealtime)) {
|
|
i++;
|
|
}
|
|
}
|
|
this.selectedIndex = this.random.nextInt(i);
|
|
if (i != this.length) {
|
|
int i3 = 0;
|
|
for (int i4 = 0; i4 < this.length; i4++) {
|
|
if (!isBlacklisted(i4, elapsedRealtime)) {
|
|
int i5 = i3 + 1;
|
|
if (this.selectedIndex == i3) {
|
|
this.selectedIndex = i4;
|
|
return;
|
|
}
|
|
i3 = i5;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|