package p138.p176.p177.p190.p210;

import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import p000.p001.p002.p003.p004.C0567;
import p138.p176.p177.p190.AbstractC3413;
import p138.p176.p177.p190.C3431;
import p138.p176.p177.p190.C3433;
import p138.p176.p177.p190.p194.InterfaceC3532;
import p138.p176.p177.p190.p210.C3710;
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 C3719 extends AbstractC3413 implements Handler.Callback {

    /* JADX INFO: renamed from: ގ, reason: contains not printable characters */
    public final InterfaceC3715 f11443;

    /* JADX INFO: renamed from: ޏ, reason: contains not printable characters */
    public final InterfaceC3718 f11444;

    /* JADX INFO: renamed from: ސ, reason: contains not printable characters */
    public final Handler f11445;

    /* JADX INFO: renamed from: ޑ, reason: contains not printable characters */
    public final C3717 f11446;

    /* JADX INFO: renamed from: ޒ, reason: contains not printable characters */
    public final C3710[] f11447;

    /* JADX INFO: renamed from: ޓ, reason: contains not printable characters */
    public final long[] f11448;

    /* JADX INFO: renamed from: ޔ, reason: contains not printable characters */
    public int f11449;

    /* JADX INFO: renamed from: ޕ, reason: contains not printable characters */
    public int f11450;

    /* JADX INFO: renamed from: ޖ, reason: contains not printable characters */
    public InterfaceC3714 f11451;

    /* JADX INFO: renamed from: ޗ, reason: contains not printable characters */
    public boolean f11452;

    /* JADX INFO: renamed from: ޘ, reason: contains not printable characters */
    public long f11453;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public C3719(InterfaceC3718 interfaceC3718, Looper looper) {
        super(4);
        InterfaceC3715 interfaceC3715 = InterfaceC3715.f11441;
        if (interfaceC3718 == null) {
            throw null;
        }
        this.f11444 = interfaceC3718;
        this.f11445 = looper != null ? C4150.m6754(looper, (Handler.Callback) this) : null;
        this.f11443 = interfaceC3715;
        this.f11446 = new C3717();
        this.f11447 = new C3710[5];
        this.f11448 = new long[5];
    }

    @Override // android.os.Handler.Callback
    public boolean handleMessage(Message message) {
        if (message.what != 0) {
            throw new IllegalStateException();
        }
        this.f11444.mo5671((C3710) message.obj);
        return true;
    }

    @Override // p138.p176.p177.p190.AbstractC3413
    /* JADX INFO: renamed from: ֏ */
    public int mo1145(C3431 c3431) {
        if (this.f11443.mo6061(c3431)) {
            return (AbstractC3413.m5437((InterfaceC3532<?>) null, c3431.f10093) ? 4 : 2) | 0 | 0;
        }
        return 0;
    }

    @Override // p138.p176.p177.p190.InterfaceC3450
    /* JADX INFO: renamed from: ֏ */
    public void mo1149(long j, long j2) {
        if (!this.f11452 && this.f11450 < 5) {
            this.f11446.mo5803();
            C3433 c3433M5457 = m5457();
            int iM5438 = m5438(c3433M5457, this.f11446, false);
            if (iM5438 == -4) {
                if (this.f11446.m5805()) {
                    this.f11452 = true;
                } else if (!this.f11446.m5804()) {
                    C3717 c3717 = this.f11446;
                    c3717.f11442 = this.f11453;
                    c3717.m5812();
                    InterfaceC3714 interfaceC3714 = this.f11451;
                    C4150.m6755(interfaceC3714);
                    C3710 c3710Mo6059 = interfaceC3714.mo6059(this.f11446);
                    if (c3710Mo6059 != null) {
                        ArrayList arrayList = new ArrayList(c3710Mo6059.f11440.length);
                        m6062(c3710Mo6059, arrayList);
                        if (!arrayList.isEmpty()) {
                            C3710 c3710 = new C3710(arrayList);
                            int i = this.f11449;
                            int i2 = this.f11450;
                            int i3 = (i + i2) % 5;
                            this.f11447[i3] = c3710;
                            this.f11448[i3] = this.f11446.f10463;
                            this.f11450 = i2 + 1;
                        }
                    }
                }
            } else if (iM5438 == -5) {
                C3431 c3431 = c3433M5457.f10114;
                C0567.m1856(c3431);
                this.f11453 = c3431.f10094;
            }
        }
        if (this.f11450 > 0) {
            long[] jArr = this.f11448;
            int i4 = this.f11449;
            if (jArr[i4] <= j) {
                C3710 c37102 = this.f11447[i4];
                C4150.m6755(c37102);
                C3710 c37103 = c37102;
                Handler handler = this.f11445;
                if (handler != null) {
                    handler.obtainMessage(0, c37103).sendToTarget();
                } else {
                    this.f11444.mo5671(c37103);
                }
                C3710[] c3710Arr = this.f11447;
                int i5 = this.f11449;
                c3710Arr[i5] = null;
                this.f11449 = (i5 + 1) % 5;
                this.f11450--;
            }
        }
    }

    @Override // p138.p176.p177.p190.AbstractC3413
    /* JADX INFO: renamed from: ֏ */
    public void mo1150(long j, boolean z) {
        Arrays.fill(this.f11447, (Object) null);
        this.f11449 = 0;
        this.f11450 = 0;
        this.f11452 = false;
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final void m6062(C3710 c3710, List<C3710.InterfaceC3712> list) {
        int i = 0;
        while (true) {
            C3710.InterfaceC3712[] interfaceC3712Arr = c3710.f11440;
            if (i >= interfaceC3712Arr.length) {
                return;
            }
            C3431 c3431Mo5966 = interfaceC3712Arr[i].mo5966();
            if (c3431Mo5966 == null || !this.f11443.mo6061(c3431Mo5966)) {
                list.add(c3710.f11440[i]);
            } else {
                InterfaceC3714 interfaceC3714Mo6060 = this.f11443.mo6060(c3431Mo5966);
                byte[] bArrMo5967 = c3710.f11440[i].mo5967();
                C0567.m1856(bArrMo5967);
                byte[] bArr = bArrMo5967;
                this.f11446.mo5803();
                this.f11446.m5811(bArr.length);
                ByteBuffer byteBuffer = this.f11446.f10461;
                C4150.m6755(byteBuffer);
                byteBuffer.put(bArr);
                this.f11446.m5812();
                C3710 c3710Mo6059 = interfaceC3714Mo6060.mo6059(this.f11446);
                if (c3710Mo6059 != null) {
                    m6062(c3710Mo6059, list);
                }
            }
            i++;
        }
    }

    @Override // p138.p176.p177.p190.AbstractC3413
    /* JADX INFO: renamed from: ֏ */
    public void mo1315(C3431[] c3431Arr, long j) {
        this.f11451 = this.f11443.mo6060(c3431Arr[0]);
    }

    @Override // p138.p176.p177.p190.InterfaceC3450
    /* JADX INFO: renamed from: ؠ */
    public boolean mo1166() {
        return this.f11452;
    }

    @Override // p138.p176.p177.p190.InterfaceC3450
    /* JADX INFO: renamed from: ރ */
    public boolean mo1169() {
        return true;
    }

    @Override // p138.p176.p177.p190.AbstractC3413
    /* JADX INFO: renamed from: ޏ */
    public void mo1170() {
        Arrays.fill(this.f11447, (Object) null);
        this.f11449 = 0;
        this.f11450 = 0;
        this.f11451 = null;
    }
}
