package com.google.android.gms.internal.ads;

import androidx.media3.common.MimeTypes;
import com.bytedance.sdk.openadsdk.TTAdConstant;
import java.math.RoundingMode;
import okhttp3.internal.http.StatusLine;

/* JADX INFO: loaded from: classes2.dex */
public final class lb implements mb {

    /* JADX INFO: renamed from: m, reason: collision with root package name */
    public static final int[] f13586m = {-1, -1, -1, -1, 2, 4, 6, 8, -1, -1, -1, -1, 2, 4, 6, 8};

    /* JADX INFO: renamed from: n, reason: collision with root package name */
    public static final int[] f13587n = {7, 8, 9, 10, 11, 12, 13, 14, 16, 17, 19, 21, 23, 25, 28, 31, 34, 37, 41, 45, 50, 55, 60, 66, 73, 80, 88, 97, 107, 118, 130, 143, 157, TTAdConstant.IMAGE_MODE_VERTICAL_IMG_173, 190, 209, 230, 253, 279, StatusLine.HTTP_TEMP_REDIRECT, 337, 371, 408, 449, 494, 544, 598, 658, 724, 796, 876, 963, 1060, 1166, 1282, 1411, 1552, 1707, 1878, 2066, 2272, 2499, 2749, 3024, 3327, 3660, 4026, 4428, 4871, 5358, 5894, 6484, 7132, 7845, 8630, 9493, 10442, 11487, 12635, 13899, 15289, 16818, 18500, 20350, 22385, 24623, 27086, 29794, 32767};

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final q2 f13588a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final u3 f13589b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final pb f13590c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final int f13591d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public final byte[] f13592e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public final p01 f13593f;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public final int f13594g;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public final zn2 f13595h;

    /* JADX INFO: renamed from: i, reason: collision with root package name */
    public int f13596i;

    /* JADX INFO: renamed from: j, reason: collision with root package name */
    public long f13597j;

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    public int f13598k;

    /* JADX INFO: renamed from: l, reason: collision with root package name */
    public long f13599l;

    public lb(q2 q2Var, u3 u3Var, pb pbVar) throws zzat {
        this.f13588a = q2Var;
        this.f13589b = u3Var;
        this.f13590c = pbVar;
        int iMax = Math.max(1, pbVar.f15353c / 10);
        this.f13594g = iMax;
        p01 p01Var = new p01((byte[]) pbVar.f15356f);
        p01Var.K();
        int iK = p01Var.K();
        this.f13591d = iK;
        int i10 = pbVar.f15352b;
        int i11 = pbVar.f15354d;
        int iC = defpackage.e.C(i11 - (i10 * 4), 8, pbVar.f15355e * i10, 1);
        if (iK != iC) {
            throw zzat.zzb(com.google.android.gms.measurement.internal.u1.m(new StringBuilder(String.valueOf(iC).length() + 34 + String.valueOf(iK).length()), "Expected frames per block: ", iC, "; got: ", iK), null);
        }
        String str = bb1.f9474a;
        int i12 = ((iMax + iK) - 1) / iK;
        this.f13592e = new byte[i11 * i12];
        this.f13593f = new p01((iK + iK) * i10 * i12);
        int i13 = ((pbVar.f15353c * pbVar.f15354d) * 8) / iK;
        sm2 sm2Var = new sm2();
        sm2Var.zzm(MimeTypes.AUDIO_RAW);
        sm2Var.f16481d = i13;
        sm2Var.f16482e = i13;
        sm2Var.f16483f = (iMax + iMax) * i10;
        sm2Var.f16496s = pbVar.f15352b;
        sm2Var.f16497t = pbVar.f15353c;
        sm2Var.f16498u = 2;
        this.f13595h = new zn2(sm2Var);
    }

    @Override // com.google.android.gms.internal.ads.mb
    public final void a(long j10) {
        this.f13596i = 0;
        this.f13597j = j10;
        this.f13598k = 0;
        this.f13599l = 0L;
    }

    @Override // com.google.android.gms.internal.ads.mb
    public final void b(int i10, long j10) {
        this.f13588a.k(new qb(this.f13590c, this.f13591d, i10, j10));
        u3 u3Var = this.f13589b;
        u3Var.d(this.f13595h);
        u3Var.zzN();
    }

    /* JADX WARN: Removed duplicated region for block: B:44:0x0045 A[ADDED_TO_REGION, EDGE_INSN: B:44:0x0045->B:14:0x0045 BREAK  A[LOOP:0: B:6:0x0024->B:13:0x003f], REMOVE, SYNTHETIC] */
    /* JADX WARN: Removed duplicated region for block: B:8:0x0028  */
    /* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:11:0x003c -> B:4:0x0021). Please report as a decompilation issue!!! */
    /*  JADX ERROR: JadxOverflowException in pass: RegionMakerVisitor
        jadx.core.utils.exceptions.JadxOverflowException: Regions count limit reached
        	at jadx.core.utils.ErrorsCounter.addError(ErrorsCounter.java:59)
        	at jadx.core.utils.ErrorsCounter.error(ErrorsCounter.java:31)
        	at jadx.core.dex.attributes.nodes.NotificationAttrNode.addError(NotificationAttrNode.java:19)
        */
    @Override // com.google.android.gms.internal.ads.mb
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final boolean c(com.google.android.gms.internal.ads.p2 r27, long r28) {
        /*
            Method dump skipped, instruction units count: 340
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: com.google.android.gms.internal.ads.lb.c(com.google.android.gms.internal.ads.p2, long):boolean");
    }

    public final void d(int i10) {
        pb pbVar = this.f13590c;
        long jR = this.f13597j + bb1.r(this.f13599l, 1000000L, pbVar.f15353c, RoundingMode.DOWN);
        int i11 = (i10 + i10) * pbVar.f15352b;
        this.f13589b.zze(jR, 1, i11, this.f13598k - i11, null);
        this.f13599l += (long) i10;
        this.f13598k -= i11;
    }
}
