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

import androidx.annotation.Nullable;

/* JADX INFO: loaded from: classes2.dex */
public final class v3 {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final byte[] f17488a = new byte[10];

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public boolean f17489b;

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

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

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

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

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

    public final void a(p2 p2Var) {
        if (this.f17489b) {
            return;
        }
        byte[] bArr = this.f17488a;
        p2Var.h(0, 10, bArr);
        p2Var.zzl();
        if (bArr[4] == -8 && bArr[5] == 114 && bArr[6] == 111 && (bArr[7] & 254) == 186) {
            this.f17489b = true;
        }
    }

    public final void zzc(u3 u3Var, long j10, int i10, int i11, int i12, @Nullable t3 t3Var) {
        ih1.f1("TrueHD chunk samples must be contiguous in the sample queue.", this.f17494g <= i11 + i12);
        if (this.f17489b) {
            int i13 = this.f17490c;
            int i14 = i13 + 1;
            this.f17490c = i14;
            if (i13 == 0) {
                this.f17491d = j10;
                this.f17492e = i10;
                this.f17493f = 0;
            }
            this.f17493f += i11;
            this.f17494g = i12;
            if (i14 >= 16) {
                zzd(u3Var, t3Var);
            }
        }
    }

    public final void zzd(u3 u3Var, @Nullable t3 t3Var) {
        if (this.f17490c > 0) {
            u3Var.zze(this.f17491d, this.f17492e, this.f17493f, this.f17494g, t3Var);
            this.f17490c = 0;
        }
    }
}
