package androidx.media3.decoder.ffmpeg;

import android.media.AudioDeviceInfo;
import android.os.Handler;
import android.os.SystemClock;
import android.os.Trace;
import androidx.media3.decoder.DecoderException;
import androidx.media3.decoder.SimpleDecoderOutputBuffer;
import androidx.media3.exoplayer.ExoPlaybackException;
import androidx.media3.exoplayer.audio.AudioSink$ConfigurationException;
import androidx.media3.exoplayer.audio.AudioSink$InitializationException;
import androidx.media3.exoplayer.audio.AudioSink$WriteException;
import defpackage.AbstractC0588;
import defpackage.AbstractC2692;
import defpackage.AbstractC2924;
import defpackage.AbstractC3558;
import defpackage.AbstractC4483;
import defpackage.AbstractC4486;
import defpackage.C0068;
import defpackage.C0298;
import defpackage.C1028;
import defpackage.C1545;
import defpackage.C1875;
import defpackage.C2153;
import defpackage.C2258;
import defpackage.C2441;
import defpackage.C2477;
import defpackage.C2720;
import defpackage.C3446;
import defpackage.C3767;
import defpackage.C4779;
import defpackage.InterfaceC1660;
import defpackage.InterfaceC3574;
import defpackage.InterfaceC3601;
import defpackage.InterfaceC3662;
import defpackage.InterfaceC3867;
import defpackage.InterfaceC5498;
import defpackage.RunnableC0421;
import defpackage.RunnableC1615;

/* renamed from: androidx.media3.decoder.ffmpeg.ᵴᵳ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final class C0014 extends AbstractC4483 implements InterfaceC5498 {

    /* renamed from: ʽᵢˊ, reason: contains not printable characters */
    public long f577;

    /* renamed from: ʾᵻᵭٴ, reason: contains not printable characters */
    public boolean f578;

    /* renamed from: ˀˁᵨ, reason: contains not printable characters */
    public int f579;

    /* renamed from: ˀᵗᵩ, reason: contains not printable characters */
    public C4779 f580;

    /* renamed from: ˆᵴᵜˏ, reason: contains not printable characters */
    public final long[] f581;

    /* renamed from: ˆᵼᵷˊ, reason: contains not printable characters */
    public C3446 f582;

    /* renamed from: ˊʽˎ, reason: contains not printable characters */
    public C2441 f583;

    /* renamed from: ˊʾˊ, reason: contains not printable characters */
    public boolean f584;

    /* renamed from: ˊᵸˊ, reason: contains not printable characters */
    public final C2441 f585;

    /* renamed from: ˌᵪ, reason: contains not printable characters */
    public int f586;

    /* renamed from: ˌᵹᵨˑ, reason: contains not printable characters */
    public long f587;

    /* renamed from: ˎᵬˀ, reason: contains not printable characters */
    public SimpleDecoderOutputBuffer f588;

    /* renamed from: ˑᵝﹳᵜ, reason: contains not printable characters */
    public final InterfaceC3867 f589;

    /* renamed from: ᵛˈᵤ, reason: contains not printable characters */
    public int f590;

    /* renamed from: ᵠᵪˀᵻ, reason: contains not printable characters */
    public long f591;

    /* renamed from: ᵠᵿː, reason: contains not printable characters */
    public boolean f592;

    /* renamed from: ᵡᵘˎʽ, reason: contains not printable characters */
    public final ᵪᵨ f593;

    /* renamed from: ᵡᵶᵡ, reason: contains not printable characters */
    public InterfaceC3574 f594;

    /* renamed from: ᵣᵟᵔ, reason: contains not printable characters */
    public boolean f595;

    /* renamed from: ᵤᵼˑʠ, reason: contains not printable characters */
    public long f596;

    /* renamed from: ᵥʩᵩˑ, reason: contains not printable characters */
    public boolean f597;

    /* renamed from: ᵨٴ, reason: contains not printable characters */
    public long f598;

    /* renamed from: ᵫᵮʾ, reason: contains not printable characters */
    public InterfaceC1660 f599;

    /* renamed from: ᵲᵟ, reason: contains not printable characters */
    public boolean f600;

    /* renamed from: ᵳᵹᵺˋ, reason: contains not printable characters */
    public boolean f601;

    /* renamed from: ᵷᵱ, reason: contains not printable characters */
    public boolean f602;

    /* renamed from: ᵺᵠ, reason: contains not printable characters */
    public boolean f603;

    /* renamed from: ᵽʛ, reason: contains not printable characters */
    public InterfaceC1660 f604;

    /* renamed from: ﹶـ, reason: contains not printable characters */
    public int f605;

    public C0014(Handler handler, InterfaceC3662 interfaceC3662, InterfaceC3867 interfaceC3867) {
        super(1);
        this.f593 = new ᵪᵨ(handler, interfaceC3662);
        this.f589 = interfaceC3867;
        this.f585 = new C2441(0, 0);
        this.f579 = 0;
        this.f602 = true;
        m373(-9223372036854775807L);
        this.f581 = new long[10];
        this.f598 = -9223372036854775807L;
        this.f577 = -9223372036854775807L;
        this.f591 = -9223372036854775807L;
    }

    /* JADX WARN: Removed duplicated region for block: B:21:0x0049  */
    @Override // defpackage.AbstractC4483
    /* renamed from: ˀᵗᵝᵭ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public final int mo372(defpackage.C3446 r7) {
        /*
            r6 = this;
            java.lang.String r0 = r7.f12929
            int r1 = r7.f12936
            int r2 = r7.f12923
            boolean r0 = defpackage.AbstractC2924.m7113(r0)
            r3 = 0
            if (r0 != 0) goto L12
            int r6 = defpackage.AbstractC2990.m7325(r3, r3, r3, r3)
            return r6
        L12:
            java.lang.String r0 = r7.f12929
            r0.getClass()
            boolean r4 = androidx.media3.decoder.ffmpeg.FfmpegLibrary.m371()
            r5 = 2
            if (r4 == 0) goto L4b
            boolean r4 = defpackage.AbstractC2924.m7113(r0)
            if (r4 != 0) goto L25
            goto L4b
        L25:
            boolean r0 = androidx.media3.decoder.ffmpeg.FfmpegLibrary.m367(r0)
            if (r0 == 0) goto L49
            ᵤᵛᵖ r0 = defpackage.AbstractC3558.m8139(r5, r2, r1)
            ᵪˀʓᵢ r6 = r6.f589
            boolean r0 = r6.mo2577(r0)
            r4 = 4
            if (r0 != 0) goto L43
            ᵤᵛᵖ r0 = defpackage.AbstractC3558.m8139(r4, r2, r1)
            boolean r6 = r6.mo2577(r0)
            if (r6 != 0) goto L43
            goto L49
        L43:
            int r6 = r7.f12902
            if (r6 == 0) goto L4c
            r4 = r5
            goto L4c
        L49:
            r4 = 1
            goto L4c
        L4b:
            r4 = r3
        L4c:
            if (r4 > r5) goto L53
            int r6 = defpackage.AbstractC2990.m7325(r4, r3, r3, r3)
            return r6
        L53:
            r6 = r4 | 168(0xa8, float:2.35E-43)
            return r6
        */
        throw new UnsupportedOperationException("Method not decompiled: androidx.media3.decoder.ffmpeg.C0014.mo372(ᵤᵛᵖ):int");
    }

    /* renamed from: ˁˑᵰ, reason: contains not printable characters */
    public final void m373(long j) {
        this.f596 = j;
        if (j != -9223372036854775807L) {
            this.f589.getClass();
        }
    }

    @Override // defpackage.AbstractC4483
    /* renamed from: ˌʾˀ, reason: contains not printable characters */
    public final void mo374(long j, boolean z, boolean z2) throws ExoPlaybackException, InterruptedException {
        this.f589.flush();
        this.f587 = j;
        this.f591 = -9223372036854775807L;
        this.f595 = false;
        this.f597 = false;
        this.f592 = true;
        this.f578 = false;
        this.f603 = false;
        if (this.f594 != null) {
            if (this.f579 != 0) {
                m393();
                m396();
                return;
            }
            this.f583 = null;
            SimpleDecoderOutputBuffer simpleDecoderOutputBuffer = this.f588;
            if (simpleDecoderOutputBuffer != null) {
                simpleDecoderOutputBuffer.mo359();
                this.f588 = null;
            }
            InterfaceC3574 interfaceC3574 = this.f594;
            interfaceC3574.getClass();
            AbstractC0588 abstractC0588 = (AbstractC0588) interfaceC3574;
            abstractC0588.flush();
            abstractC0588.mo1219(this.f16726);
            this.f584 = false;
        }
    }

    @Override // defpackage.AbstractC4483
    /* renamed from: ˌᵜᵹᵩ, reason: contains not printable characters */
    public final boolean mo375() {
        return this.f603 && this.f589.mo2570();
    }

    @Override // defpackage.InterfaceC5498
    /* renamed from: ˎˏʜʾ, reason: contains not printable characters */
    public final C0068 mo376() {
        return this.f589.mo2546();
    }

    /* renamed from: ˎˑː, reason: contains not printable characters */
    public final InterfaceC3574 m377(C3446 c3446) {
        Trace.beginSection("createFfmpegAudioDecoder");
        int i = c3446.f12903;
        int i2 = c3446.f12936;
        int i3 = c3446.f12923;
        if (i == -1) {
            i = 5760;
        }
        C3446 c3446M8139 = AbstractC3558.m8139(2, i3, i2);
        InterfaceC3867 interfaceC3867 = this.f589;
        FfmpegAudioDecoder ffmpegAudioDecoder = new FfmpegAudioDecoder(i, c3446, interfaceC3867.mo2577(c3446M8139) ? interfaceC3867.mo2567(AbstractC3558.m8139(4, i3, i2)) != 2 ? false : true ^ "audio/ac3".equals(c3446.f12929) : true);
        Trace.endSection();
        return ffmpegAudioDecoder;
    }

    @Override // defpackage.InterfaceC5498
    /* renamed from: ˏˋٴ, reason: contains not printable characters */
    public final void mo378(C0068 c0068) {
        this.f589.mo2548(c0068);
    }

    @Override // defpackage.AbstractC4483, defpackage.InterfaceC1822
    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public final void mo379(int i, Object obj) {
        InterfaceC3867 interfaceC3867 = this.f589;
        if (i == 2) {
            interfaceC3867.mo2552(((Float) obj).floatValue());
            return;
        }
        if (i == 3) {
            interfaceC3867.mo2573((C1028) obj);
            return;
        }
        if (i == 6) {
            interfaceC3867.mo2579((C0298) obj);
            return;
        }
        if (i == 12) {
            interfaceC3867.setPreferredDevice((AudioDeviceInfo) obj);
            return;
        }
        if (i == 9) {
            interfaceC3867.mo2560(((Boolean) obj).booleanValue());
            return;
        }
        if (i == 10) {
            interfaceC3867.mo2574(((Integer) obj).intValue());
            return;
        }
        if (i == 19) {
            obj.getClass();
            interfaceC3867.mo2578(((Integer) obj).intValue());
        } else {
            if (i != 20) {
                return;
            }
            obj.getClass();
            interfaceC3867.mo2568((InterfaceC3601) obj);
        }
    }

    @Override // defpackage.AbstractC4483
    /* renamed from: ˑᵱ, reason: contains not printable characters */
    public final void mo380(C3446[] c3446Arr, long j, long j2, C2477 c2477) {
        this.f601 = false;
        if (this.f596 == -9223372036854775807L) {
            m373(j2);
            return;
        }
        int i = this.f605;
        long[] jArr = this.f581;
        if (i == jArr.length) {
            ᵳʿˉ.ᵶʔᵢˊ("Too many stream changes, so dropping offset: " + jArr[this.f605 - 1]);
        } else {
            this.f605 = i + 1;
        }
        jArr[this.f605 - 1] = j2;
    }

    /* renamed from: ᐧﾞ, reason: contains not printable characters */
    public final void m381(C2720 c2720) throws ExoPlaybackException, InterruptedException {
        C3446 c3446 = (C3446) c2720.f10550;
        c3446.getClass();
        InterfaceC1660 interfaceC1660 = (InterfaceC1660) c2720.f10548;
        AbstractC4486.m9554(this.f604, interfaceC1660);
        this.f604 = interfaceC1660;
        C3446 c34462 = this.f582;
        this.f582 = c3446;
        this.f590 = c3446.f12931;
        this.f586 = c3446.f12900;
        InterfaceC3574 interfaceC3574 = this.f594;
        ᵪᵨ r8 = this.f593;
        if (interfaceC3574 == null) {
            m396();
            C3446 c34463 = this.f582;
            Handler handler = (Handler) r8.ᵢˇᵭ;
            if (handler != null) {
                handler.post(new RunnableC0421(r8, c34463, null, 6));
                return;
            }
            return;
        }
        C3767 c3767 = interfaceC1660 != this.f599 ? new C3767(((FfmpegAudioDecoder) interfaceC3574).m361(), c34462, c3446, 0, 128) : new C3767(((FfmpegAudioDecoder) interfaceC3574).m361(), c34462, c3446, 0, 1);
        if (c3767.f14052 == 0) {
            if (this.f584) {
                this.f579 = 1;
            } else {
                m393();
                m396();
                this.f602 = true;
            }
        }
        C3446 c34464 = this.f582;
        Handler handler2 = (Handler) r8.ᵢˇᵭ;
        if (handler2 != null) {
            handler2.post(new RunnableC0421(r8, c34464, c3767, 6));
        }
    }

    @Override // defpackage.AbstractC4483
    /* renamed from: ᵝᵵᵺ, reason: contains not printable characters */
    public final InterfaceC5498 mo382() {
        return this;
    }

    @Override // defpackage.AbstractC4483
    /* renamed from: ᵞʡ, reason: contains not printable characters */
    public final void mo383() {
        this.f589.mo2562();
        this.f600 = true;
    }

    @Override // defpackage.AbstractC4483
    /* renamed from: ᵡˎ, reason: contains not printable characters */
    public final int mo384() {
        return 8;
    }

    @Override // defpackage.InterfaceC5498
    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public final long mo385() {
        if (this.f16722 == 2) {
            m398();
        }
        return this.f587;
    }

    /* JADX WARN: Removed duplicated region for block: B:14:0x0022  */
    /* renamed from: ᵧـˌᵎ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public final boolean m386() throws androidx.media3.exoplayer.ExoPlaybackException, java.lang.InterruptedException {
        /*
            r7 = this;
            ᵦˌᵰᵝ r0 = r7.f594
            r1 = 0
            if (r0 == 0) goto Lc8
            int r2 = r7.f579
            r3 = 2
            if (r2 == r3) goto Lc8
            boolean r2 = r7.f578
            if (r2 == 0) goto L10
            goto Lc8
        L10:
            ᵗˏ r2 = r7.f583
            if (r2 != 0) goto L22
            ˀᵧᴵ r0 = (defpackage.AbstractC0588) r0
            java.lang.Object r0 = r0.mo1214()
            ᵗˏ r0 = (defpackage.C2441) r0
            r7.f583 = r0
            if (r0 != 0) goto L22
            goto Lc8
        L22:
            int r0 = r7.f579
            r2 = 4
            r4 = 0
            r5 = 1
            if (r0 != r5) goto L3c
            ᵗˏ r0 = r7.f583
            r0.f17323 = r2
            ᵦˌᵰᵝ r2 = r7.f594
            ˀᵧᴵ r2 = (defpackage.AbstractC0588) r2
            r2.getClass()
            r2.mo1216(r0)
            r7.f583 = r4
            r7.f579 = r3
            return r1
        L3c:
            ᵛʾᵼ r0 = r7.f16732
            r0.m6736()
            ᵗˏ r3 = r7.f583
            int r3 = r7.m9535(r0, r3, r1)
            r6 = -5
            if (r3 == r6) goto Lc4
            r0 = -4
            if (r3 == r0) goto L5f
            r0 = -3
            if (r3 != r0) goto L5b
            boolean r0 = r7.m9538()
            if (r0 == 0) goto Lc8
            long r2 = r7.f598
            r7.f577 = r2
            return r1
        L5b:
            ᵨᴵᵺ.ˌʾˀ()
            return r1
        L5f:
            ᵗˏ r0 = r7.f583
            boolean r0 = r0.m9873(r2)
            if (r0 == 0) goto L7c
            r7.f578 = r5
            long r2 = r7.f598
            r7.f577 = r2
            ᵦˌᵰᵝ r0 = r7.f594
            ᵗˏ r2 = r7.f583
            ˀᵧᴵ r0 = (defpackage.AbstractC0588) r0
            r0.getClass()
            r0.mo1216(r2)
            r7.f583 = r4
            return r1
        L7c:
            boolean r0 = r7.f601
            if (r0 != 0) goto L89
            r7.f601 = r5
            ᵗˏ r0 = r7.f583
            r1 = 134217728(0x8000000, float:3.85186E-34)
            r0.m9874(r1)
        L89:
            ᵗˏ r0 = r7.f583
            long r0 = r0.f9512
            r7.f598 = r0
            boolean r0 = r7.m9538()
            if (r0 != 0) goto L9f
            ᵗˏ r0 = r7.f583
            r1 = 536870912(0x20000000, float:1.0842022E-19)
            boolean r0 = r0.m9873(r1)
            if (r0 == 0) goto La3
        L9f:
            long r0 = r7.f598
            r7.f577 = r0
        La3:
            ᵗˏ r0 = r7.f583
            r0.m6219()
            ᵗˏ r0 = r7.f583
            ᵤᵛᵖ r1 = r7.f582
            r0.f9519 = r1
            ᵦˌᵰᵝ r1 = r7.f594
            ˀᵧᴵ r1 = (defpackage.AbstractC0588) r1
            r1.getClass()
            r1.mo1216(r0)
            r7.f584 = r5
            ᵶʾᵰ r0 = r7.f580
            int r1 = r0.f17755
            int r1 = r1 + r5
            r0.f17755 = r1
            r7.f583 = r4
            return r5
        Lc4:
            r7.m381(r0)
            return r5
        Lc8:
            return r1
        */
        throw new UnsupportedOperationException("Method not decompiled: androidx.media3.decoder.ffmpeg.C0014.m386():boolean");
    }

    @Override // defpackage.AbstractC4483
    /* renamed from: ᵨᵳʝ, reason: contains not printable characters */
    public final void mo387() {
        m398();
        this.f589.mo2543();
        this.f600 = false;
        this.f597 = false;
    }

    @Override // defpackage.AbstractC4483
    /* renamed from: ᵪʩ, reason: contains not printable characters */
    public final void mo388() {
        ᵪᵨ r0 = this.f593;
        this.f582 = null;
        this.f602 = true;
        m373(-9223372036854775807L);
        this.f595 = false;
        this.f597 = false;
        this.f591 = -9223372036854775807L;
        try {
            AbstractC4486.m9554(this.f604, null);
            this.f604 = null;
            m393();
            this.f589.reset();
        } finally {
            r0.ᵝᵵᵺ(this.f580);
        }
    }

    /* renamed from: ᵮᵠـˌ, reason: contains not printable characters */
    public final boolean m389() throws ExoPlaybackException, InterruptedException {
        if (this.f588 == null) {
            SimpleDecoderOutputBuffer simpleDecoderOutputBuffer = (SimpleDecoderOutputBuffer) ((AbstractC0588) this.f594).mo1222();
            this.f588 = simpleDecoderOutputBuffer;
            if (simpleDecoderOutputBuffer == null) {
                return false;
            }
            int i = simpleDecoderOutputBuffer.f2896;
            if (i > 0) {
                this.f580.f17754 += i;
                this.f589.mo2566();
            }
            if (this.f588.m9873(134217728)) {
                long[] jArr = this.f581;
                this.f589.mo2566();
                if (this.f605 != 0) {
                    m373(jArr[0]);
                    int i2 = this.f605 - 1;
                    this.f605 = i2;
                    System.arraycopy(jArr, 1, jArr, 0, i2);
                }
            }
        }
        if (this.f588.m9873(4)) {
            if (this.f579 == 2) {
                m393();
                m396();
                this.f602 = true;
                return false;
            }
            this.f588.mo359();
            this.f588 = null;
            try {
                this.f603 = true;
                this.f589.mo2575();
                this.f591 = this.f577;
                return false;
            } catch (AudioSink$WriteException e) {
                throw m9539(e, e.f620, e.f618, 5002);
            }
        }
        this.f591 = -9223372036854775807L;
        if (this.f602) {
            FfmpegAudioDecoder ffmpegAudioDecoder = (FfmpegAudioDecoder) this.f594;
            ffmpegAudioDecoder.getClass();
            C2153 c2153 = new C2153();
            c2153.f8516 = AbstractC2924.m7101("audio/raw");
            c2153.f8517 = ffmpegAudioDecoder.f566;
            c2153.f8513 = ffmpegAudioDecoder.f569;
            c2153.f8526 = ffmpegAudioDecoder.f568;
            C2153 c2153M7829 = new C3446(c2153).m7829();
            c2153M7829.f8502 = this.f590;
            c2153M7829.f8521 = this.f586;
            C3446 c3446 = this.f582;
            c2153M7829.f8524 = c3446.f12904;
            c2153M7829.f8512 = c3446.f12922;
            c2153M7829.f8520 = c3446.f12930;
            c2153M7829.f8498 = AbstractC2692.m6700(c3446.f12908);
            C3446 c34462 = this.f582;
            c2153M7829.f8527 = c34462.f12937;
            c2153M7829.f8492 = c34462.f12901;
            c2153M7829.f8497 = c34462.f12907;
            this.f589.mo2557(new C3446(c2153M7829), null);
            this.f602 = false;
        }
        InterfaceC3867 interfaceC3867 = this.f589;
        SimpleDecoderOutputBuffer simpleDecoderOutputBuffer2 = this.f588;
        if (!interfaceC3867.mo2572(1, simpleDecoderOutputBuffer2.f2897, simpleDecoderOutputBuffer2.f562)) {
            this.f591 = this.f588.f2897;
            return false;
        }
        this.f580.f17751++;
        this.f588.mo359();
        this.f588 = null;
        return true;
    }

    @Override // defpackage.AbstractC4483
    /* renamed from: ᵯٴᵦ, reason: contains not printable characters */
    public final boolean mo390() {
        return this.f589.mo2555();
    }

    @Override // defpackage.AbstractC4483
    /* renamed from: ᵳٴᵶ, reason: contains not printable characters */
    public final void mo391(boolean z, boolean z2) {
        C4779 c4779 = new C4779();
        this.f580 = c4779;
        ᵪᵨ r5 = this.f593;
        Handler handler = (Handler) r5.ᵢˇᵭ;
        if (handler != null) {
            handler.post(new RunnableC1615(r5, c4779, 6));
        }
        C2258 c2258 = this.f16731;
        c2258.getClass();
        boolean z3 = c2258.f8833;
        InterfaceC3867 interfaceC3867 = this.f589;
        if (z3) {
            interfaceC3867.mo2561();
        } else {
            interfaceC3867.mo2544();
        }
        C1545 c1545 = this.f16723;
        c1545.getClass();
        interfaceC3867.mo2565(c1545);
        C1875 c1875 = this.f16716;
        c1875.getClass();
        interfaceC3867.mo2541(c1875);
        interfaceC3867.mo2556(new ˊᵘʛ(19, this));
    }

    @Override // defpackage.InterfaceC5498
    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public final boolean mo392() {
        boolean z = this.f595;
        this.f595 = false;
        return z;
    }

    /* renamed from: ᵶʔᵢˊ, reason: contains not printable characters */
    public final void m393() throws InterruptedException {
        this.f583 = null;
        this.f588 = null;
        this.f579 = 0;
        this.f584 = false;
        this.f598 = -9223372036854775807L;
        this.f577 = -9223372036854775807L;
        InterfaceC3574 interfaceC3574 = this.f594;
        if (interfaceC3574 != null) {
            this.f580.f17758++;
            ((FfmpegAudioDecoder) interfaceC3574).mo364();
            String strM361 = ((FfmpegAudioDecoder) this.f594).m361();
            ᵪᵨ r2 = this.f593;
            Handler handler = (Handler) r2.ᵢˇᵭ;
            if (handler != null) {
                handler.post(new RunnableC1615(r2, strM361, 5));
            }
            this.f594 = null;
        }
        AbstractC4486.m9554(this.f599, null);
        this.f599 = null;
    }

    @Override // defpackage.AbstractC4483
    /* renamed from: ᵶᵷᵕ, reason: contains not printable characters */
    public final String mo394() {
        return "FfmpegAudioRenderer";
    }

    @Override // defpackage.AbstractC4483
    /* renamed from: ᵹᵝᵶ, reason: contains not printable characters */
    public final long mo395(long j, long j2) {
        InterfaceC3867 interfaceC3867 = this.f589;
        boolean z = interfaceC3867.mo2555() && this.f591 != -9223372036854775807L;
        if (this.f600) {
            long jMo2545 = interfaceC3867.mo2545();
            if (this.f597 && z && jMo2545 != -9223372036854775807L) {
                return Math.max(10000L, (long) ((Math.min(jMo2545, this.f591 - j) / (interfaceC3867.mo2546() != null ? interfaceC3867.mo2546().f1306 : 1.0f)) / 2.0f));
            }
        } else if (z || this.f603) {
            return 1000000L;
        }
        return 10000L;
    }

    /* renamed from: ᵺʙ, reason: contains not printable characters */
    public final void m396() throws ExoPlaybackException {
        ᵪᵨ r1 = this.f593;
        if (this.f594 != null) {
            return;
        }
        InterfaceC1660 interfaceC1660 = this.f604;
        AbstractC4486.m9554(this.f599, interfaceC1660);
        this.f599 = interfaceC1660;
        if (interfaceC1660 != null && interfaceC1660.mo4745() == null && this.f599.mo4740() == null) {
            return;
        }
        try {
            long jElapsedRealtime = SystemClock.elapsedRealtime();
            Trace.beginSection("createAudioDecoder");
            InterfaceC3574 interfaceC3574M377 = m377(this.f582);
            this.f594 = interfaceC3574M377;
            ((AbstractC0588) interfaceC3574M377).mo1219(this.f16726);
            Trace.endSection();
            long jElapsedRealtime2 = SystemClock.elapsedRealtime();
            String strM361 = ((FfmpegAudioDecoder) this.f594).m361();
            long j = jElapsedRealtime2 - jElapsedRealtime;
            Handler handler = (Handler) r1.ᵢˇᵭ;
            if (handler != null) {
                handler.post(new RunnableC1615(r1, strM361, jElapsedRealtime2, j));
            }
            this.f580.f17757++;
        } catch (DecoderException e) {
            ᵳʿˉ.ᵸˑ("Audio codec error", e);
            Handler handler2 = (Handler) r1.ᵢˇᵭ;
            if (handler2 != null) {
                handler2.post(new RunnableC1615(r1, e, 0));
            }
            throw m9539(e, this.f582, false, 4001);
        } catch (OutOfMemoryError e2) {
            throw m9539(e2, this.f582, false, 4001);
        }
    }

    @Override // defpackage.AbstractC4483
    /* renamed from: ᵿʗᵝʽ, reason: contains not printable characters */
    public final void mo397(long j, long j2) throws ExoPlaybackException, InterruptedException {
        if (this.f603) {
            try {
                this.f589.mo2575();
                this.f591 = this.f577;
                return;
            } catch (AudioSink$WriteException e) {
                throw m9539(e, e.f620, e.f618, 5002);
            }
        }
        if (this.f582 == null) {
            C2720 c2720 = this.f16732;
            c2720.m6736();
            this.f585.mo6221();
            int iM9535 = m9535(c2720, this.f585, 2);
            if (iM9535 != -5) {
                if (iM9535 == -4) {
                    ᵛᵾˏ.ᵿʗᵝʽ(this.f585.m9873(4));
                    this.f578 = true;
                    try {
                        this.f603 = true;
                        this.f589.mo2575();
                        this.f591 = this.f577;
                        return;
                    } catch (AudioSink$WriteException e2) {
                        throw m9539(e2, null, false, 5002);
                    }
                }
                return;
            }
            m381(c2720);
        }
        m396();
        if (this.f594 != null) {
            try {
                Trace.beginSection("drainAndFeed");
                while (m389()) {
                }
                while (m386()) {
                }
                Trace.endSection();
                synchronized (this.f580) {
                }
            } catch (DecoderException e3) {
                ᵳʿˉ.ᵸˑ("Audio codec error", e3);
                ᵪᵨ r4 = this.f593;
                Handler handler = (Handler) r4.ᵢˇᵭ;
                if (handler != null) {
                    handler.post(new RunnableC1615(r4, e3, 0));
                }
                throw m9539(e3, this.f582, false, 4003);
            } catch (AudioSink$ConfigurationException e4) {
                throw m9539(e4, e4.f615, false, 5001);
            } catch (AudioSink$InitializationException e5) {
                throw m9539(e5, e5.f616, e5.f617, 5001);
            } catch (AudioSink$WriteException e6) {
                throw m9539(e6, e6.f620, e6.f618, 5002);
            }
        }
    }

    /* renamed from: ﾞⁱ, reason: contains not printable characters */
    public final void m398() {
        long jMo2569 = this.f589.mo2569(mo375());
        if (jMo2569 != Long.MIN_VALUE) {
            if (!this.f592) {
                jMo2569 = Math.max(this.f587, jMo2569);
            }
            this.f587 = jMo2569;
            this.f592 = false;
        }
    }
}
