- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
51 lines
1.5 KiB
Java
51 lines
1.5 KiB
Java
package okio;
|
|
|
|
import android.support.v4.media.session.PlaybackStateCompat;
|
|
|
|
/* loaded from: classes5.dex */
|
|
public abstract class SegmentPool {
|
|
public static long byteCount;
|
|
public static Segment next;
|
|
|
|
public static Segment take() {
|
|
synchronized (SegmentPool.class) {
|
|
try {
|
|
Segment segment = next;
|
|
if (segment != null) {
|
|
next = segment.next;
|
|
segment.next = null;
|
|
byteCount -= PlaybackStateCompat.ACTION_PLAY_FROM_URI;
|
|
return segment;
|
|
}
|
|
return new Segment();
|
|
} catch (Throwable th) {
|
|
throw th;
|
|
}
|
|
}
|
|
}
|
|
|
|
public static void recycle(Segment segment) {
|
|
if (segment.next != null || segment.prev != null) {
|
|
throw new IllegalArgumentException();
|
|
}
|
|
if (segment.shared) {
|
|
return;
|
|
}
|
|
synchronized (SegmentPool.class) {
|
|
try {
|
|
long j = byteCount;
|
|
if (j + PlaybackStateCompat.ACTION_PLAY_FROM_URI > PlaybackStateCompat.ACTION_PREPARE_FROM_SEARCH) {
|
|
return;
|
|
}
|
|
byteCount = j + PlaybackStateCompat.ACTION_PLAY_FROM_URI;
|
|
segment.next = next;
|
|
segment.limit = 0;
|
|
segment.pos = 0;
|
|
next = segment;
|
|
} catch (Throwable th) {
|
|
throw th;
|
|
}
|
|
}
|
|
}
|
|
}
|