package defpackage;

import java.util.ArrayDeque;

/* JADX INFO: renamed from: ᵪʖᵗˑ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes3.dex */
public abstract class AbstractC3863 implements InterfaceC1641 {

    /* JADX INFO: renamed from: ʽˈˋ, reason: contains not printable characters */
    public final ArrayDeque f14760;

    /* JADX INFO: renamed from: ːˏᵟᵯ, reason: contains not printable characters */
    public final ArrayDeque f14761;

    /* JADX INFO: renamed from: ᵨᵣ, reason: contains not printable characters */
    public long f14762;

    /* JADX INFO: renamed from: ᵲᵶᵳˈ, reason: contains not printable characters */
    public final ArrayDeque f14763 = new ArrayDeque();

    /* JADX INFO: renamed from: ᵵᵽ, reason: contains not printable characters */
    public long f14764;

    /* JADX INFO: renamed from: ᵷᵺʾᵖ, reason: contains not printable characters */
    public C4641 f14765;

    /* JADX INFO: renamed from: ᵻˈᵦʼ, reason: contains not printable characters */
    public long f14766;

    public AbstractC3863() {
        for (int i = 0; i < 10; i++) {
            this.f14763.add(new C4641());
        }
        this.f14760 = new ArrayDeque();
        for (int i2 = 0; i2 < 2; i2++) {
            ArrayDeque arrayDeque = this.f14760;
            ᵳᵢᵺ r3 = new ᵳᵢᵺ(4, this);
            C1663 c1663 = new C1663(0);
            c1663.f6596 = r3;
            arrayDeque.add(c1663);
        }
        this.f14761 = new ArrayDeque();
        this.f14764 = -9223372036854775807L;
    }

    @Override // defpackage.InterfaceC0820
    public void flush() {
        ArrayDeque arrayDeque;
        this.f14766 = 0L;
        this.f14762 = 0L;
        while (true) {
            ArrayDeque arrayDeque2 = this.f14761;
            boolean zIsEmpty = arrayDeque2.isEmpty();
            arrayDeque = this.f14763;
            if (zIsEmpty) {
                break;
            }
            C4641 c4641 = (C4641) arrayDeque2.poll();
            String str = AbstractC0956.f4222;
            c4641.mo7091();
            arrayDeque.add(c4641);
        }
        C4641 c46412 = this.f14765;
        if (c46412 != null) {
            c46412.mo7091();
            arrayDeque.add(c46412);
            this.f14765 = null;
        }
    }

    @Override // defpackage.InterfaceC0820
    /* JADX INFO: renamed from: ʽˈˋ */
    public final void mo2935(long j) {
        this.f14764 = j;
    }

    /* JADX INFO: renamed from: ˊᵫᵗ */
    public abstract void mo2229(C4641 c4641);

    @Override // defpackage.InterfaceC1641
    /* JADX INFO: renamed from: ːˏᵟᵯ */
    public final void mo4536(long j) {
        this.f14762 = j;
    }

    @Override // defpackage.InterfaceC0820
    /* JADX INFO: renamed from: ᵨᵣ */
    public final Object mo2936() {
        ᵻᵪ.ˌᴵ(this.f14765 == null);
        ArrayDeque arrayDeque = this.f14763;
        if (arrayDeque.isEmpty()) {
            return null;
        }
        C4641 c4641 = (C4641) arrayDeque.pollFirst();
        this.f14765 = c4641;
        return c4641;
    }

    /* JADX INFO: renamed from: ᵱᵽʡᵚ */
    public abstract boolean mo2232();

    @Override // defpackage.InterfaceC0820
    /* JADX INFO: renamed from: ᵲᵶᵳˈ */
    public void mo364() {
    }

    /* JADX INFO: renamed from: ᵵᵽ */
    public abstract C5401 mo2233();

    @Override // defpackage.InterfaceC0820
    /* JADX INFO: renamed from: ᵻʽᵯ, reason: contains not printable characters and merged with bridge method [inline-methods] */
    public AbstractC3334 mo2937() {
        ArrayDeque arrayDeque = this.f14760;
        if (arrayDeque.isEmpty()) {
            return null;
        }
        while (true) {
            ArrayDeque arrayDeque2 = this.f14761;
            if (arrayDeque2.isEmpty()) {
                return null;
            }
            C4641 c4641 = (C4641) arrayDeque2.peek();
            String str = AbstractC0956.f4222;
            if (c4641.f11577 > this.f14762) {
                return null;
            }
            C4641 c46412 = (C4641) arrayDeque2.poll();
            boolean zM6278 = c46412.m6278(4);
            ArrayDeque arrayDeque3 = this.f14763;
            if (zM6278) {
                AbstractC3334 abstractC3334 = (AbstractC3334) arrayDeque.pollFirst();
                abstractC3334.m6277(4);
                c46412.mo7091();
                arrayDeque3.add(c46412);
                return abstractC3334;
            }
            mo2229(c46412);
            if (mo2232()) {
                C5401 c5401Mo2233 = mo2233();
                AbstractC3334 abstractC33342 = (AbstractC3334) arrayDeque.pollFirst();
                long j = c46412.f11577;
                abstractC33342.f15983 = j;
                abstractC33342.f12792 = c5401Mo2233;
                abstractC33342.f12791 = j;
                c46412.mo7091();
                arrayDeque3.add(c46412);
                return abstractC33342;
            }
            c46412.mo7091();
            arrayDeque3.add(c46412);
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:15:0x0033  */
    @Override // defpackage.InterfaceC0820
    /* JADX INFO: renamed from: ᵻˈᵦʼ */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final void mo2938(C1561 c1561) {
        ᵻᵪ.ᵱᵽʡᵚ(c1561 == this.f14765);
        C4641 c4641 = (C4641) c1561;
        if (!c4641.m6278(4)) {
            long j = c4641.f11577;
            if (j != Long.MIN_VALUE) {
                long j2 = this.f14764;
                if (j2 == -9223372036854775807L || j >= j2) {
                    long j3 = this.f14766;
                    this.f14766 = 1 + j3;
                    c4641.f17640 = j3;
                    this.f14761.add(c4641);
                } else {
                    c4641.mo7091();
                    this.f14763.add(c4641);
                }
            }
        }
        this.f14765 = null;
    }
}
