Files
rr3-apk/decompiled/sources/com/mbridge/msdk/playercommon/exoplayer2/offline/ProgressiveDownloader.java
Daniel Elliott f9d20bb3fc Add decompiled APK source code (JADX)
- 28,932 files
- Full Java source code
- Smali files
- Resources

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-18 14:52:23 -08:00

63 lines
2.7 KiB
Java

package com.mbridge.msdk.playercommon.exoplayer2.offline;
import android.net.Uri;
import com.mbridge.msdk.playercommon.exoplayer2.upstream.DataSpec;
import com.mbridge.msdk.playercommon.exoplayer2.upstream.cache.Cache;
import com.mbridge.msdk.playercommon.exoplayer2.upstream.cache.CacheDataSource;
import com.mbridge.msdk.playercommon.exoplayer2.upstream.cache.CacheUtil;
import com.mbridge.msdk.playercommon.exoplayer2.util.PriorityTaskManager;
import java.io.IOException;
import java.util.concurrent.atomic.AtomicBoolean;
/* loaded from: classes4.dex */
public final class ProgressiveDownloader implements Downloader {
private static final int BUFFER_SIZE_BYTES = 131072;
private final Cache cache;
private final CacheDataSource dataSource;
private final DataSpec dataSpec;
private final PriorityTaskManager priorityTaskManager;
private final CacheUtil.CachingCounters cachingCounters = new CacheUtil.CachingCounters();
private final AtomicBoolean isCanceled = new AtomicBoolean();
public ProgressiveDownloader(Uri uri, String str, DownloaderConstructorHelper downloaderConstructorHelper) {
this.dataSpec = new DataSpec(uri, 0L, -1L, str, 0);
this.cache = downloaderConstructorHelper.getCache();
this.dataSource = downloaderConstructorHelper.buildCacheDataSource(false);
this.priorityTaskManager = downloaderConstructorHelper.getPriorityTaskManager();
}
@Override // com.mbridge.msdk.playercommon.exoplayer2.offline.Downloader
public final void download() throws InterruptedException, IOException {
this.priorityTaskManager.add(-1000);
try {
CacheUtil.cache(this.dataSpec, this.cache, this.dataSource, new byte[131072], this.priorityTaskManager, -1000, this.cachingCounters, this.isCanceled, true);
} finally {
this.priorityTaskManager.remove(-1000);
}
}
@Override // com.mbridge.msdk.playercommon.exoplayer2.offline.Downloader
public final void cancel() {
this.isCanceled.set(true);
}
@Override // com.mbridge.msdk.playercommon.exoplayer2.offline.Downloader
public final long getDownloadedBytes() {
return this.cachingCounters.totalCachedBytes();
}
@Override // com.mbridge.msdk.playercommon.exoplayer2.offline.Downloader
public final float getDownloadPercentage() {
long j = this.cachingCounters.contentLength;
if (j == -1) {
return -1.0f;
}
return (this.cachingCounters.totalCachedBytes() * 100.0f) / j;
}
@Override // com.mbridge.msdk.playercommon.exoplayer2.offline.Downloader
public final void remove() {
CacheUtil.remove(this.cache, CacheUtil.getKey(this.dataSpec));
}
}