package defpackage;

import android.content.Context;
import android.media.DeniedByServerException;
import android.media.MediaCodec;
import android.media.MediaDrm;
import android.media.MediaDrmResetException;
import android.media.NotProvisionedException;
import android.media.metrics.LogSessionId;
import android.media.metrics.MediaMetricsManager;
import android.media.metrics.NetworkEvent;
import android.media.metrics.PlaybackErrorEvent;
import android.media.metrics.PlaybackMetrics;
import android.media.metrics.PlaybackSession;
import android.media.metrics.PlaybackStateEvent;
import android.media.metrics.TrackChangeEvent;
import android.net.Uri;
import android.os.SystemClock;
import android.system.ErrnoException;
import android.system.OsConstants;
import android.util.Pair;
import android.util.SparseArray;
import androidx.media3.common.ParserException;
import androidx.media3.common.PlaybackException;
import androidx.media3.datasource.FileDataSource$FileDataSourceException;
import androidx.media3.datasource.HttpDataSource$HttpDataSourceException;
import androidx.media3.datasource.HttpDataSource$InvalidContentTypeException;
import androidx.media3.datasource.HttpDataSource$InvalidResponseCodeException;
import androidx.media3.datasource.UdpDataSource$UdpDataSourceException;
import androidx.media3.exoplayer.ExoPlaybackException;
import androidx.media3.exoplayer.audio.AudioSink$InitializationException;
import androidx.media3.exoplayer.audio.AudioSink$WriteException;
import androidx.media3.exoplayer.drm.DefaultDrmSessionManager$MissingSchemeDataException;
import androidx.media3.exoplayer.drm.DrmSession$DrmSessionException;
import androidx.media3.exoplayer.drm.UnsupportedDrmException;
import androidx.media3.exoplayer.mediacodec.MediaCodecDecoderException;
import androidx.media3.exoplayer.mediacodec.MediaCodecRenderer$DecoderInitializationException;
import j$.util.Objects;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.SocketTimeoutException;
import java.net.UnknownHostException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.UUID;
import java.util.concurrent.Executor;

/* JADX INFO: renamed from: ᵫˌʿ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes3.dex */
public final class C3966 implements InterfaceC0161 {

    /* JADX INFO: renamed from: ˈᵲᵢ, reason: contains not printable characters */
    public boolean f15174;

    /* JADX INFO: renamed from: ˉᵲ, reason: contains not printable characters */
    public C5286 f15175;

    /* JADX INFO: renamed from: ˊᵙᵾᵲ, reason: contains not printable characters */
    public C1404 f15176;

    /* JADX INFO: renamed from: ˊᵨᵧ, reason: contains not printable characters */
    public C5286 f15177;

    /* JADX INFO: renamed from: ˌᴵ, reason: contains not printable characters */
    public boolean f15180;

    /* JADX INFO: renamed from: ˏːˆ, reason: contains not printable characters */
    public C5286 f15181;

    /* JADX INFO: renamed from: ːˏᵟᵯ, reason: contains not printable characters */
    public final C0179 f15182;

    /* JADX INFO: renamed from: ᵔᵖᵹᵫ, reason: contains not printable characters */
    public boolean f15183;

    /* JADX INFO: renamed from: ᵜᵪʾ, reason: contains not printable characters */
    public int f15184;

    /* JADX INFO: renamed from: ᵟᵹᵙ, reason: contains not printable characters */
    public C1404 f15186;

    /* JADX INFO: renamed from: ᵨᵼⁱ, reason: contains not printable characters */
    public int f15188;

    /* JADX INFO: renamed from: ᵪᵹᵥᵻ, reason: contains not printable characters */
    public PlaybackException f15189;

    /* JADX INFO: renamed from: ᵮᵣᵗˈ, reason: contains not printable characters */
    public int f15190;

    /* JADX INFO: renamed from: ᵯᵷʽ, reason: contains not printable characters */
    public int f15191;

    /* JADX INFO: renamed from: ᵱʡˏ, reason: contains not printable characters */
    public C1404 f15192;

    /* JADX INFO: renamed from: ᵱᵽʡᵚ, reason: contains not printable characters */
    public String f15193;

    /* JADX INFO: renamed from: ᵲᵶᵳˈ, reason: contains not printable characters */
    public final Context f15194;

    /* JADX INFO: renamed from: ᵶˇᵱ, reason: contains not printable characters */
    public int f15196;

    /* JADX INFO: renamed from: ᵶᵥᵝ, reason: contains not printable characters */
    public PlaybackMetrics.Builder f15197;

    /* JADX INFO: renamed from: ᵷᵺʾᵖ, reason: contains not printable characters */
    public final PlaybackSession f15198;

    /* JADX INFO: renamed from: ʽˈˋ, reason: contains not printable characters */
    public final Executor f15173 = ᵬʕˎʽ.ᵝᵶ();

    /* JADX INFO: renamed from: ᵻˈᵦʼ, reason: contains not printable characters */
    public final C5201 f15200 = new C5201();

    /* JADX INFO: renamed from: ᵵᵽ, reason: contains not printable characters */
    public final C4593 f15195 = new C4593();

    /* JADX INFO: renamed from: ᵻʽᵯ, reason: contains not printable characters */
    public final HashMap f15199 = new HashMap();

    /* JADX INFO: renamed from: ˊᵫᵗ, reason: contains not printable characters */
    public final HashMap f15178 = new HashMap();

    /* JADX INFO: renamed from: ᵨᵣ, reason: contains not printable characters */
    public final long f15187 = SystemClock.elapsedRealtime();

    /* JADX INFO: renamed from: ᵝᵶ, reason: contains not printable characters */
    public int f15185 = 0;

    /* JADX INFO: renamed from: ˋˈ, reason: contains not printable characters */
    public int f15179 = 0;

    public C3966(Context context, PlaybackSession playbackSession) {
        this.f15194 = context.getApplicationContext();
        this.f15198 = playbackSession;
        C0179 c0179 = new C0179();
        this.f15182 = c0179;
        c0179.f1614 = this;
    }

    /* JADX INFO: renamed from: ᵵᵽ, reason: contains not printable characters */
    public static C3966 m8707(Context context) {
        MediaMetricsManager mediaMetricsManager = (MediaMetricsManager) context.getSystemService("media_metrics");
        if (mediaMetricsManager == null) {
            return null;
        }
        return new C3966(context, mediaMetricsManager.createPlaybackSession());
    }

    /* JADX INFO: renamed from: ˊᵫᵗ, reason: contains not printable characters */
    public final void m8709() {
        PlaybackMetrics.Builder builder = this.f15197;
        if (builder != null && this.f15174) {
            builder.setAudioUnderrunCount(this.f15196);
            this.f15197.setVideoFramesDropped(this.f15188);
            this.f15197.setVideoFramesPlayed(this.f15191);
            Long l = (Long) this.f15178.get(this.f15193);
            this.f15197.setNetworkTransferDurationMillis(l == null ? 0L : l.longValue());
            Long l2 = (Long) this.f15199.get(this.f15193);
            this.f15197.setNetworkBytesRead(l2 == null ? 0L : l2.longValue());
            this.f15197.setStreamSource((l2 == null || l2.longValue() <= 0) ? 0 : 1);
            this.f15173.execute(new RunnableC2093(this, 3, this.f15197.build()));
        }
        this.f15197 = null;
        this.f15193 = null;
        this.f15196 = 0;
        this.f15188 = 0;
        this.f15191 = 0;
        this.f15175 = null;
        this.f15181 = null;
        this.f15177 = null;
        this.f15174 = false;
    }

    /* JADX INFO: renamed from: ˋˈ, reason: contains not printable characters */
    public final void m8710(int i, long j, C5286 c5286, int i2) {
        int i3;
        TrackChangeEvent.Builder timeSinceCreatedMillis = new TrackChangeEvent.Builder(i).setTimeSinceCreatedMillis(j - this.f15187);
        int i4 = 0;
        if (c5286 != null) {
            timeSinceCreatedMillis.setTrackState(1);
            if (i2 != 1) {
                i3 = 3;
                if (i2 != 2) {
                    i3 = i2 != 3 ? 1 : 4;
                }
            } else {
                i3 = 2;
            }
            timeSinceCreatedMillis.setTrackChangeReason(i3);
            String str = c5286.f19972;
            if (str != null) {
                timeSinceCreatedMillis.setContainerMimeType(str);
            }
            String str2 = c5286.f19987;
            if (str2 != null) {
                timeSinceCreatedMillis.setSampleMimeType(str2);
            }
            String str3 = c5286.f19996;
            if (str3 != null) {
                timeSinceCreatedMillis.setCodecName(str3);
            }
            int i5 = c5286.f19991;
            if (i5 != -1) {
                timeSinceCreatedMillis.setBitrate(i5);
            }
            int i6 = c5286.f19973;
            if (i6 != -1) {
                timeSinceCreatedMillis.setWidth(i6);
            }
            int i7 = c5286.f19981;
            if (i7 != -1) {
                timeSinceCreatedMillis.setHeight(i7);
            }
            int i8 = c5286.f19984;
            if (i8 != -1) {
                timeSinceCreatedMillis.setChannelCount(i8);
            }
            int i9 = c5286.f19966;
            if (i9 != -1) {
                timeSinceCreatedMillis.setAudioSampleRate(i9);
            }
            String str4 = c5286.f19997;
            if (str4 != null) {
                String str5 = AbstractC0956.f4222;
                String[] strArrSplit = str4.split("-", -1);
                Pair pairCreate = Pair.create(strArrSplit[0], strArrSplit.length >= 2 ? strArrSplit[1] : null);
                timeSinceCreatedMillis.setLanguage((String) pairCreate.first);
                Object obj = pairCreate.second;
                if (obj != null) {
                    timeSinceCreatedMillis.setLanguageRegion((String) obj);
                }
            }
            float f = c5286.f19989;
            if (f != -1.0f) {
                timeSinceCreatedMillis.setVideoFrameRate(f);
            }
        } else {
            timeSinceCreatedMillis.setTrackState(0);
        }
        this.f15174 = true;
        this.f15173.execute(new RunnableC2093(this, i4, timeSinceCreatedMillis.build()));
    }

    /* JADX INFO: renamed from: ᵝᵶ, reason: contains not printable characters */
    public final void m8711(C5515 c5515, String str) {
        C4100 c4100 = c5515.f20835;
        if ((c4100 == null || !c4100.m8958()) && str.equals(this.f15193)) {
            m8709();
        }
        this.f15178.remove(str);
        this.f15199.remove(str);
    }

    /* JADX INFO: renamed from: ᵮᵣᵗˈ, reason: contains not printable characters */
    public final void m8712(C5515 c5515, String str) {
        C4100 c4100 = c5515.f20835;
        if (c4100 == null || !c4100.m8958()) {
            m8709();
            this.f15193 = str;
            this.f15197 = new PlaybackMetrics.Builder().setPlayerName("AndroidXMedia3").setPlayerVersion("1.10.1");
            m8713(c5515.f20828, c4100);
        }
    }

    /* JADX INFO: renamed from: ᵱᵽʡᵚ, reason: contains not printable characters */
    public final void m8713(AbstractC4975 abstractC4975, C4100 c4100) {
        PlaybackMetrics.Builder builder = this.f15197;
        if (c4100 == null) {
            return;
        }
        int iMo1663 = abstractC4975.mo1663(c4100.f15713);
        if (iMo1663 == -1) {
            return;
        }
        C4593 c4593 = this.f15195;
        int iM3263 = 0;
        abstractC4975.mo1666(iMo1663, c4593, false);
        int i = c4593.f17476;
        C5201 c5201 = this.f15200;
        abstractC4975.m10284(i, c5201);
        C4574 c4574 = c5201.f19589.f18446;
        if (c4574 != null) {
            Uri uri = c4574.f17386;
            String str = c4574.f17383;
            if (str != null) {
                switch (str) {
                    case "application/x-mpegURL":
                        iM3263 = 2;
                        break;
                    case "application/vnd.ms-sstr+xml":
                        iM3263 = 1;
                        break;
                    case "application/dash+xml":
                        break;
                    case "application/x-rtsp":
                        iM3263 = 3;
                        break;
                    default:
                        iM3263 = 4;
                        break;
                }
            } else {
                iM3263 = AbstractC0956.m3263(uri);
            }
            iM3263 = iM3263 != 0 ? iM3263 != 1 ? iM3263 != 2 ? 1 : 4 : 5 : 3;
        }
        builder.setStreamType(iM3263);
        if (c5201.f19596 != -9223372036854775807L && !c5201.f19597 && !c5201.f19590 && !c5201.m10743()) {
            builder.setMediaDurationMillis(AbstractC0956.m3264(c5201.f19596));
        }
        builder.setPlaybackType(c5201.m10743() ? 2 : 1);
        this.f15174 = true;
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Removed duplicated region for block: B:225:0x0411  */
    /* JADX WARN: Removed duplicated region for block: B:338:0x0588 A[PHI: r4
      0x0588: PHI (r4v84 int) = (r4v83 int), (r4v82 int) binds: [B:347:0x059d, B:337:0x0586] A[DONT_GENERATE, DONT_INLINE]] */
    /* JADX WARN: Removed duplicated region for block: B:357:0x05b0  */
    /* JADX WARN: Removed duplicated region for block: B:360:0x05dc  */
    /* JADX WARN: Removed duplicated region for block: B:385:? A[RETURN, SYNTHETIC] */
    /* JADX INFO: renamed from: ᵶᵥᵝ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final void m8714(InterfaceC4650 interfaceC4650, ˊˊᵞᵽ r24) {
        int i;
        boolean z;
        int i2;
        int i3;
        int i4;
        int i5;
        int i6;
        int i7;
        C4240 c4240;
        C4240 c42402;
        int i8;
        int i9;
        int i10;
        int i11;
        int i12;
        int i13;
        int i14;
        C1404 c1404;
        int i15;
        int i16;
        boolean z2;
        C5286 c5286;
        C5576 c5576;
        int i17;
        if (((C0719) r24.ᵜᵪʾ).f3271.size() == 0) {
            return;
        }
        for (int i18 = 0; i18 < ((C0719) r24.ᵜᵪʾ).f3271.size(); i18++) {
            int iM2576 = ((C0719) r24.ᵜᵪʾ).m2576(i18);
            C5515 c5515 = (C5515) ((SparseArray) r24.ᵔᵖᵹᵫ).get(iM2576);
            c5515.getClass();
            C0179 c0179 = this.f15182;
            if (iM2576 == 0) {
                synchronized (c0179) {
                    try {
                        c0179.f1614.getClass();
                        AbstractC4975 abstractC4975 = c0179.f1611;
                        c0179.f1611 = c5515.f20828;
                        Iterator it = c0179.f1610.values().iterator();
                        while (it.hasNext()) {
                            C5410 c5410 = (C5410) it.next();
                            if (!c5410.m11024(abstractC4975, c0179.f1611) || c5410.m11025(c5515)) {
                                it.remove();
                                if (c5410.f20516.equals(c0179.f1615)) {
                                    c0179.m1327(c5410);
                                }
                                if (c5410.f20515) {
                                    c0179.f1614.m8711(c5515, c5410.f20516);
                                }
                            }
                        }
                        c0179.m1326(c5515);
                    } catch (Throwable th) {
                        throw th;
                    }
                }
            } else if (iM2576 == 11) {
                c0179.m1328(c5515, this.f15190);
            } else {
                c0179.m1330(c5515);
            }
        }
        long jElapsedRealtime = SystemClock.elapsedRealtime();
        if (r24.ᵵᵽ(0)) {
            C5515 c55152 = (C5515) ((SparseArray) r24.ᵔᵖᵹᵫ).get(0);
            c55152.getClass();
            if (this.f15197 != null) {
                m8713(c55152.f20828, c55152.f20835);
            }
        }
        if (r24.ᵵᵽ(2) && this.f15197 != null) {
            C2822 c2822ListIterator = ((C3262) interfaceC4650).m7472().f11784.listIterator(0);
            loop2: while (true) {
                if (!c2822ListIterator.hasNext()) {
                    c5576 = null;
                    break;
                }
                C3917 c3917 = (C3917) c2822ListIterator.next();
                for (int i19 = 0; i19 < c3917.f14955; i19++) {
                    if (c3917.f14954[i19] && (c5576 = c3917.f14952.f7463[i19].f19965) != null) {
                        break loop2;
                    }
                }
            }
            if (c5576 != null) {
                PlaybackMetrics.Builder builder = this.f15197;
                int i20 = 0;
                while (true) {
                    if (i20 >= c5576.f21033) {
                        i17 = 1;
                        break;
                    }
                    UUID uuid = c5576.f21030[i20].f16666;
                    if (uuid.equals(AbstractC3361.f12881)) {
                        i17 = 3;
                        break;
                    } else if (uuid.equals(AbstractC3361.f12879)) {
                        i17 = 2;
                        break;
                    } else {
                        if (uuid.equals(AbstractC3361.f12878)) {
                            i17 = 6;
                            break;
                        }
                        i20++;
                    }
                }
                builder.setDrmType(i17);
            }
        }
        if (r24.ᵵᵽ(1011)) {
            this.f15196++;
        }
        PlaybackException playbackException = this.f15189;
        if (playbackException == null) {
            i5 = 4;
            i13 = 1;
            i7 = 13;
            i2 = 6;
            i3 = 8;
            i4 = 7;
            i6 = 9;
        } else {
            int i21 = playbackException.f554;
            Context context = this.f15194;
            boolean z3 = this.f15184 == 4;
            if (i21 == 1001) {
                c4240 = new C4240(20, 0, 2);
            } else {
                if (playbackException instanceof ExoPlaybackException) {
                    ExoPlaybackException exoPlaybackException = (ExoPlaybackException) playbackException;
                    z = exoPlaybackException.f608 == 1;
                    i = exoPlaybackException.f606;
                } else {
                    i = 0;
                    z = false;
                }
                Throwable cause = playbackException.getCause();
                cause.getClass();
                if (!(cause instanceof IOException)) {
                    int i22 = 28;
                    i2 = 6;
                    i3 = 8;
                    i4 = 7;
                    i5 = 4;
                    i6 = 9;
                    if (z && (i == 0 || i == 1)) {
                        c4240 = new C4240(35, 0, 2);
                    } else if (z && i == 3) {
                        c4240 = new C4240(15, 0, 2);
                    } else if (z && i == 2) {
                        c4240 = new C4240(23, 0, 2);
                    } else {
                        if (cause instanceof MediaCodecRenderer$DecoderInitializationException) {
                            i7 = 13;
                            c42402 = new C4240(13, AbstractC0956.m3234(((MediaCodecRenderer$DecoderInitializationException) cause).f651), 2);
                        } else {
                            i7 = 13;
                            if (cause instanceof MediaCodecDecoderException) {
                                c4240 = new C4240(14, ((MediaCodecDecoderException) cause).f647, 2);
                            } else if (cause instanceof OutOfMemoryError) {
                                c4240 = new C4240(14, 0, 2);
                            } else if (cause instanceof AudioSink$InitializationException) {
                                c4240 = new C4240(17, 0, 2);
                            } else if (cause instanceof AudioSink$WriteException) {
                                c42402 = new C4240(18, ((AudioSink$WriteException) cause).f618, 2);
                            } else if (cause instanceof MediaCodec.CryptoException) {
                                int errorCode = ((MediaCodec.CryptoException) cause).getErrorCode();
                                switch (AbstractC0956.m3219(errorCode)) {
                                    case 6002:
                                        i22 = 24;
                                        break;
                                    case 6003:
                                        break;
                                    case 6004:
                                        i22 = 25;
                                        break;
                                    case 6005:
                                        i22 = 26;
                                        break;
                                    default:
                                        i22 = 27;
                                        break;
                                }
                                c42402 = new C4240(i22, errorCode, 2);
                            } else {
                                c4240 = new C4240(22, 0, 2);
                            }
                            this.f15173.execute(new RunnableC2093(this, new PlaybackErrorEvent.Builder().setTimeSinceCreatedMillis(jElapsedRealtime - this.f15187).setErrorCode(c4240.f16172).setSubErrorCode(c4240.f16171).setException(playbackException).build()));
                            i13 = 1;
                            this.f15174 = true;
                            this.f15189 = null;
                        }
                        c4240 = c42402;
                        this.f15173.execute(new RunnableC2093(this, new PlaybackErrorEvent.Builder().setTimeSinceCreatedMillis(jElapsedRealtime - this.f15187).setErrorCode(c4240.f16172).setSubErrorCode(c4240.f16171).setException(playbackException).build()));
                        i13 = 1;
                        this.f15174 = true;
                        this.f15189 = null;
                    }
                    i7 = 13;
                    this.f15173.execute(new RunnableC2093(this, new PlaybackErrorEvent.Builder().setTimeSinceCreatedMillis(jElapsedRealtime - this.f15187).setErrorCode(c4240.f16172).setSubErrorCode(c4240.f16171).setException(playbackException).build()));
                    i13 = 1;
                    this.f15174 = true;
                    this.f15189 = null;
                } else if (cause instanceof HttpDataSource$InvalidResponseCodeException) {
                    c4240 = new C4240(5, ((HttpDataSource$InvalidResponseCodeException) cause).f560, 2);
                } else {
                    if ((cause instanceof HttpDataSource$InvalidContentTypeException) || (cause instanceof ParserException)) {
                        i8 = 9;
                        i9 = 7;
                        i10 = 4;
                        i11 = 8;
                        i2 = 6;
                        c4240 = new C4240(z3 ? 10 : 11, 0, 2);
                    } else {
                        boolean z4 = cause instanceof HttpDataSource$HttpDataSourceException;
                        if (z4 || (cause instanceof UdpDataSource$UdpDataSourceException)) {
                            i8 = 9;
                            if (C1858.m5051(context).m5052() == 1) {
                                c4240 = new C4240(3, 0, 2);
                            } else {
                                Throwable cause2 = cause.getCause();
                                if (cause2 instanceof UnknownHostException) {
                                    i2 = 6;
                                    c4240 = new C4240(6, 0, 2);
                                    i6 = 9;
                                    i7 = 13;
                                    i3 = 8;
                                    i4 = 7;
                                    i5 = 4;
                                    this.f15173.execute(new RunnableC2093(this, new PlaybackErrorEvent.Builder().setTimeSinceCreatedMillis(jElapsedRealtime - this.f15187).setErrorCode(c4240.f16172).setSubErrorCode(c4240.f16171).setException(playbackException).build()));
                                    i13 = 1;
                                    this.f15174 = true;
                                    this.f15189 = null;
                                } else {
                                    i2 = 6;
                                    if (cause2 instanceof SocketTimeoutException) {
                                        c4240 = new C4240(7, 0, 2);
                                        i6 = 9;
                                        i4 = 7;
                                        i7 = 13;
                                        i3 = 8;
                                        i5 = 4;
                                        this.f15173.execute(new RunnableC2093(this, new PlaybackErrorEvent.Builder().setTimeSinceCreatedMillis(jElapsedRealtime - this.f15187).setErrorCode(c4240.f16172).setSubErrorCode(c4240.f16171).setException(playbackException).build()));
                                        i13 = 1;
                                        this.f15174 = true;
                                        this.f15189 = null;
                                    } else {
                                        i9 = 7;
                                        if (z4 && ((HttpDataSource$HttpDataSourceException) cause).f559 == 1) {
                                            c4240 = new C4240(4, 0, 2);
                                            i6 = 9;
                                            i4 = 7;
                                            i5 = 4;
                                            i7 = 13;
                                            i3 = 8;
                                            this.f15173.execute(new RunnableC2093(this, new PlaybackErrorEvent.Builder().setTimeSinceCreatedMillis(jElapsedRealtime - this.f15187).setErrorCode(c4240.f16172).setSubErrorCode(c4240.f16171).setException(playbackException).build()));
                                            i13 = 1;
                                            this.f15174 = true;
                                            this.f15189 = null;
                                        } else {
                                            i10 = 4;
                                            i11 = 8;
                                            c4240 = new C4240(8, 0, 2);
                                        }
                                    }
                                }
                            }
                        } else if (i21 == 1002) {
                            c4240 = new C4240(21, 0, 2);
                        } else if (cause instanceof DrmSession$DrmSessionException) {
                            Throwable cause3 = cause.getCause();
                            cause3.getClass();
                            if (cause3 instanceof MediaDrm.MediaDrmStateException) {
                                int iM3234 = AbstractC0956.m3234(((MediaDrm.MediaDrmStateException) cause3).getDiagnosticInfo());
                                switch (AbstractC0956.m3219(iM3234)) {
                                    case 6002:
                                        i12 = 24;
                                        break;
                                    case 6003:
                                        i12 = 28;
                                        break;
                                    case 6004:
                                        i12 = 25;
                                        break;
                                    case 6005:
                                        i12 = 26;
                                        break;
                                    default:
                                        i12 = 27;
                                        break;
                                }
                                c4240 = new C4240(i12, iM3234, 2);
                            } else {
                                c4240 = cause3 instanceof MediaDrmResetException ? new C4240(27, 0, 2) : cause3 instanceof NotProvisionedException ? new C4240(24, 0, 2) : cause3 instanceof DeniedByServerException ? new C4240(29, 0, 2) : cause3 instanceof UnsupportedDrmException ? new C4240(23, 0, 2) : cause3 instanceof DefaultDrmSessionManager$MissingSchemeDataException ? new C4240(28, 0, 2) : new C4240(30, 0, 2);
                            }
                        } else if ((cause instanceof FileDataSource$FileDataSourceException) && (cause.getCause() instanceof FileNotFoundException)) {
                            Throwable cause4 = cause.getCause();
                            cause4.getClass();
                            Throwable cause5 = cause4.getCause();
                            c4240 = ((cause5 instanceof ErrnoException) && ((ErrnoException) cause5).errno == OsConstants.EACCES) ? new C4240(32, 0, 2) : new C4240(31, 0, 2);
                        } else {
                            i8 = 9;
                            c4240 = new C4240(9, 0, 2);
                        }
                        i6 = i8;
                        i7 = 13;
                        i2 = 6;
                        i3 = 8;
                        i4 = 7;
                        i5 = 4;
                        this.f15173.execute(new RunnableC2093(this, new PlaybackErrorEvent.Builder().setTimeSinceCreatedMillis(jElapsedRealtime - this.f15187).setErrorCode(c4240.f16172).setSubErrorCode(c4240.f16171).setException(playbackException).build()));
                        i13 = 1;
                        this.f15174 = true;
                        this.f15189 = null;
                    }
                    i6 = i8;
                    i4 = i9;
                    i5 = i10;
                    i3 = i11;
                    i7 = 13;
                    this.f15173.execute(new RunnableC2093(this, new PlaybackErrorEvent.Builder().setTimeSinceCreatedMillis(jElapsedRealtime - this.f15187).setErrorCode(c4240.f16172).setSubErrorCode(c4240.f16171).setException(playbackException).build()));
                    i13 = 1;
                    this.f15174 = true;
                    this.f15189 = null;
                }
            }
            i7 = 13;
            i2 = 6;
            i3 = 8;
            i4 = 7;
            i5 = 4;
            i6 = 9;
            this.f15173.execute(new RunnableC2093(this, new PlaybackErrorEvent.Builder().setTimeSinceCreatedMillis(jElapsedRealtime - this.f15187).setErrorCode(c4240.f16172).setSubErrorCode(c4240.f16171).setException(playbackException).build()));
            i13 = 1;
            this.f15174 = true;
            this.f15189 = null;
        }
        if (r24.ᵵᵽ(2)) {
            C3090 c3090M7472 = ((C3262) interfaceC4650).m7472();
            boolean zM7177 = c3090M7472.m7177(2);
            boolean zM71772 = c3090M7472.m7177(i13);
            boolean zM71773 = c3090M7472.m7177(3);
            if (zM7177 || zM71772 || zM71773) {
                if (zM7177) {
                    i14 = i5;
                    c5286 = null;
                } else {
                    c5286 = null;
                    if (Objects.equals(this.f15175, null)) {
                        i14 = i5;
                    } else {
                        int i23 = this.f15175 == null ? 1 : 0;
                        this.f15175 = null;
                        i14 = i5;
                        m8710(1, jElapsedRealtime, null, i23);
                    }
                }
                if (!zM71772 && !Objects.equals(this.f15181, c5286)) {
                    int i24 = this.f15181 == null ? 1 : 0;
                    this.f15181 = c5286;
                    m8710(0, jElapsedRealtime, c5286, i24);
                }
                if (!zM71773 && !Objects.equals(this.f15177, c5286)) {
                    int i25 = this.f15177 == null ? 1 : 0;
                    this.f15177 = c5286;
                    m8710(2, jElapsedRealtime, c5286, i25);
                }
                c1404 = c5286;
            } else {
                i14 = i5;
                c1404 = 0;
            }
        }
        if (m8716(this.f15186)) {
            C1404 c14042 = this.f15186;
            C5286 c52862 = (C5286) c14042.f5807;
            if (c52862.f19981 != -1) {
                int i26 = c14042.f5808;
                if (!Objects.equals(this.f15175, c52862)) {
                    int i27 = (this.f15175 == null && i26 == 0) ? 1 : i26;
                    this.f15175 = c52862;
                    m8710(1, jElapsedRealtime, c52862, i27);
                }
                this.f15186 = c1404;
            }
        }
        if (m8716(this.f15192)) {
            C1404 c14043 = this.f15192;
            C5286 c52863 = (C5286) c14043.f5807;
            int i28 = c14043.f5808;
            if (!Objects.equals(this.f15181, c52863)) {
                int i29 = (this.f15181 == null && i28 == 0) ? 1 : i28;
                this.f15181 = c52863;
                m8710(0, jElapsedRealtime, c52863, i29);
            }
            this.f15192 = c1404;
        }
        if (m8716(this.f15176)) {
            C1404 c14044 = this.f15176;
            C5286 c52864 = (C5286) c14044.f5807;
            int i30 = c14044.f5808;
            if (!Objects.equals(this.f15177, c52864)) {
                int i31 = (this.f15177 == null && i30 == 0) ? 1 : i30;
                this.f15177 = c52864;
                m8710(2, jElapsedRealtime, c52864, i31);
            }
            this.f15176 = c1404;
        }
        switch (C1858.m5051(this.f15194).m5052()) {
            case 0:
                i15 = 0;
                break;
            case 1:
                i15 = i6;
                break;
            case 2:
                i15 = 2;
                break;
            case 3:
                i15 = i14;
                break;
            case 4:
                i15 = 5;
                break;
            case 5:
                i15 = i2;
                break;
            case C5224.STRING_SET_FIELD_NUMBER /* 6 */:
            case C5224.BYTES_FIELD_NUMBER /* 8 */:
            default:
                i15 = 1;
                break;
            case C5224.DOUBLE_FIELD_NUMBER /* 7 */:
                i15 = 3;
                break;
            case 9:
                i15 = i3;
                break;
            case 10:
                i15 = i4;
                break;
        }
        if (i15 != this.f15179) {
            this.f15179 = i15;
            this.f15173.execute(new RunnableC2093(this, new NetworkEvent.Builder().setNetworkType(i15).setTimeSinceCreatedMillis(jElapsedRealtime - this.f15187).build()));
        }
        C3262 c3262 = (C3262) interfaceC4650;
        if (c3262.m7460() != 2) {
            this.f15180 = false;
        }
        c3262.m7468();
        if (c3262.f12467.f16088 == null) {
            this.f15183 = false;
            i16 = 10;
        } else {
            i16 = 10;
            if (r24.ᵵᵽ(10)) {
                this.f15183 = true;
            }
        }
        int iM7460 = c3262.m7460();
        if (!this.f15180) {
            if (!this.f15183) {
                if (iM7460 == i14) {
                    i7 = 11;
                } else {
                    i7 = 12;
                    if (iM7460 == 2) {
                        int i32 = this.f15185;
                        i7 = (i32 == 0 || i32 == 2 || i32 == 12) ? 2 : !c3262.m7448() ? i4 : c3262.m7453() != 0 ? i16 : i2;
                    } else {
                        i16 = 3;
                        if (iM7460 != 3) {
                            z2 = true;
                            if (iM7460 != 1 || this.f15185 == 0) {
                                i7 = this.f15185;
                            }
                        } else if (!c3262.m7448()) {
                            i7 = i14;
                        } else if (c3262.m7453() != 0) {
                            i7 = i6;
                        }
                    }
                }
            }
            if (this.f15185 != i7) {
                this.f15185 = i7;
                this.f15174 = z2;
                this.f15173.execute(new RunnableC2093(this, i14, new PlaybackStateEvent.Builder().setState(this.f15185).setTimeSinceCreatedMillis(jElapsedRealtime - this.f15187).build()));
            }
            if (r24.ᵵᵽ(1028)) {
                return;
            }
            C0179 c01792 = this.f15182;
            C5515 c55153 = (C5515) ((SparseArray) r24.ᵔᵖᵹᵫ).get(1028);
            c55153.getClass();
            c01792.m1324(c55153);
            return;
        }
        i7 = 5;
        z2 = true;
        if (this.f15185 != i7) {
        }
        if (r24.ᵵᵽ(1028)) {
        }
    }

    /* JADX INFO: renamed from: ᵻʽᵯ, reason: contains not printable characters */
    public final LogSessionId m8715() {
        return this.f15198.getSessionId();
    }

    /* JADX INFO: renamed from: ᵻˈᵦʼ, reason: contains not printable characters */
    public final boolean m8716(C1404 c1404) {
        String str;
        if (c1404 == null) {
            return false;
        }
        String str2 = (String) c1404.f5809;
        C0179 c0179 = this.f15182;
        synchronized (c0179) {
            str = c0179.f1615;
        }
        return str2.equals(str);
    }
}
