- 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
164 lines
6.4 KiB
Java
164 lines
6.4 KiB
Java
package com.mbridge.msdk.playercommon.exoplayer2.source;
|
|
|
|
import androidx.annotation.Nullable;
|
|
import com.mbridge.msdk.playercommon.exoplayer2.C;
|
|
import com.mbridge.msdk.playercommon.exoplayer2.SeekParameters;
|
|
import com.mbridge.msdk.playercommon.exoplayer2.source.MediaPeriod;
|
|
import com.mbridge.msdk.playercommon.exoplayer2.source.MediaSource;
|
|
import com.mbridge.msdk.playercommon.exoplayer2.trackselection.TrackSelection;
|
|
import com.mbridge.msdk.playercommon.exoplayer2.upstream.Allocator;
|
|
import java.io.IOException;
|
|
|
|
/* loaded from: classes4.dex */
|
|
public final class DeferredMediaPeriod implements MediaPeriod, MediaPeriod.Callback {
|
|
private final Allocator allocator;
|
|
private MediaPeriod.Callback callback;
|
|
public final MediaSource.MediaPeriodId id;
|
|
|
|
@Nullable
|
|
private PrepareErrorListener listener;
|
|
private MediaPeriod mediaPeriod;
|
|
public final MediaSource mediaSource;
|
|
private boolean notifiedPrepareError;
|
|
private long preparePositionOverrideUs = C.TIME_UNSET;
|
|
private long preparePositionUs;
|
|
|
|
public interface PrepareErrorListener {
|
|
void onPrepareError(MediaSource.MediaPeriodId mediaPeriodId, IOException iOException);
|
|
}
|
|
|
|
public final void setDefaultPreparePositionUs(long j) {
|
|
if (this.preparePositionUs != 0 || j == 0) {
|
|
return;
|
|
}
|
|
this.preparePositionOverrideUs = j;
|
|
this.preparePositionUs = j;
|
|
}
|
|
|
|
public final void setPrepareErrorListener(PrepareErrorListener prepareErrorListener) {
|
|
this.listener = prepareErrorListener;
|
|
}
|
|
|
|
public DeferredMediaPeriod(MediaSource mediaSource, MediaSource.MediaPeriodId mediaPeriodId, Allocator allocator) {
|
|
this.id = mediaPeriodId;
|
|
this.allocator = allocator;
|
|
this.mediaSource = mediaSource;
|
|
}
|
|
|
|
public final void createPeriod() {
|
|
MediaPeriod createPeriod = this.mediaSource.createPeriod(this.id, this.allocator);
|
|
this.mediaPeriod = createPeriod;
|
|
if (this.callback != null) {
|
|
createPeriod.prepare(this, this.preparePositionUs);
|
|
}
|
|
}
|
|
|
|
public final void releasePeriod() {
|
|
MediaPeriod mediaPeriod = this.mediaPeriod;
|
|
if (mediaPeriod != null) {
|
|
this.mediaSource.releasePeriod(mediaPeriod);
|
|
}
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.playercommon.exoplayer2.source.MediaPeriod
|
|
public final void prepare(MediaPeriod.Callback callback, long j) {
|
|
this.callback = callback;
|
|
this.preparePositionUs = j;
|
|
MediaPeriod mediaPeriod = this.mediaPeriod;
|
|
if (mediaPeriod != null) {
|
|
mediaPeriod.prepare(this, j);
|
|
}
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.playercommon.exoplayer2.source.MediaPeriod
|
|
public final void maybeThrowPrepareError() throws IOException {
|
|
try {
|
|
MediaPeriod mediaPeriod = this.mediaPeriod;
|
|
if (mediaPeriod != null) {
|
|
mediaPeriod.maybeThrowPrepareError();
|
|
} else {
|
|
this.mediaSource.maybeThrowSourceInfoRefreshError();
|
|
}
|
|
} catch (IOException e) {
|
|
PrepareErrorListener prepareErrorListener = this.listener;
|
|
if (prepareErrorListener == null) {
|
|
throw e;
|
|
}
|
|
if (this.notifiedPrepareError) {
|
|
return;
|
|
}
|
|
this.notifiedPrepareError = true;
|
|
prepareErrorListener.onPrepareError(this.id, e);
|
|
}
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.playercommon.exoplayer2.source.MediaPeriod
|
|
public final TrackGroupArray getTrackGroups() {
|
|
return this.mediaPeriod.getTrackGroups();
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.playercommon.exoplayer2.source.MediaPeriod
|
|
public final long selectTracks(TrackSelection[] trackSelectionArr, boolean[] zArr, SampleStream[] sampleStreamArr, boolean[] zArr2, long j) {
|
|
long j2;
|
|
long j3 = this.preparePositionOverrideUs;
|
|
if (j3 == C.TIME_UNSET || j != 0) {
|
|
j2 = j;
|
|
} else {
|
|
this.preparePositionOverrideUs = C.TIME_UNSET;
|
|
j2 = j3;
|
|
}
|
|
return this.mediaPeriod.selectTracks(trackSelectionArr, zArr, sampleStreamArr, zArr2, j2);
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.playercommon.exoplayer2.source.MediaPeriod
|
|
public final void discardBuffer(long j, boolean z) {
|
|
this.mediaPeriod.discardBuffer(j, z);
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.playercommon.exoplayer2.source.MediaPeriod
|
|
public final long readDiscontinuity() {
|
|
return this.mediaPeriod.readDiscontinuity();
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.playercommon.exoplayer2.source.MediaPeriod, com.mbridge.msdk.playercommon.exoplayer2.source.SequenceableLoader
|
|
public final long getBufferedPositionUs() {
|
|
return this.mediaPeriod.getBufferedPositionUs();
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.playercommon.exoplayer2.source.MediaPeriod
|
|
public final long seekToUs(long j) {
|
|
return this.mediaPeriod.seekToUs(j);
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.playercommon.exoplayer2.source.MediaPeriod
|
|
public final long getAdjustedSeekPositionUs(long j, SeekParameters seekParameters) {
|
|
return this.mediaPeriod.getAdjustedSeekPositionUs(j, seekParameters);
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.playercommon.exoplayer2.source.MediaPeriod, com.mbridge.msdk.playercommon.exoplayer2.source.SequenceableLoader
|
|
public final long getNextLoadPositionUs() {
|
|
return this.mediaPeriod.getNextLoadPositionUs();
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.playercommon.exoplayer2.source.MediaPeriod, com.mbridge.msdk.playercommon.exoplayer2.source.SequenceableLoader
|
|
public final void reevaluateBuffer(long j) {
|
|
this.mediaPeriod.reevaluateBuffer(j);
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.playercommon.exoplayer2.source.MediaPeriod, com.mbridge.msdk.playercommon.exoplayer2.source.SequenceableLoader
|
|
public final boolean continueLoading(long j) {
|
|
MediaPeriod mediaPeriod = this.mediaPeriod;
|
|
return mediaPeriod != null && mediaPeriod.continueLoading(j);
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.playercommon.exoplayer2.source.SequenceableLoader.Callback
|
|
public final void onContinueLoadingRequested(MediaPeriod mediaPeriod) {
|
|
this.callback.onContinueLoadingRequested(this);
|
|
}
|
|
|
|
@Override // com.mbridge.msdk.playercommon.exoplayer2.source.MediaPeriod.Callback
|
|
public final void onPrepared(MediaPeriod mediaPeriod) {
|
|
this.callback.onPrepared(this);
|
|
}
|
|
}
|