package com.applovin.impl; import java.nio.ByteBuffer; /* loaded from: classes.dex */ final class g2 extends p5 { private long j; private int k; private int l; public long j() { return this.f; } public long k() { return this.j; } public int l() { return this.k; } public boolean m() { return this.k > 0; } public g2() { super(2); this.l = 32; } public void i(int i) { b1.a(i > 0); this.l = i; } public boolean a(p5 p5Var) { b1.a(!p5Var.h()); b1.a(!p5Var.c()); b1.a(!p5Var.e()); if (!b(p5Var)) { return false; } int i = this.k; this.k = i + 1; if (i == 0) { this.f = p5Var.f; if (p5Var.f()) { e(1); } } if (p5Var.d()) { e(Integer.MIN_VALUE); } ByteBuffer byteBuffer = p5Var.c; if (byteBuffer != null) { g(byteBuffer.remaining()); this.c.put(byteBuffer); } this.j = p5Var.f; return true; } private boolean b(p5 p5Var) { ByteBuffer byteBuffer; if (!m()) { return true; } if (this.k >= this.l || p5Var.d() != d()) { return false; } ByteBuffer byteBuffer2 = p5Var.c; return byteBuffer2 == null || (byteBuffer = this.c) == null || byteBuffer.position() + byteBuffer2.remaining() <= 3072000; } @Override // com.applovin.impl.p5, com.applovin.impl.l2 public void b() { super.b(); this.k = 0; } }