package p138.p176.p177.p190.p217.p222;

import com.google.android.exoplayer2.drm.DrmSession;
import com.google.android.exoplayer2.source.hls.SampleQueueMappingException;
import java.util.List;
import p000.p001.p002.p003.p004.C0567;
import p138.p176.p177.p190.C3431;
import p138.p176.p177.p190.C3433;
import p138.p176.p177.p190.p193.C3511;
import p138.p176.p177.p190.p217.C3829;
import p138.p176.p177.p190.p217.InterfaceC3823;
import p138.p176.p177.p190.p217.p222.C3911;
import p138.p176.p177.p190.p239.C4150;

/* JADX INFO: renamed from: ދ.ހ.֏.ؠ.ໞ.ޟ.ދ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public final class C3910 implements InterfaceC3823 {

    /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
    public final int f12122;

    /* JADX INFO: renamed from: ބ, reason: contains not printable characters */
    public final C3911 f12123;

    /* JADX INFO: renamed from: ޅ, reason: contains not printable characters */
    public int f12124 = -1;

    public C3910(C3911 c3911, int i) {
        this.f12123 = c3911;
        this.f12122 = i;
    }

    @Override // p138.p176.p177.p190.p217.InterfaceC3823
    /* JADX INFO: renamed from: ֏ */
    public int mo6116(C3433 c3433, C3511 c3511, boolean z) {
        C3431 c3431;
        if (this.f12124 == -3) {
            c3511.m5801(4);
            return -4;
        }
        if (!m6321()) {
            return -3;
        }
        C3911 c3911 = this.f12123;
        int i = this.f12124;
        if (c3911.m6330()) {
            return -3;
        }
        int i2 = 0;
        if (!c3911.f12137.isEmpty()) {
            int i3 = 0;
            while (true) {
                boolean z2 = true;
                if (i3 >= c3911.f12137.size() - 1) {
                    break;
                }
                int i4 = c3911.f12137.get(i3).f12077;
                int length = c3911.f12144.length;
                int i5 = 0;
                while (true) {
                    if (i5 < length) {
                        if (c3911.f12162[i5] && c3911.f12144[i5].m6204() == i4) {
                            z2 = false;
                            break;
                        }
                        i5++;
                    } else {
                        break;
                    }
                }
                if (!z2) {
                    break;
                }
                i3++;
            }
            C4150.m6765((List) c3911.f12137, 0, i3);
            C3908 c3908 = c3911.f12137.get(0);
            C3431 c34312 = c3908.f11807;
            if (!c34312.equals(c3911.f12155)) {
                c3911.f12134.m6125(c3911.f12126, c34312, c3908.f11808, c3908.f11809, c3908.f11810);
            }
            c3911.f12155 = c34312;
        }
        int iM6173 = c3911.f12144[i].m6173(c3433, c3511, z, c3911.f12168, c3911.f12164);
        if (iM6173 == -5) {
            C3431 c3431M5600 = c3433.f10114;
            C0567.m1856(c3431M5600);
            if (i == c3911.f12150) {
                int iM6204 = c3911.f12144[i].m6204();
                while (i2 < c3911.f12137.size() && c3911.f12137.get(i2).f12077 != iM6204) {
                    i2++;
                }
                if (i2 < c3911.f12137.size()) {
                    c3431 = c3911.f12137.get(i2).f11807;
                } else {
                    c3431 = c3911.f12154;
                    C0567.m1856(c3431);
                }
                c3431M5600 = c3431M5600.m5600(c3431);
            }
            c3433.f10114 = c3431M5600;
        }
        return iM6173;
    }

    @Override // p138.p176.p177.p190.p217.InterfaceC3823
    /* JADX INFO: renamed from: ֏ */
    public void mo6117() throws DrmSession.DrmSessionException, SampleQueueMappingException {
        int i = this.f12124;
        if (i == -2) {
            C3911 c3911 = this.f12123;
            c3911.m6328();
            C3829 c3829 = c3911.f12157;
            throw new SampleQueueMappingException(c3829.f11786[this.f12122].f11782[0].f10090);
        }
        if (i == -1) {
            this.f12123.m6332();
        } else if (i != -3) {
            C3911 c39112 = this.f12123;
            c39112.m6332();
            c39112.f12144[i].m6203();
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:11:0x0030  */
    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public void m6320() {
        C0567.m1896(this.f12124 == -1);
        C3911 c3911 = this.f12123;
        int i = this.f12122;
        c3911.m6328();
        C0567.m1856(c3911.f12159);
        int i2 = c3911.f12159[i];
        if (i2 == -1) {
            i2 = c3911.f12158.contains(c3911.f12157.f11786[i]) ? -3 : -2;
        } else {
            boolean[] zArr = c3911.f12162;
            if (!zArr[i2]) {
                zArr[i2] = true;
            }
        }
        this.f12124 = i2;
    }

    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    public final boolean m6321() {
        int i = this.f12124;
        return (i == -1 || i == -3 || i == -2) ? false : true;
    }

    @Override // p138.p176.p177.p190.p217.InterfaceC3823
    /* JADX INFO: renamed from: ށ */
    public int mo6118(long j) {
        if (!m6321()) {
            return 0;
        }
        C3911 c3911 = this.f12123;
        int i = this.f12124;
        if (c3911.m6330()) {
            return 0;
        }
        C3911.C3914 c3914 = c3911.f12144[i];
        return (!c3911.f12168 || j <= c3914.m6195()) ? c3914.m6172(j) : c3914.m6170();
    }

    @Override // p138.p176.p177.p190.p217.InterfaceC3823
    /* JADX INFO: renamed from: ރ */
    public boolean mo6119() {
        if (this.f12124 != -3) {
            if (!m6321()) {
                return false;
            }
            C3911 c3911 = this.f12123;
            if (!(!c3911.m6330() && c3911.f12144[this.f12124].m6180(c3911.f12168))) {
                return false;
            }
        }
        return true;
    }
}
