2021-12-17 21:59:34 +00:00
|
|
|
package b.i.a.c.t2;
|
2021-08-03 07:33:18 +00:00
|
|
|
|
2021-12-17 21:59:34 +00:00
|
|
|
import b.c.a.a0.d;
|
|
|
|
import b.i.a.c.f3.e0;
|
2021-08-03 07:33:18 +00:00
|
|
|
import com.google.android.exoplayer2.audio.AudioProcessor;
|
|
|
|
import java.nio.ByteBuffer;
|
|
|
|
/* compiled from: SilenceSkippingAudioProcessor */
|
2021-11-05 06:48:17 +00:00
|
|
|
public final class c0 extends v {
|
2021-08-03 07:33:18 +00:00
|
|
|
public final long i = 150000;
|
|
|
|
public final long j = 20000;
|
|
|
|
public final short k = 1024;
|
|
|
|
public int l;
|
|
|
|
public boolean m;
|
|
|
|
public byte[] n;
|
|
|
|
public byte[] o;
|
|
|
|
public int p;
|
|
|
|
public int q;
|
2021-11-02 06:38:17 +00:00
|
|
|
public int r;
|
2021-08-03 07:33:18 +00:00
|
|
|
|
2021-11-02 06:38:17 +00:00
|
|
|
/* renamed from: s reason: collision with root package name */
|
2022-01-27 07:52:47 +00:00
|
|
|
public boolean f1114s;
|
2021-08-03 07:33:18 +00:00
|
|
|
public long t;
|
|
|
|
|
2021-11-05 06:48:17 +00:00
|
|
|
public c0() {
|
|
|
|
d.j(true);
|
|
|
|
byte[] bArr = e0.f;
|
2021-08-03 07:33:18 +00:00
|
|
|
this.n = bArr;
|
|
|
|
this.o = bArr;
|
|
|
|
}
|
|
|
|
|
2021-12-17 21:59:34 +00:00
|
|
|
@Override // b.i.a.c.t2.v, com.google.android.exoplayer2.audio.AudioProcessor
|
2021-08-03 07:33:18 +00:00
|
|
|
public boolean a() {
|
|
|
|
return this.m;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.google.android.exoplayer2.audio.AudioProcessor
|
|
|
|
public void c(ByteBuffer byteBuffer) {
|
|
|
|
int position;
|
|
|
|
while (byteBuffer.hasRemaining() && !this.g.hasRemaining()) {
|
|
|
|
int i = this.p;
|
|
|
|
if (i == 0) {
|
|
|
|
int limit = byteBuffer.limit();
|
|
|
|
byteBuffer.limit(Math.min(limit, byteBuffer.position() + this.n.length));
|
|
|
|
int limit2 = byteBuffer.limit();
|
|
|
|
while (true) {
|
|
|
|
limit2 -= 2;
|
|
|
|
if (limit2 >= byteBuffer.position()) {
|
|
|
|
if (Math.abs((int) byteBuffer.getShort(limit2)) > this.k) {
|
|
|
|
int i2 = this.l;
|
|
|
|
position = ((limit2 / i2) * i2) + i2;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
position = byteBuffer.position();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (position == byteBuffer.position()) {
|
|
|
|
this.p = 1;
|
|
|
|
} else {
|
|
|
|
byteBuffer.limit(position);
|
|
|
|
int remaining = byteBuffer.remaining();
|
|
|
|
j(remaining).put(byteBuffer).flip();
|
|
|
|
if (remaining > 0) {
|
2022-01-27 07:52:47 +00:00
|
|
|
this.f1114s = true;
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
byteBuffer.limit(limit);
|
|
|
|
} else if (i == 1) {
|
|
|
|
int limit3 = byteBuffer.limit();
|
|
|
|
int k = k(byteBuffer);
|
|
|
|
int position2 = k - byteBuffer.position();
|
|
|
|
byte[] bArr = this.n;
|
|
|
|
int length = bArr.length;
|
|
|
|
int i3 = this.q;
|
|
|
|
int i4 = length - i3;
|
|
|
|
if (k >= limit3 || position2 >= i4) {
|
|
|
|
int min = Math.min(position2, i4);
|
|
|
|
byteBuffer.limit(byteBuffer.position() + min);
|
|
|
|
byteBuffer.get(this.n, this.q, min);
|
|
|
|
int i5 = this.q + min;
|
|
|
|
this.q = i5;
|
|
|
|
byte[] bArr2 = this.n;
|
|
|
|
if (i5 == bArr2.length) {
|
2022-01-27 07:52:47 +00:00
|
|
|
if (this.f1114s) {
|
2021-11-02 06:38:17 +00:00
|
|
|
l(bArr2, this.r);
|
|
|
|
this.t += (long) ((this.q - (this.r * 2)) / this.l);
|
2021-08-03 07:33:18 +00:00
|
|
|
} else {
|
2021-11-02 06:38:17 +00:00
|
|
|
this.t += (long) ((i5 - this.r) / this.l);
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
m(byteBuffer, this.n, this.q);
|
|
|
|
this.q = 0;
|
|
|
|
this.p = 2;
|
|
|
|
}
|
|
|
|
byteBuffer.limit(limit3);
|
|
|
|
} else {
|
|
|
|
l(bArr, i3);
|
|
|
|
this.q = 0;
|
|
|
|
this.p = 0;
|
|
|
|
}
|
|
|
|
} else if (i == 2) {
|
|
|
|
int limit4 = byteBuffer.limit();
|
|
|
|
int k2 = k(byteBuffer);
|
|
|
|
byteBuffer.limit(k2);
|
|
|
|
this.t += (long) (byteBuffer.remaining() / this.l);
|
2021-11-02 06:38:17 +00:00
|
|
|
m(byteBuffer, this.o, this.r);
|
2021-08-03 07:33:18 +00:00
|
|
|
if (k2 < limit4) {
|
2021-11-02 06:38:17 +00:00
|
|
|
l(this.o, this.r);
|
2021-08-03 07:33:18 +00:00
|
|
|
this.p = 0;
|
|
|
|
byteBuffer.limit(limit4);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
throw new IllegalStateException();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-17 21:59:34 +00:00
|
|
|
@Override // b.i.a.c.t2.v
|
2021-08-03 07:33:18 +00:00
|
|
|
public AudioProcessor.a f(AudioProcessor.a aVar) throws AudioProcessor.UnhandledAudioFormatException {
|
|
|
|
if (aVar.d == 2) {
|
|
|
|
return this.m ? aVar : AudioProcessor.a.a;
|
|
|
|
}
|
|
|
|
throw new AudioProcessor.UnhandledAudioFormatException(aVar);
|
|
|
|
}
|
|
|
|
|
2021-12-17 21:59:34 +00:00
|
|
|
@Override // b.i.a.c.t2.v
|
2021-08-03 07:33:18 +00:00
|
|
|
public void g() {
|
|
|
|
if (this.m) {
|
2022-01-27 07:52:47 +00:00
|
|
|
AudioProcessor.a aVar = this.f1132b;
|
2021-08-03 07:33:18 +00:00
|
|
|
int i = aVar.e;
|
|
|
|
this.l = i;
|
|
|
|
long j = this.i;
|
2022-01-28 08:12:23 +00:00
|
|
|
long j2 = (long) aVar.f2890b;
|
2021-08-03 07:33:18 +00:00
|
|
|
int i2 = ((int) ((j * j2) / 1000000)) * i;
|
|
|
|
if (this.n.length != i2) {
|
|
|
|
this.n = new byte[i2];
|
|
|
|
}
|
|
|
|
int i3 = ((int) ((this.j * j2) / 1000000)) * i;
|
2021-11-02 06:38:17 +00:00
|
|
|
this.r = i3;
|
2021-08-03 07:33:18 +00:00
|
|
|
if (this.o.length != i3) {
|
|
|
|
this.o = new byte[i3];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.p = 0;
|
|
|
|
this.t = 0;
|
|
|
|
this.q = 0;
|
2022-01-27 07:52:47 +00:00
|
|
|
this.f1114s = false;
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
|
2021-12-17 21:59:34 +00:00
|
|
|
@Override // b.i.a.c.t2.v
|
2021-08-03 07:33:18 +00:00
|
|
|
public void h() {
|
|
|
|
int i = this.q;
|
|
|
|
if (i > 0) {
|
|
|
|
l(this.n, i);
|
|
|
|
}
|
2022-01-27 07:52:47 +00:00
|
|
|
if (!this.f1114s) {
|
2021-11-02 06:38:17 +00:00
|
|
|
this.t += (long) (this.r / this.l);
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-17 21:59:34 +00:00
|
|
|
@Override // b.i.a.c.t2.v
|
2021-08-03 07:33:18 +00:00
|
|
|
public void i() {
|
|
|
|
this.m = false;
|
2021-11-02 06:38:17 +00:00
|
|
|
this.r = 0;
|
2021-11-05 06:48:17 +00:00
|
|
|
byte[] bArr = e0.f;
|
2021-08-03 07:33:18 +00:00
|
|
|
this.n = bArr;
|
|
|
|
this.o = bArr;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final int k(ByteBuffer byteBuffer) {
|
|
|
|
for (int position = byteBuffer.position(); position < byteBuffer.limit(); position += 2) {
|
|
|
|
if (Math.abs((int) byteBuffer.getShort(position)) > this.k) {
|
|
|
|
int i = this.l;
|
|
|
|
return (position / i) * i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return byteBuffer.limit();
|
|
|
|
}
|
|
|
|
|
|
|
|
public final void l(byte[] bArr, int i) {
|
|
|
|
j(i).put(bArr, 0, i).flip();
|
|
|
|
if (i > 0) {
|
2022-01-27 07:52:47 +00:00
|
|
|
this.f1114s = true;
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public final void m(ByteBuffer byteBuffer, byte[] bArr, int i) {
|
2021-11-02 06:38:17 +00:00
|
|
|
int min = Math.min(byteBuffer.remaining(), this.r);
|
|
|
|
int i2 = this.r - min;
|
2021-08-03 07:33:18 +00:00
|
|
|
System.arraycopy(bArr, i - i2, this.o, 0, i2);
|
|
|
|
byteBuffer.position(byteBuffer.limit() - min);
|
|
|
|
byteBuffer.get(this.o, i2, min);
|
|
|
|
}
|
|
|
|
}
|