package p138.p176.p177.p190.p192;

import com.google.android.exoplayer2.audio.AudioProcessor;
import java.nio.ByteBuffer;
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 C3504 extends AbstractC3489 {

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

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

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

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

    /* JADX INFO: renamed from: ފ, reason: contains not printable characters */
    public byte[] f10440 = C4150.f13264;

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

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

    @Override // com.google.android.exoplayer2.audio.AudioProcessor
    /* JADX INFO: renamed from: ֏ */
    public void mo1059(ByteBuffer byteBuffer) {
        int iPosition = byteBuffer.position();
        int iLimit = byteBuffer.limit();
        int i = iLimit - iPosition;
        if (i == 0) {
            return;
        }
        int iMin = Math.min(i, this.f10439);
        this.f10442 += (long) (iMin / this.f10335.f1541);
        this.f10439 -= iMin;
        byteBuffer.position(iPosition + iMin);
        if (this.f10439 > 0) {
            return;
        }
        int i2 = i - iMin;
        int length = (this.f10441 + i2) - this.f10440.length;
        ByteBuffer byteBufferM5775 = m5775(length);
        int iM6743 = C4150.m6743(length, 0, this.f10441);
        byteBufferM5775.put(this.f10440, 0, iM6743);
        int iM67432 = C4150.m6743(length - iM6743, 0, i2);
        byteBuffer.limit(byteBuffer.position() + iM67432);
        byteBufferM5775.put(byteBuffer);
        byteBuffer.limit(iLimit);
        int i3 = i2 - iM67432;
        int i4 = this.f10441 - iM6743;
        this.f10441 = i4;
        byte[] bArr = this.f10440;
        System.arraycopy(bArr, iM6743, bArr, 0, i4);
        byteBuffer.get(this.f10440, this.f10441, i3);
        this.f10441 += i3;
        byteBufferM5775.flip();
    }

    @Override // p138.p176.p177.p190.p192.AbstractC3489
    /* JADX INFO: renamed from: ؠ */
    public AudioProcessor.C0268 mo5776(AudioProcessor.C0268 c0268) throws AudioProcessor.UnhandledAudioFormatException {
        if (c0268.f1540 != 2) {
            throw new AudioProcessor.UnhandledAudioFormatException(c0268);
        }
        this.f10438 = true;
        return (this.f10436 == 0 && this.f10437 == 0) ? AudioProcessor.C0268.f1537 : c0268;
    }

    @Override // p138.p176.p177.p190.p192.AbstractC3489, com.google.android.exoplayer2.audio.AudioProcessor
    /* JADX INFO: renamed from: ؠ */
    public boolean mo1060() {
        return super.mo1060() && this.f10441 == 0;
    }

    @Override // p138.p176.p177.p190.p192.AbstractC3489, com.google.android.exoplayer2.audio.AudioProcessor
    /* JADX INFO: renamed from: ށ */
    public ByteBuffer mo1062() {
        int i;
        if (super.mo1060() && (i = this.f10441) > 0) {
            m5775(i).put(this.f10440, 0, this.f10441).flip();
            this.f10441 = 0;
        }
        return super.mo1062();
    }

    @Override // p138.p176.p177.p190.p192.AbstractC3489
    /* JADX INFO: renamed from: ރ */
    public void mo5777() {
        if (this.f10438) {
            this.f10438 = false;
            int i = this.f10437;
            int i2 = this.f10335.f1541;
            this.f10440 = new byte[i * i2];
            this.f10439 = this.f10436 * i2;
        } else {
            this.f10439 = 0;
        }
        this.f10441 = 0;
    }

    @Override // p138.p176.p177.p190.p192.AbstractC3489
    /* JADX INFO: renamed from: ބ */
    public void mo5778() {
        if (this.f10438) {
            int i = this.f10441;
            if (i > 0) {
                this.f10442 += (long) (i / this.f10335.f1541);
            }
            this.f10441 = 0;
        }
    }

    @Override // p138.p176.p177.p190.p192.AbstractC3489
    /* JADX INFO: renamed from: ޅ */
    public void mo5779() {
        this.f10440 = C4150.f13264;
    }
}
