package p138.p176.p177.p190.p217.p220;

import android.os.Handler;
import android.os.Message;
import com.google.android.exoplayer2.ParserException;
import com.google.android.exoplayer2.source.dash.DashMediaSource;
import java.util.TreeMap;
import p138.p176.p177.p190.C3431;
import p138.p176.p177.p190.C3433;
import p138.p176.p177.p190.p193.C3511;
import p138.p176.p177.p190.p194.C3531;
import p138.p176.p177.p190.p198.C3558;
import p138.p176.p177.p190.p198.InterfaceC3575;
import p138.p176.p177.p190.p210.C3717;
import p138.p176.p177.p190.p210.p211.C3720;
import p138.p176.p177.p190.p210.p211.C3722;
import p138.p176.p177.p190.p217.C3820;
import p138.p176.p177.p190.p217.p220.p221.C3870;
import p138.p176.p177.p190.p238.InterfaceC4089;
import p138.p176.p177.p190.p239.C4140;
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 C3865 implements Handler.Callback {

    /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
    public final InterfaceC4089 f11941;

    /* JADX INFO: renamed from: ބ, reason: contains not printable characters */
    public final InterfaceC3867 f11942;

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

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

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

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

    /* JADX INFO: renamed from: އ, reason: contains not printable characters */
    public final TreeMap<Long, Long> f11945 = new TreeMap<>();

    /* JADX INFO: renamed from: ކ, reason: contains not printable characters */
    public final Handler f11944 = C4150.m6753((Handler.Callback) this);

    /* JADX INFO: renamed from: ޅ, reason: contains not printable characters */
    public final C3722 f11943 = new C3722();

    /* JADX INFO: renamed from: ފ, reason: contains not printable characters */
    public long f11948 = -9223372036854775807L;

    /* JADX INFO: renamed from: ދ, reason: contains not printable characters */
    public long f11949 = -9223372036854775807L;

    /* JADX INFO: renamed from: ދ.ހ.֏.ؠ.ໞ.ޞ.ކ$֏, reason: contains not printable characters */
    public static final class C3866 {

        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public final long f11952;

        /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
        public final long f11953;

        public C3866(long j, long j2) {
            this.f11952 = j;
            this.f11953 = j2;
        }
    }

    /* JADX INFO: renamed from: ދ.ހ.֏.ؠ.ໞ.ޞ.ކ$ؠ, reason: contains not printable characters */
    public interface InterfaceC3867 {
    }

    /* JADX INFO: renamed from: ދ.ހ.֏.ؠ.ໞ.ޞ.ކ$ހ, reason: contains not printable characters */
    public final class C3868 implements InterfaceC3575 {

        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public final C3820 f11954;

        /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
        public final C3433 f11955 = new C3433();

        /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
        public final C3717 f11956 = new C3717();

        public C3868(InterfaceC4089 interfaceC4089) {
            this.f11954 = new C3820(interfaceC4089, C3531.m5830());
        }

        @Override // p138.p176.p177.p190.p198.InterfaceC3575
        /* JADX INFO: renamed from: ֏ */
        public int mo5882(C3558 c3558, int i, boolean z) {
            return this.f11954.mo5882(c3558, i, z);
        }

        @Override // p138.p176.p177.p190.p198.InterfaceC3575
        /* JADX INFO: renamed from: ֏ */
        public void mo5883(long j, int i, int i2, int i3, InterfaceC3575.C3576 c3576) {
            C3717 c3717;
            long jM6805;
            this.f11954.mo5883(j, i, i2, i3, c3576);
            while (true) {
                boolean z = false;
                if (!this.f11954.m6180(false)) {
                    C3820 c3820 = this.f11954;
                    c3820.f11736.m6164(c3820.m6187());
                    return;
                }
                this.f11956.mo5803();
                if (this.f11954.m6173(this.f11955, (C3511) this.f11956, false, false, 0L) == -4) {
                    this.f11956.m5812();
                    c3717 = this.f11956;
                } else {
                    c3717 = null;
                }
                if (c3717 != null) {
                    long j2 = c3717.f10463;
                    C3720 c3720 = (C3720) C3865.this.f11943.mo6059(c3717).f11440[0];
                    String str = c3720.f11456;
                    String str2 = c3720.f11457;
                    if ("urn:mpeg:dash:event:2012".equals(str) && ("1".equals(str2) || "2".equals(str2) || "3".equals(str2))) {
                        z = true;
                    }
                    if (z) {
                        try {
                            jM6805 = C4150.m6805(C4150.m6760(c3720.f11460));
                        } catch (ParserException unused) {
                            jM6805 = -9223372036854775807L;
                        }
                        if (jM6805 != -9223372036854775807L) {
                            C3866 c3866 = new C3866(j2, jM6805);
                            Handler handler = C3865.this.f11944;
                            handler.sendMessage(handler.obtainMessage(1, c3866));
                        }
                    }
                }
            }
        }

        @Override // p138.p176.p177.p190.p198.InterfaceC3575
        /* JADX INFO: renamed from: ֏ */
        public void mo5884(C3431 c3431) {
            this.f11954.mo5884(c3431);
        }

        @Override // p138.p176.p177.p190.p198.InterfaceC3575
        /* JADX INFO: renamed from: ֏ */
        public void mo5885(C4140 c4140, int i) {
            this.f11954.mo5885(c4140, i);
        }
    }

    public C3865(C3870 c3870, InterfaceC3867 interfaceC3867, InterfaceC4089 interfaceC4089) {
        this.f11946 = c3870;
        this.f11942 = interfaceC3867;
        this.f11941 = interfaceC4089;
    }

    @Override // android.os.Handler.Callback
    public boolean handleMessage(Message message) {
        if (this.f11951) {
            return true;
        }
        if (message.what != 1) {
            return false;
        }
        C3866 c3866 = (C3866) message.obj;
        long j = c3866.f11952;
        long j2 = c3866.f11953;
        Long l = this.f11945.get(Long.valueOf(j2));
        if (l == null || l.longValue() > j) {
            this.f11945.put(Long.valueOf(j2), Long.valueOf(j));
        }
        return true;
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final void m6261() {
        long j = this.f11949;
        if (j == -9223372036854775807L || j != this.f11948) {
            this.f11950 = true;
            this.f11949 = this.f11948;
            DashMediaSource dashMediaSource = DashMediaSource.this;
            dashMediaSource.f1771.removeCallbacks(dashMediaSource.f1763);
            dashMediaSource.m1220();
        }
    }
}
