Recover Files v1.3.9版本的 MD5 值为:27a8b2c239c6cb7111d74d6bb07d21b2

以下内容为反编译后的 aw.java 源代码,内容仅作参考


package com.applovin.exoplayer2;

import android.content.Context;
import android.graphics.Rect;
import android.graphics.SurfaceTexture;
import android.media.AudioTrack;
import android.media.MediaFormat;
import android.os.Handler;
import android.os.Looper;
import android.view.Surface;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.TextureView;
import androidx.annotation.Nullable;
import com.applovin.exoplayer2.an;
import com.applovin.exoplayer2.ao;
import com.applovin.exoplayer2.ay;
import com.applovin.exoplayer2.b;
import com.applovin.exoplayer2.c;
import com.applovin.exoplayer2.k;
import com.applovin.exoplayer2.m.a.i;
import com.applovin.exoplayer2.q;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.CopyOnWriteArraySet;
import java.util.concurrent.TimeoutException;

public class aw extends d implements q {
    private int A;
    private int B;

    @Nullable
    private com.applovin.exoplayer2.c.e C;

    @Nullable
    private com.applovin.exoplayer2.c.e D;
    private int E;
    private com.applovin.exoplayer2.b.d F;
    private float G;
    private boolean H;
    private List<com.applovin.exoplayer2.i.a> I;
    private boolean J;
    private boolean K;

    @Nullable
    private com.applovin.exoplayer2.l.aa L;
    private boolean M;
    private boolean N;
    private o O;
    private com.applovin.exoplayer2.m.o P;

    protected final ar[] f4718b;

    private final com.applovin.exoplayer2.l.g f4719c;

    private final Context f4720d;

    private final r f4721e;

    private final b f4722f;

    private final c f4723g;

    private final CopyOnWriteArraySet<an.d> f4724h;

    private final com.applovin.exoplayer2.a.a f4725i;

    private final com.applovin.exoplayer2.b f4726j;

    private final com.applovin.exoplayer2.c f4727k;

    private final ay f4728l;

    private final bb f4729m;

    private final bc f4730n;

    private final long f4731o;

    @Nullable
    private v f4732p;

    @Nullable
    private v f4733q;

    @Nullable
    private AudioTrack f4734r;

    @Nullable
    private Object f4735s;

    @Nullable
    private Surface f4736t;

    @Nullable
    private SurfaceHolder f4737u;

    @Nullable
    private com.applovin.exoplayer2.m.a.i f4738v;

    private boolean f4739w;

    @Nullable
    private TextureView f4740x;

    private int f4741y;

    private int f4742z;

    @Deprecated
    public static final class a {
        private boolean A;

        private final Context f4743a;

        private final au f4744b;

        private com.applovin.exoplayer2.l.d f4745c;

        private long f4746d;

        private com.applovin.exoplayer2.j.j f4747e;

        private com.applovin.exoplayer2.h.r f4748f;

        private aa f4749g;

        private com.applovin.exoplayer2.k.d f4750h;

        private com.applovin.exoplayer2.a.a f4751i;

        private Looper f4752j;

        @Nullable
        private com.applovin.exoplayer2.l.aa f4753k;

        private com.applovin.exoplayer2.b.d f4754l;

        private boolean f4755m;

        private int f4756n;

        private boolean f4757o;

        private boolean f4758p;

        private int f4759q;

        private int f4760r;

        private boolean f4761s;

        private av f4762t;

        private long f4763u;

        private long f4764v;

        private z f4765w;

        private long f4766x;

        private long f4767y;

        private boolean f4768z;

        @Deprecated
        public a(Context context) {
            this(context, new n(context), new com.applovin.exoplayer2.e.f());
        }

        @Deprecated
        public a(Context context, au auVar, com.applovin.exoplayer2.e.l lVar) {
            this(context, auVar, new com.applovin.exoplayer2.j.c(context), new com.applovin.exoplayer2.h.f(context, lVar), new l(), com.applovin.exoplayer2.k.n.a(context), new com.applovin.exoplayer2.a.a(com.applovin.exoplayer2.l.d.f8004a));
        }

        @Deprecated
        public aw a() {
            com.applovin.exoplayer2.l.a.b(!this.A);
            this.A = true;
            return new aw(this);
        }

        @Deprecated
        public a(Context context, au auVar, com.applovin.exoplayer2.j.j jVar, com.applovin.exoplayer2.h.r rVar, aa aaVar, com.applovin.exoplayer2.k.d dVar, com.applovin.exoplayer2.a.a aVar) {
            this.f4743a = context;
            this.f4744b = auVar;
            this.f4747e = jVar;
            this.f4748f = rVar;
            this.f4749g = aaVar;
            this.f4750h = dVar;
            this.f4751i = aVar;
            this.f4752j = com.applovin.exoplayer2.l.ai.c();
            this.f4754l = com.applovin.exoplayer2.b.d.f4818a;
            this.f4756n = 0;
            this.f4759q = 1;
            this.f4760r = 0;
            this.f4761s = true;
            this.f4762t = av.f4715e;
            this.f4763u = 5000L;
            this.f4764v = 15000L;
            this.f4765w = new k.a().a();
            this.f4745c = com.applovin.exoplayer2.l.d.f8004a;
            this.f4766x = 500L;
            this.f4767y = 2000L;
        }
    }

    public final class b implements SurfaceHolder.Callback, TextureView.SurfaceTextureListener, an.b, ay.a, b.InterfaceC0055b, com.applovin.exoplayer2.b.g, c.b, com.applovin.exoplayer2.g.e, com.applovin.exoplayer2.i.l, i.a, com.applovin.exoplayer2.m.n, q.a {
        private b() {
        }

        @Override
        public void a(ab abVar, int i10) {
            k0.a(this, abVar, i10);
        }

        @Override
        public void a_(v vVar) {
            com.applovin.exoplayer2.m.s.j(this, vVar);
        }

        @Override
        public void b() {
            k0.k(this);
        }

        @Override
        public void b_(boolean z10) {
            if (aw.this.L != null) {
                if (z10 && !aw.this.M) {
                    aw.this.L.a(0);
                    aw.this.M = true;
                } else if (!z10 && aw.this.M) {
                    aw.this.L.b(0);
                    aw.this.M = false;
                }
            }
        }

        @Override
        public void c(int i10) {
            k0.p(this, i10);
        }

        @Override
        public void d(int i10) {
            k0.r(this, i10);
        }

        @Override
        public void e(int i10) {
            k0.t(this, i10);
        }

        @Override
        public void f(int i10) {
            o b10 = aw.b(aw.this.f4728l);
            if (!b10.equals(aw.this.O)) {
                aw.this.O = b10;
                Iterator it = aw.this.f4724h.iterator();
                while (it.hasNext()) {
                    ((an.d) it.next()).a(b10);
                }
            }
        }

        @Override
        public void onSurfaceTextureAvailable(SurfaceTexture surfaceTexture, int i10, int i11) {
            aw.this.a(surfaceTexture);
            aw.this.a(i10, i11);
        }

        @Override
        public boolean onSurfaceTextureDestroyed(SurfaceTexture surfaceTexture) {
            aw.this.a((Object) null);
            aw.this.a(0, 0);
            return true;
        }

        @Override
        public void onSurfaceTextureSizeChanged(SurfaceTexture surfaceTexture, int i10, int i11) {
            aw.this.a(i10, i11);
        }

        @Override
        public void surfaceChanged(SurfaceHolder surfaceHolder, int i10, int i11, int i12) {
            aw.this.a(i11, i12);
        }

        @Override
        public void surfaceCreated(SurfaceHolder surfaceHolder) {
            if (aw.this.f4739w) {
                aw.this.a(surfaceHolder.getSurface());
            }
        }

        @Override
        public void surfaceDestroyed(SurfaceHolder surfaceHolder) {
            if (aw.this.f4739w) {
                aw.this.a((Object) null);
            }
            aw.this.a(0, 0);
        }

        @Override
        public void a(ac acVar) {
            k0.b(this, acVar);
        }

        @Override
        public void a_(boolean z10) {
            if (aw.this.H == z10) {
                return;
            }
            aw.this.H = z10;
            aw.this.X();
        }

        @Override
        public void b(ak akVar) {
            k0.m(this, akVar);
        }

        @Override
        public void c(boolean z10) {
            k0.q(this, z10);
        }

        @Override
        public void d(boolean z10) {
            k0.s(this, z10);
        }

        @Override
        public void e(boolean z10) {
            k0.u(this, z10);
        }

        @Override
        public void a(ak akVar) {
            k0.c(this, akVar);
        }

        @Override
        public void b(com.applovin.exoplayer2.c.e eVar) {
            aw.this.f4725i.b(eVar);
            aw.this.f4732p = null;
            aw.this.C = null;
        }

        @Override
        public void c(com.applovin.exoplayer2.c.e eVar) {
            aw.this.D = eVar;
            aw.this.f4725i.c(eVar);
        }

        @Override
        public void d(com.applovin.exoplayer2.c.e eVar) {
            aw.this.f4725i.d(eVar);
            aw.this.f4733q = null;
            aw.this.D = null;
        }

        @Override
        public void a(am amVar) {
            k0.d(this, amVar);
        }

        @Override
        public void a(an.a aVar) {
            k0.e(this, aVar);
        }

        @Override
        public void c(Exception exc) {
            aw.this.f4725i.c(exc);
        }

        @Override
        public void a(an.e eVar, an.e eVar2, int i10) {
            k0.f(this, eVar, eVar2, i10);
        }

        @Override
        public void b(String str, long j10, long j11) {
            aw.this.f4725i.b(str, j10, j11);
        }

        @Override
        public void a(an anVar, an.c cVar) {
            k0.g(this, anVar, cVar);
        }

        @Override
        public void b(v vVar, @Nullable com.applovin.exoplayer2.c.h hVar) {
            aw.this.f4733q = vVar;
            aw.this.f4725i.b(vVar, hVar);
        }

        @Override
        public void a(ba baVar, int i10) {
            k0.h(this, baVar, i10);
        }

        @Override
        public void a(com.applovin.exoplayer2.h.ad adVar, com.applovin.exoplayer2.j.h hVar) {
            k0.i(this, adVar, hVar);
        }

        @Override
        public void b(String str) {
            aw.this.f4725i.b(str);
        }

        @Override
        public void a(v vVar) {
            com.applovin.exoplayer2.b.c0.c(this, vVar);
        }

        @Override
        public void b(Exception exc) {
            aw.this.f4725i.b(exc);
        }

        @Override
        public void a(boolean z10) {
            d1.a(this, z10);
        }

        @Override
        public void b(int i10) {
            aw.this.Y();
        }

        @Override
        public void a(boolean z10, int i10) {
            k0.j(this, z10, i10);
        }

        @Override
        public void b(boolean z10, int i10) {
            aw.this.Y();
        }

        @Override
        public void a(com.applovin.exoplayer2.c.e eVar) {
            aw.this.C = eVar;
            aw.this.f4725i.a(eVar);
        }

        @Override
        public void b(boolean z10) {
            aw.this.Y();
        }

        @Override
        public void a(String str, long j10, long j11) {
            aw.this.f4725i.a(str, j10, j11);
        }

        @Override
        public void a(v vVar, @Nullable com.applovin.exoplayer2.c.h hVar) {
            aw.this.f4732p = vVar;
            aw.this.f4725i.a(vVar, hVar);
        }

        @Override
        public void a(int i10, long j10) {
            aw.this.f4725i.a(i10, j10);
        }

        @Override
        public void a(com.applovin.exoplayer2.m.o oVar) {
            aw.this.P = oVar;
            aw.this.f4725i.a(oVar);
            Iterator it = aw.this.f4724h.iterator();
            while (it.hasNext()) {
                ((an.d) it.next()).a(oVar);
            }
        }

        @Override
        public void a(Object obj, long j10) {
            aw.this.f4725i.a(obj, j10);
            if (aw.this.f4735s == obj) {
                Iterator it = aw.this.f4724h.iterator();
                while (it.hasNext()) {
                    ((an.d) it.next()).a();
                }
            }
        }

        @Override
        public void onSurfaceTextureUpdated(SurfaceTexture surfaceTexture) {
        }

        @Override
        public void a(String str) {
            aw.this.f4725i.a(str);
        }

        @Override
        public void a(long j10, int i10) {
            aw.this.f4725i.a(j10, i10);
        }

        @Override
        public void a(Exception exc) {
            aw.this.f4725i.a(exc);
        }

        @Override
        public void a(long j10) {
            aw.this.f4725i.a(j10);
        }

        @Override
        public void a(int i10, long j10, long j11) {
            aw.this.f4725i.a(i10, j10, j11);
        }

        @Override
        public void a(List<com.applovin.exoplayer2.i.a> list) {
            aw.this.I = list;
            Iterator it = aw.this.f4724h.iterator();
            while (it.hasNext()) {
                ((an.d) it.next()).a(list);
            }
        }

        @Override
        public void a(com.applovin.exoplayer2.g.a aVar) {
            aw.this.f4725i.a(aVar);
            aw.this.f4721e.a(aVar);
            Iterator it = aw.this.f4724h.iterator();
            while (it.hasNext()) {
                ((an.d) it.next()).a(aVar);
            }
        }

        @Override
        public void a(Surface surface) {
            aw.this.a((Object) null);
        }

        @Override
        public void a(float f10) {
            aw.this.W();
        }

        @Override
        public void a(int i10) {
            boolean x10 = aw.this.x();
            aw.this.a(x10, i10, aw.b(x10, i10));
        }

        @Override
        public void a() {
            aw.this.a(false, -1, 3);
        }

        @Override
        public void a(int i10, boolean z10) {
            Iterator it = aw.this.f4724h.iterator();
            while (it.hasNext()) {
                ((an.d) it.next()).a(i10, z10);
            }
        }
    }

    public aw(a aVar) {
        aw awVar;
        com.applovin.exoplayer2.b.d dVar;
        boolean z10;
        boolean z11;
        com.applovin.exoplayer2.l.g gVar = new com.applovin.exoplayer2.l.g();
        this.f4719c = gVar;
        try {
            Context applicationContext = aVar.f4743a.getApplicationContext();
            this.f4720d = applicationContext;
            com.applovin.exoplayer2.a.a aVar2 = aVar.f4751i;
            this.f4725i = aVar2;
            this.L = aVar.f4753k;
            this.F = aVar.f4754l;
            this.f4741y = aVar.f4759q;
            this.f4742z = aVar.f4760r;
            this.H = aVar.f4758p;
            this.f4731o = aVar.f4767y;
            b bVar = new b();
            this.f4722f = bVar;
            c cVar = new c();
            this.f4723g = cVar;
            this.f4724h = new CopyOnWriteArraySet<>();
            Handler handler = new Handler(aVar.f4752j);
            ar[] a10 = aVar.f4744b.a(handler, bVar, bVar, bVar, bVar);
            this.f4718b = a10;
            this.G = 1.0f;
            if (com.applovin.exoplayer2.l.ai.f7987a < 21) {
                this.E = d(0);
            } else {
                this.E = h.a(applicationContext);
            }
            this.I = Collections.emptyList();
            this.J = true;
            try {
                r rVar = new r(a10, aVar.f4747e, aVar.f4748f, aVar.f4749g, aVar.f4750h, aVar2, aVar.f4761s, aVar.f4762t, aVar.f4763u, aVar.f4764v, aVar.f4765w, aVar.f4766x, aVar.f4768z, aVar.f4745c, aVar.f4752j, this, new an.a.C0053a().a(20, 21, 22, 23, 24, 25, 26, 27).a());
                awVar = this;
                try {
                    awVar.f4721e = rVar;
                    rVar.a((an.b) bVar);
                    rVar.a((q.a) bVar);
                    if (aVar.f4746d > 0) {
                        rVar.b(aVar.f4746d);
                    }
                    com.applovin.exoplayer2.b bVar2 = new com.applovin.exoplayer2.b(aVar.f4743a, handler, bVar);
                    awVar.f4726j = bVar2;
                    bVar2.a(aVar.f4757o);
                    com.applovin.exoplayer2.c cVar2 = new com.applovin.exoplayer2.c(aVar.f4743a, handler, bVar);
                    awVar.f4727k = cVar2;
                    if (aVar.f4755m) {
                        dVar = awVar.F;
                    } else {
                        dVar = null;
                    }
                    cVar2.a(dVar);
                    ay ayVar = new ay(aVar.f4743a, handler, bVar);
                    awVar.f4728l = ayVar;
                    ayVar.a(com.applovin.exoplayer2.l.ai.g(awVar.F.f4822d));
                    bb bbVar = new bb(aVar.f4743a);
                    awVar.f4729m = bbVar;
                    if (aVar.f4756n != 0) {
                        z10 = true;
                    } else {
                        z10 = false;
                    }
                    bbVar.a(z10);
                    bc bcVar = new bc(aVar.f4743a);
                    awVar.f4730n = bcVar;
                    if (aVar.f4756n == 2) {
                        z11 = true;
                    } else {
                        z11 = false;
                    }
                    bcVar.a(z11);
                    awVar.O = b(ayVar);
                    awVar.P = com.applovin.exoplayer2.m.o.f8284a;
                    awVar.a(1, 10, Integer.valueOf(awVar.E));
                    awVar.a(2, 10, Integer.valueOf(awVar.E));
                    awVar.a(1, 3, awVar.F);
                    awVar.a(2, 4, Integer.valueOf(awVar.f4741y));
                    awVar.a(2, 5, Integer.valueOf(awVar.f4742z));
                    awVar.a(1, 9, Boolean.valueOf(awVar.H));
                    awVar.a(2, 7, cVar);
                    awVar.a(6, 8, cVar);
                    gVar.a();
                } catch (Throwable th2) {
                    th = th2;
                    awVar.f4719c.a();
                    throw th;
                }
            } catch (Throwable th3) {
                th = th3;
                awVar = this;
            }
        } catch (Throwable th4) {
            th = th4;
            awVar = this;
        }
    }

    private void U() {
        if (this.f4738v != null) {
            this.f4721e.a(this.f4723g).a(10000).a((Object) null).i();
            this.f4738v.b(this.f4722f);
            this.f4738v = null;
        }
        TextureView textureView = this.f4740x;
        if (textureView != null) {
            if (textureView.getSurfaceTextureListener() != this.f4722f) {
                com.applovin.exoplayer2.l.q.c("SimpleExoPlayer", "SurfaceTextureListener already unset or replaced.");
            } else {
                this.f4740x.setSurfaceTextureListener(null);
            }
            this.f4740x = null;
        }
        SurfaceHolder surfaceHolder = this.f4737u;
        if (surfaceHolder != null) {
            surfaceHolder.removeCallback(this.f4722f);
            this.f4737u = null;
        }
    }

    public void W() {
        a(1, 2, Float.valueOf(this.G * this.f4727k.a()));
    }

    public void X() {
        this.f4725i.a_(this.H);
        Iterator<an.d> it = this.f4724h.iterator();
        while (it.hasNext()) {
            it.next().a_(this.H);
        }
    }

    public void Y() {
        int t10 = t();
        boolean z10 = true;
        if (t10 != 1) {
            if (t10 != 2 && t10 != 3) {
                if (t10 != 4) {
                    throw new IllegalStateException();
                }
            } else {
                boolean q10 = q();
                bb bbVar = this.f4729m;
                if (!x() || q10) {
                    z10 = false;
                }
                bbVar.b(z10);
                this.f4730n.b(x());
                return;
            }
        }
        this.f4729m.b(false);
        this.f4730n.b(false);
    }

    private void Z() {
        IllegalStateException illegalStateException;
        this.f4719c.d();
        if (Thread.currentThread() != r().getThread()) {
            String a10 = com.applovin.exoplayer2.l.ai.a("Player is accessed on the wrong thread.\nCurrent thread: '%s'\nExpected thread: '%s'\nSee https://exoplayer.dev/issues/player-accessed-on-wrong-thread", Thread.currentThread().getName(), r().getThread().getName());
            if (!this.J) {
                if (this.K) {
                    illegalStateException = null;
                } else {
                    illegalStateException = new IllegalStateException();
                }
                com.applovin.exoplayer2.l.q.b("SimpleExoPlayer", a10, illegalStateException);
                this.K = true;
                return;
            }
            throw new IllegalStateException(a10);
        }
    }

    public static int b(boolean z10, int i10) {
        return (!z10 || i10 == 1) ? 1 : 2;
    }

    @Override
    public long A() {
        Z();
        return this.f4721e.A();
    }

    @Override
    public long B() {
        Z();
        return this.f4721e.B();
    }

    @Override
    public long C() {
        Z();
        return this.f4721e.C();
    }

    @Override
    public am D() {
        Z();
        return this.f4721e.D();
    }

    public void E() {
        AudioTrack audioTrack;
        Z();
        if (com.applovin.exoplayer2.l.ai.f7987a < 21 && (audioTrack = this.f4734r) != null) {
            audioTrack.release();
            this.f4734r = null;
        }
        this.f4726j.a(false);
        this.f4728l.c();
        this.f4729m.b(false);
        this.f4730n.b(false);
        this.f4727k.b();
        this.f4721e.E();
        this.f4725i.c();
        U();
        Surface surface = this.f4736t;
        if (surface != null) {
            surface.release();
            this.f4736t = null;
        }
        if (this.M) {
            ((com.applovin.exoplayer2.l.aa) com.applovin.exoplayer2.l.a.b(this.L)).b(0);
            this.M = false;
        }
        this.I = Collections.emptyList();
        this.N = true;
    }

    @Override
    public int F() {
        Z();
        return this.f4721e.F();
    }

    @Override
    public int G() {
        Z();
        return this.f4721e.G();
    }

    @Override
    public long H() {
        Z();
        return this.f4721e.H();
    }

    @Override
    public long I() {
        Z();
        return this.f4721e.I();
    }

    @Override
    public long J() {
        Z();
        return this.f4721e.J();
    }

    @Override
    public boolean K() {
        Z();
        return this.f4721e.K();
    }

    @Override
    public int L() {
        Z();
        return this.f4721e.L();
    }

    @Override
    public int M() {
        Z();
        return this.f4721e.M();
    }

    @Override
    public long N() {
        Z();
        return this.f4721e.N();
    }

    @Override
    public long O() {
        Z();
        return this.f4721e.O();
    }

    @Override
    public com.applovin.exoplayer2.h.ad P() {
        Z();
        return this.f4721e.P();
    }

    @Override
    public com.applovin.exoplayer2.j.h Q() {
        Z();
        return this.f4721e.Q();
    }

    @Override
    public ac R() {
        return this.f4721e.R();
    }

    @Override
    public ba S() {
        Z();
        return this.f4721e.S();
    }

    @Override
    public com.applovin.exoplayer2.m.o T() {
        return this.P;
    }

    @Override
    public List<com.applovin.exoplayer2.i.a> V() {
        Z();
        return this.I;
    }

    public boolean q() {
        Z();
        return this.f4721e.q();
    }

    @Override
    public Looper r() {
        return this.f4721e.r();
    }

    @Override
    public an.a s() {
        Z();
        return this.f4721e.s();
    }

    @Override
    public int t() {
        Z();
        return this.f4721e.t();
    }

    @Override
    public int u() {
        Z();
        return this.f4721e.u();
    }

    public void v() {
        Z();
        U();
        a((Object) null);
        a(0, 0);
    }

    @Override
    public void w() {
        Z();
        boolean x10 = x();
        int a10 = this.f4727k.a(x10, 2);
        a(x10, a10, b(x10, a10));
        this.f4721e.w();
    }

    @Override
    public boolean x() {
        Z();
        return this.f4721e.x();
    }

    @Override
    public int y() {
        Z();
        return this.f4721e.y();
    }

    @Override
    public boolean z() {
        Z();
        return this.f4721e.z();
    }

    private int d(int i10) {
        AudioTrack audioTrack = this.f4734r;
        if (audioTrack != null && audioTrack.getAudioSessionId() != i10) {
            this.f4734r.release();
            this.f4734r = null;
        }
        if (this.f4734r == null) {
            this.f4734r = new AudioTrack(3, 4000, 4, 2, 2, 0, i10);
        }
        return this.f4734r.getAudioSessionId();
    }

    @Override
    public void c(int i10) {
        Z();
        this.f4721e.c(i10);
    }

    private void c(SurfaceHolder surfaceHolder) {
        this.f4739w = false;
        this.f4737u = surfaceHolder;
        surfaceHolder.addCallback(this.f4722f);
        Surface surface = this.f4737u.getSurface();
        if (surface != null && surface.isValid()) {
            Rect surfaceFrame = this.f4737u.getSurfaceFrame();
            a(surfaceFrame.width(), surfaceFrame.height());
        } else {
            a(0, 0);
        }
    }

    public void b(@Nullable SurfaceHolder surfaceHolder) {
        Z();
        if (surfaceHolder == null || surfaceHolder != this.f4737u) {
            return;
        }
        v();
    }

    public static final class c implements ao.b, com.applovin.exoplayer2.m.a.a, com.applovin.exoplayer2.m.l {

        @Nullable
        private com.applovin.exoplayer2.m.l f4770a;

        @Nullable
        private com.applovin.exoplayer2.m.a.a f4771b;

        @Nullable
        private com.applovin.exoplayer2.m.l f4772c;

        @Nullable
        private com.applovin.exoplayer2.m.a.a f4773d;

        private c() {
        }

        @Override
        public void a(int i10, @Nullable Object obj) {
            if (i10 == 7) {
                this.f4770a = (com.applovin.exoplayer2.m.l) obj;
                return;
            }
            if (i10 == 8) {
                this.f4771b = (com.applovin.exoplayer2.m.a.a) obj;
                return;
            }
            if (i10 != 10000) {
                return;
            }
            com.applovin.exoplayer2.m.a.i iVar = (com.applovin.exoplayer2.m.a.i) obj;
            if (iVar == null) {
                this.f4772c = null;
                this.f4773d = null;
            } else {
                this.f4772c = iVar.getVideoFrameMetadataListener();
                this.f4773d = iVar.getCameraMotionListener();
            }
        }

        @Override
        public void a(long j10, long j11, v vVar, @Nullable MediaFormat mediaFormat) {
            com.applovin.exoplayer2.m.l lVar = this.f4772c;
            if (lVar != null) {
                lVar.a(j10, j11, vVar, mediaFormat);
            }
            com.applovin.exoplayer2.m.l lVar2 = this.f4770a;
            if (lVar2 != null) {
                lVar2.a(j10, j11, vVar, mediaFormat);
            }
        }

        @Override
        public void a(long j10, float[] fArr) {
            com.applovin.exoplayer2.m.a.a aVar = this.f4773d;
            if (aVar != null) {
                aVar.a(j10, fArr);
            }
            com.applovin.exoplayer2.m.a.a aVar2 = this.f4771b;
            if (aVar2 != null) {
                aVar2.a(j10, fArr);
            }
        }

        @Override
        public void a() {
            com.applovin.exoplayer2.m.a.a aVar = this.f4773d;
            if (aVar != null) {
                aVar.a();
            }
            com.applovin.exoplayer2.m.a.a aVar2 = this.f4771b;
            if (aVar2 != null) {
                aVar2.a();
            }
        }
    }

    @Override
    public void b(@Nullable SurfaceView surfaceView) {
        Z();
        b(surfaceView == null ? null : surfaceView.getHolder());
    }

    @Override
    public void b(@Nullable TextureView textureView) {
        Z();
        if (textureView == null || textureView != this.f4740x) {
            return;
        }
        v();
    }

    public void a(@Nullable SurfaceHolder surfaceHolder) {
        Z();
        if (surfaceHolder == null) {
            v();
            return;
        }
        U();
        this.f4739w = true;
        this.f4737u = surfaceHolder;
        surfaceHolder.addCallback(this.f4722f);
        Surface surface = surfaceHolder.getSurface();
        if (surface != null && surface.isValid()) {
            a(surface);
            Rect surfaceFrame = surfaceHolder.getSurfaceFrame();
            a(surfaceFrame.width(), surfaceFrame.height());
        } else {
            a((Object) null);
            a(0, 0);
        }
    }

    @Override
    public void b(an.d dVar) {
        com.applovin.exoplayer2.l.a.b(dVar);
        this.f4724h.remove(dVar);
        b((an.b) dVar);
    }

    @Deprecated
    public void b(an.b bVar) {
        this.f4721e.b(bVar);
    }

    @Override
    @Nullable
    public p e() {
        Z();
        return this.f4721e.e();
    }

    @Override
    public void b(boolean z10) {
        Z();
        this.f4721e.b(z10);
    }

    public static o b(ay ayVar) {
        return new o(0, ayVar.a(), ayVar.b());
    }

    @Override
    public void a(@Nullable SurfaceView surfaceView) {
        Z();
        if (surfaceView instanceof com.applovin.exoplayer2.m.k) {
            U();
            a((Object) surfaceView);
            c(surfaceView.getHolder());
        } else {
            if (surfaceView instanceof com.applovin.exoplayer2.m.a.i) {
                U();
                this.f4738v = (com.applovin.exoplayer2.m.a.i) surfaceView;
                this.f4721e.a(this.f4723g).a(10000).a(this.f4738v).i();
                this.f4738v.a(this.f4722f);
                a(this.f4738v.getVideoSurface());
                c(surfaceView.getHolder());
                return;
            }
            a(surfaceView == null ? null : surfaceView.getHolder());
        }
    }

    @Override
    public void a(@Nullable TextureView textureView) {
        Z();
        if (textureView == null) {
            v();
            return;
        }
        U();
        this.f4740x = textureView;
        if (textureView.getSurfaceTextureListener() != null) {
            com.applovin.exoplayer2.l.q.c("SimpleExoPlayer", "Replacing existing SurfaceTextureListener.");
        }
        textureView.setSurfaceTextureListener(this.f4722f);
        SurfaceTexture surfaceTexture = textureView.isAvailable() ? textureView.getSurfaceTexture() : null;
        if (surfaceTexture == null) {
            a((Object) null);
            a(0, 0);
        } else {
            a(surfaceTexture);
            a(textureView.getWidth(), textureView.getHeight());
        }
    }

    public void a(float f10) {
        Z();
        float a10 = com.applovin.exoplayer2.l.ai.a(f10, 0.0f, 1.0f);
        if (this.G == a10) {
            return;
        }
        this.G = a10;
        W();
        this.f4725i.a(a10);
        Iterator<an.d> it = this.f4724h.iterator();
        while (it.hasNext()) {
            it.next().a(a10);
        }
    }

    @Override
    public void a(an.d dVar) {
        com.applovin.exoplayer2.l.a.b(dVar);
        this.f4724h.add(dVar);
        a((an.b) dVar);
    }

    @Deprecated
    public void a(an.b bVar) {
        com.applovin.exoplayer2.l.a.b(bVar);
        this.f4721e.a(bVar);
    }

    public void a(com.applovin.exoplayer2.h.p pVar) {
        Z();
        this.f4721e.a(pVar);
    }

    @Override
    public void a(boolean z10) {
        Z();
        int a10 = this.f4727k.a(z10, t());
        a(z10, a10, b(z10, a10));
    }

    @Override
    public void a(int i10, long j10) {
        Z();
        this.f4725i.d();
        this.f4721e.a(i10, j10);
    }

    public void a(SurfaceTexture surfaceTexture) {
        Surface surface = new Surface(surfaceTexture);
        a(surface);
        this.f4736t = surface;
    }

    public void a(@Nullable Object obj) {
        boolean z10;
        ArrayList arrayList = new ArrayList();
        ar[] arVarArr = this.f4718b;
        int length = arVarArr.length;
        int i10 = 0;
        while (true) {
            z10 = true;
            if (i10 >= length) {
                break;
            }
            ar arVar = arVarArr[i10];
            if (arVar.a() == 2) {
                arrayList.add(this.f4721e.a(arVar).a(1).a(obj).i());
            }
            i10++;
        }
        Object obj2 = this.f4735s;
        if (obj2 == null || obj2 == obj) {
            z10 = false;
        } else {
            try {
                Iterator it = arrayList.iterator();
                while (it.hasNext()) {
                    ((ao) it.next()).a(this.f4731o);
                }
            } catch (InterruptedException unused) {
                Thread.currentThread().interrupt();
            } catch (TimeoutException unused2) {
            }
            z10 = false;
            Object obj3 = this.f4735s;
            Surface surface = this.f4736t;
            if (obj3 == surface) {
                surface.release();
                this.f4736t = null;
            }
        }
        this.f4735s = obj;
        if (z10) {
            this.f4721e.a(false, p.a(new u(3), 1003));
        }
    }

    public void a(int i10, int i11) {
        if (i10 == this.A && i11 == this.B) {
            return;
        }
        this.A = i10;
        this.B = i11;
        this.f4725i.a(i10, i11);
        Iterator<an.d> it = this.f4724h.iterator();
        while (it.hasNext()) {
            it.next().a(i10, i11);
        }
    }

    public void a(boolean z10, int i10, int i11) {
        int i12 = 0;
        boolean z11 = z10 && i10 != -1;
        if (z11 && i10 != 1) {
            i12 = 1;
        }
        this.f4721e.a(z11, i12, i11);
    }

    private void a(int i10, int i11, @Nullable Object obj) {
        for (ar arVar : this.f4718b) {
            if (arVar.a() == i10) {
                this.f4721e.a(arVar).a(i11).a(obj).i();
            }
        }
    }
}