MyRecorder v1.01.90.0219版本的 MD5 值为:c361f51174a0bf833abfa72929caf8d3

以下内容为反编译后的 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 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 com.google.android.exoplayer2.ExoPlayer;
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 com.applovin.exoplayer2.b.d N;
    public final ar[] bB;
    private final com.applovin.exoplayer2.a.a bM;
    private final bc hA;
    private final long hB;
    private v hC;
    private v hD;
    private AudioTrack hE;
    private Object hF;
    private Surface hG;
    private SurfaceHolder hH;
    private com.applovin.exoplayer2.m.a.i hI;
    private boolean hJ;
    private TextureView hK;
    private int hL;
    private int hM;
    private int hN;
    private int hO;
    private com.applovin.exoplayer2.c.e hP;
    private com.applovin.exoplayer2.c.e hQ;
    private int hR;
    private float hS;
    private boolean hT;
    private List<com.applovin.exoplayer2.i.a> hU;
    private boolean hV;
    private boolean hW;
    private com.applovin.exoplayer2.l.aa hX;
    private boolean hY;
    private boolean hZ;
    private final com.applovin.exoplayer2.l.g hq;
    private final Context hr;
    private final r hs;
    private final b ht;
    private final c hu;
    private final CopyOnWriteArraySet<an.d> hv;
    private final com.applovin.exoplayer2.b hw;
    private final com.applovin.exoplayer2.c hx;
    private final ay hy;
    private final bb hz;
    private o f7552ia;
    private com.applovin.exoplayer2.m.o f7553ib;

    @Deprecated
    public static final class a {
        private final Context E;
        private com.applovin.exoplayer2.b.d N;
        private com.applovin.exoplayer2.j.j bC;
        private boolean bK;
        private com.applovin.exoplayer2.h.r bL;
        private com.applovin.exoplayer2.a.a bM;
        private com.applovin.exoplayer2.k.d bO;
        private long bP;
        private long bQ;
        private com.applovin.exoplayer2.l.d bR;
        private av bY;
        private boolean bZ;
        private aa f7554cl;
        private z ct;
        private long cu;
        private Looper gU;
        private long hB;
        private int hL;
        private int hM;
        private boolean hT;
        private com.applovin.exoplayer2.l.aa hX;
        private final au f7555ic;
        private long f7556id;
        private boolean f7557ie;
        private int f0if;
        private boolean f7558ig;
        private boolean f7559ih;

        @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.i(context), new com.applovin.exoplayer2.a.a(com.applovin.exoplayer2.l.d.abJ));
        }

        @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.E = context;
            this.f7555ic = auVar;
            this.bC = jVar;
            this.bL = rVar;
            this.f7554cl = aaVar;
            this.bO = dVar;
            this.bM = aVar;
            this.gU = com.applovin.exoplayer2.l.ai.pZ();
            this.N = com.applovin.exoplayer2.b.d.jD;
            this.f0if = 0;
            this.hL = 1;
            this.hM = 0;
            this.bK = true;
            this.bY = av.f7549hn;
            this.bP = 5000L;
            this.bQ = 15000L;
            this.ct = new k.a().ao();
            this.bR = com.applovin.exoplayer2.l.d.abJ;
            this.cu = 500L;
            this.hB = ExoPlayer.DEFAULT_DETACH_SURFACE_TIMEOUT_MS;
        }

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

    public final class b implements SurfaceHolder.Callback, TextureView.SurfaceTextureListener, an.b, ay.a, b.InterfaceC0099b, 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(boolean z7) {
            if (aw.this.hT == z7) {
                return;
            }
            aw.this.hT = z7;
            aw.this.cV();
        }

        @Override
        public void Z(int i10) {
            aw.this.cW();
        }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        @Override
        public void ai(int i10) {
            o a10 = aw.a(aw.this.hy);
            if (a10.equals(aw.this.f7552ia)) {
                return;
            }
            aw.this.f7552ia = a10;
            Iterator it = aw.this.hv.iterator();
            while (it.hasNext()) {
                ((an.d) it.next()).a(a10);
            }
        }

        @Override
        public void b(float f10) {
            aw.this.cU();
        }

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

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

        @Override
        public void b(am amVar) {
            k0.l(this, amVar);
        }

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

        @Override
        public void b(com.applovin.exoplayer2.c.e eVar) {
            aw.this.bM.b(eVar);
            aw.this.hC = null;
            aw.this.hP = null;
        }

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

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

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

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

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

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

        @Override
        public void cD() {
            k0.n(this);
        }

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

        @Override
        public void d(com.applovin.exoplayer2.c.e eVar) {
            aw.this.bM.d(eVar);
            aw.this.hD = null;
            aw.this.hQ = null;
        }

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

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

        @Override
        public void e(boolean z7, int i10) {
            aw.this.cW();
        }

        @Override
        public void f(int i10, boolean z7) {
            Iterator it = aw.this.hv.iterator();
            while (it.hasNext()) {
                ((an.d) it.next()).e(i10, z7);
            }
        }

        @Override
        public void i(boolean z7) {
            a1.a(this, z7);
        }

        @Override
        public void j(boolean z7) {
            aw.this.cW();
        }

        @Override
        public void l(int i10) {
            boolean aE = aw.this.aE();
            aw.this.b(aE, i10, aw.f(aE, i10));
        }

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

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

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

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

        @Override
        public void onSurfaceTextureUpdated(SurfaceTexture surfaceTexture) {
        }

        @Override
        public void r(String str) {
            aw.this.bM.r(str);
        }

        @Override
        public void s(String str) {
            aw.this.bM.s(str);
        }

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

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

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

        @Override
        public void w(boolean z7) {
            if (aw.this.hX != null) {
                if (z7 && !aw.this.hY) {
                    aw.this.hX.cR(0);
                    aw.this.hY = true;
                } else if (z7 || !aw.this.hY) {
                } else {
                    aw.this.hX.fF(0);
                    aw.this.hY = false;
                }
            }
        }

        @Override
        public void x(boolean z7) {
            k0.s(this, z7);
        }

        @Override
        public void y(v vVar) {
            com.applovin.exoplayer2.m.r.k(this, vVar);
        }

        @Override
        public void y(boolean z7) {
            k0.t(this, z7);
        }

        @Override
        public void z(long j10) {
            aw.this.bM.z(j10);
        }

        @Override
        public void z(boolean z7) {
            k0.u(this, z7);
        }
    }

    public static final class c implements ao.b, com.applovin.exoplayer2.m.a.a, com.applovin.exoplayer2.m.l {
        private com.applovin.exoplayer2.m.l f7561ij;
        private com.applovin.exoplayer2.m.a.a f7562ik;
        private com.applovin.exoplayer2.m.l f7563il;
        private com.applovin.exoplayer2.m.a.a f7564im;

        private c() {
        }

        @Override
        public void a(int i10, Object obj) {
            if (i10 == 7) {
                this.f7561ij = (com.applovin.exoplayer2.m.l) obj;
            } else if (i10 == 8) {
                this.f7562ik = (com.applovin.exoplayer2.m.a.a) obj;
            } else if (i10 != 10000) {
            } else {
                com.applovin.exoplayer2.m.a.i iVar = (com.applovin.exoplayer2.m.a.i) obj;
                if (iVar == null) {
                    this.f7563il = null;
                    this.f7564im = null;
                    return;
                }
                this.f7563il = iVar.getVideoFrameMetadataListener();
                this.f7564im = iVar.getCameraMotionListener();
            }
        }

        @Override
        public void a(long j10, long j11, v vVar, MediaFormat mediaFormat) {
            com.applovin.exoplayer2.m.l lVar = this.f7563il;
            if (lVar != null) {
                lVar.a(j10, j11, vVar, mediaFormat);
            }
            com.applovin.exoplayer2.m.l lVar2 = this.f7561ij;
            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.f7564im;
            if (aVar != null) {
                aVar.a(j10, fArr);
            }
            com.applovin.exoplayer2.m.a.a aVar2 = this.f7562ik;
            if (aVar2 != null) {
                aVar2.a(j10, fArr);
            }
        }

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

    public aw(a aVar) {
        aw awVar;
        com.applovin.exoplayer2.l.g gVar = new com.applovin.exoplayer2.l.g();
        this.hq = gVar;
        try {
            Context applicationContext = aVar.E.getApplicationContext();
            this.hr = applicationContext;
            com.applovin.exoplayer2.a.a aVar2 = aVar.bM;
            this.bM = aVar2;
            this.hX = aVar.hX;
            this.N = aVar.N;
            this.hL = aVar.hL;
            this.hM = aVar.hM;
            this.hT = aVar.hT;
            this.hB = aVar.hB;
            b bVar = new b();
            this.ht = bVar;
            c cVar = new c();
            this.hu = cVar;
            this.hv = new CopyOnWriteArraySet<>();
            Handler handler = new Handler(aVar.gU);
            ar[] a10 = aVar.f7555ic.a(handler, bVar, bVar, bVar, bVar);
            this.bB = a10;
            this.hS = 1.0f;
            if (com.applovin.exoplayer2.l.ai.acV < 21) {
                this.hR = ah(0);
            } else {
                this.hR = h.c(applicationContext);
            }
            this.hU = Collections.emptyList();
            this.hV = true;
            try {
                r rVar = new r(a10, aVar.bC, aVar.bL, aVar.f7554cl, aVar.bO, aVar2, aVar.bK, aVar.bY, aVar.bP, aVar.bQ, aVar.ct, aVar.cu, aVar.bZ, aVar.bR, aVar.gU, this, new an.a.C0097a().a(20, 21, 22, 23, 24, 25, 26, 27).cC());
                awVar = this;
                try {
                    awVar.hs = rVar;
                    rVar.a((an.b) bVar);
                    rVar.a((q.a) bVar);
                    if (aVar.f7556id > 0) {
                        rVar.j(aVar.f7556id);
                    }
                    com.applovin.exoplayer2.b bVar2 = new com.applovin.exoplayer2.b(aVar.E, handler, bVar);
                    awVar.hw = bVar2;
                    bVar2.setEnabled(aVar.f7558ig);
                    com.applovin.exoplayer2.c cVar2 = new com.applovin.exoplayer2.c(aVar.E, handler, bVar);
                    awVar.hx = cVar2;
                    cVar2.a(aVar.f7557ie ? awVar.N : null);
                    ay ayVar = new ay(aVar.E, handler, bVar);
                    awVar.hy = ayVar;
                    ayVar.aj(com.applovin.exoplayer2.l.ai.fM(awVar.N.jG));
                    bb bbVar = new bb(aVar.E);
                    awVar.hz = bbVar;
                    bbVar.setEnabled(aVar.f0if != 0);
                    bc bcVar = new bc(aVar.E);
                    awVar.hA = bcVar;
                    bcVar.setEnabled(aVar.f0if == 2);
                    awVar.f7552ia = a(ayVar);
                    awVar.f7553ib = com.applovin.exoplayer2.m.o.afk;
                    awVar.a(1, 10, Integer.valueOf(awVar.hR));
                    awVar.a(2, 10, Integer.valueOf(awVar.hR));
                    awVar.a(1, 3, awVar.N);
                    awVar.a(2, 4, Integer.valueOf(awVar.hL));
                    awVar.a(2, 5, Integer.valueOf(awVar.hM));
                    awVar.a(1, 9, Boolean.valueOf(awVar.hT));
                    awVar.a(2, 7, cVar);
                    awVar.a(6, 8, cVar);
                    gVar.oN();
                } catch (Throwable th2) {
                    th = th2;
                    awVar.hq.oN();
                    throw th;
                }
            } catch (Throwable th3) {
                th = th3;
                awVar = this;
            }
        } catch (Throwable th4) {
            th = th4;
            awVar = this;
        }
    }

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

    private void a(int i10, int i11, Object obj) {
        ar[] arVarArr;
        for (ar arVar : this.bB) {
            if (arVar.M() == i10) {
                this.hs.a(arVar).ad(i11).h(obj).cM();
            }
        }
    }

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

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

    public void b(boolean z7, int i10, int i11) {
        int i12 = 0;
        boolean z9 = z7 && i10 != -1;
        if (z9 && i10 != 1) {
            i12 = 1;
        }
        this.hs.a(z9, i12, i11);
    }

    private void c(SurfaceHolder surfaceHolder) {
        this.hJ = false;
        this.hH = surfaceHolder;
        surfaceHolder.addCallback(this.ht);
        Surface surface = this.hH.getSurface();
        if (surface == null || !surface.isValid()) {
            g(0, 0);
            return;
        }
        Rect surfaceFrame = this.hH.getSurfaceFrame();
        g(surfaceFrame.width(), surfaceFrame.height());
    }

    private void cT() {
        if (this.hI != null) {
            this.hs.a(this.hu).ad(10000).h(null).cM();
            this.hI.b(this.ht);
            this.hI = null;
        }
        TextureView textureView = this.hK;
        if (textureView != null) {
            if (textureView.getSurfaceTextureListener() != this.ht) {
                com.applovin.exoplayer2.l.q.h("SimpleExoPlayer", "SurfaceTextureListener already unset or replaced.");
            } else {
                this.hK.setSurfaceTextureListener(null);
            }
            this.hK = null;
        }
        SurfaceHolder surfaceHolder = this.hH;
        if (surfaceHolder != null) {
            surfaceHolder.removeCallback(this.ht);
            this.hH = null;
        }
    }

    public void cU() {
        a(1, 2, Float.valueOf(this.hS * this.hx.n()));
    }

    public void cV() {
        this.bM.A(this.hT);
        Iterator<an.d> it = this.hv.iterator();
        while (it.hasNext()) {
            it.next().A(this.hT);
        }
    }

    public void cW() {
        int aB = aB();
        boolean z7 = true;
        if (aB != 1) {
            if (aB == 2 || aB == 3) {
                this.hz.C((!aE() || ay()) ? false : false);
                this.hA.C(aE());
                return;
            } else if (aB != 4) {
                throw new IllegalStateException();
            }
        }
        this.hz.C(false);
        this.hA.C(false);
    }

    private void cX() {
        this.hq.oQ();
        if (Thread.currentThread() != az().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(), az().getThread().getName());
            if (this.hV) {
                throw new IllegalStateException(a10);
            }
            com.applovin.exoplayer2.l.q.b("SimpleExoPlayer", a10, this.hW ? null : new IllegalStateException());
            this.hW = true;
        }
    }

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

    public void g(int i10, int i11) {
        if (i10 == this.hN && i11 == this.hO) {
            return;
        }
        this.hN = i10;
        this.hO = i11;
        this.bM.f(i10, i11);
        Iterator<an.d> it = this.hv.iterator();
        while (it.hasNext()) {
            it.next().f(i10, i11);
        }
    }

    public void i(Object obj) {
        boolean z7;
        ArrayList<ao> arrayList = new ArrayList();
        ar[] arVarArr = this.bB;
        int length = arVarArr.length;
        int i10 = 0;
        while (true) {
            z7 = true;
            if (i10 >= length) {
                break;
            }
            ar arVar = arVarArr[i10];
            if (arVar.M() == 2) {
                arrayList.add(this.hs.a(arVar).ad(1).h(obj).cM());
            }
            i10++;
        }
        Object obj2 = this.hF;
        if (obj2 == null || obj2 == obj) {
            z7 = false;
        } else {
            try {
                for (ao aoVar : arrayList) {
                    aoVar.y(this.hB);
                }
            } catch (InterruptedException unused) {
                Thread.currentThread().interrupt();
            } catch (TimeoutException unused2) {
            }
            z7 = false;
            Object obj3 = this.hF;
            Surface surface = this.hG;
            if (obj3 == surface) {
                surface.release();
                this.hG = null;
            }
        }
        this.hF = obj;
        if (z7) {
            this.hs.a(false, p.a(new u(3), 1003));
        }
    }

    @Override
    public void a(int i10, long j10) {
        cX();
        this.bM.dq();
        this.hs.a(i10, j10);
    }

    public void a(SurfaceHolder surfaceHolder) {
        cX();
        if (surfaceHolder == null) {
            cS();
            return;
        }
        cT();
        this.hJ = true;
        this.hH = surfaceHolder;
        surfaceHolder.addCallback(this.ht);
        Surface surface = surfaceHolder.getSurface();
        if (surface == null || !surface.isValid()) {
            i((Object) null);
            g(0, 0);
            return;
        }
        i(surface);
        Rect surfaceFrame = surfaceHolder.getSurfaceFrame();
        g(surfaceFrame.width(), surfaceFrame.height());
    }

    @Override
    public void a(SurfaceView surfaceView) {
        cX();
        if (surfaceView instanceof com.applovin.exoplayer2.m.k) {
            cT();
            i(surfaceView);
            c(surfaceView.getHolder());
        } else if (!(surfaceView instanceof com.applovin.exoplayer2.m.a.i)) {
            a(surfaceView == null ? null : surfaceView.getHolder());
        } else {
            cT();
            this.hI = (com.applovin.exoplayer2.m.a.i) surfaceView;
            this.hs.a(this.hu).ad(10000).h(this.hI).cM();
            this.hI.a(this.ht);
            i(this.hI.getVideoSurface());
            c(surfaceView.getHolder());
        }
    }

    @Override
    public void a(TextureView textureView) {
        cX();
        if (textureView == null) {
            cS();
            return;
        }
        cT();
        this.hK = textureView;
        if (textureView.getSurfaceTextureListener() != null) {
            com.applovin.exoplayer2.l.q.h("SimpleExoPlayer", "Replacing existing SurfaceTextureListener.");
        }
        textureView.setSurfaceTextureListener(this.ht);
        SurfaceTexture surfaceTexture = textureView.isAvailable() ? textureView.getSurfaceTexture() : null;
        if (surfaceTexture == null) {
            i((Object) null);
            g(0, 0);
            return;
        }
        a(surfaceTexture);
        g(textureView.getWidth(), textureView.getHeight());
    }

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

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

    @Override
    public an.a aA() {
        cX();
        return this.hs.aA();
    }

    @Override
    public int aB() {
        cX();
        return this.hs.aB();
    }

    @Override
    public int aC() {
        cX();
        return this.hs.aC();
    }

    @Override
    public void aD() {
        cX();
        boolean aE = aE();
        int a10 = this.hx.a(aE, 2);
        b(aE, a10, f(aE, a10));
        this.hs.aD();
    }

    @Override
    public boolean aE() {
        cX();
        return this.hs.aE();
    }

    @Override
    public int aF() {
        cX();
        return this.hs.aF();
    }

    @Override
    public boolean aG() {
        cX();
        return this.hs.aG();
    }

    @Override
    public long aH() {
        cX();
        return this.hs.aH();
    }

    @Override
    public long aI() {
        cX();
        return this.hs.aI();
    }

    @Override
    public long aJ() {
        cX();
        return this.hs.aJ();
    }

    @Override
    public int aK() {
        cX();
        return this.hs.aK();
    }

    @Override
    public int aL() {
        cX();
        return this.hs.aL();
    }

    @Override
    public long aM() {
        cX();
        return this.hs.aM();
    }

    @Override
    public long aN() {
        cX();
        return this.hs.aN();
    }

    @Override
    public long aO() {
        cX();
        return this.hs.aO();
    }

    @Override
    public boolean aP() {
        cX();
        return this.hs.aP();
    }

    @Override
    public int aQ() {
        cX();
        return this.hs.aQ();
    }

    @Override
    public int aR() {
        cX();
        return this.hs.aR();
    }

    @Override
    public long aS() {
        cX();
        return this.hs.aS();
    }

    @Override
    public long aT() {
        cX();
        return this.hs.aT();
    }

    @Override
    public com.applovin.exoplayer2.h.ad aU() {
        cX();
        return this.hs.aU();
    }

    @Override
    public com.applovin.exoplayer2.j.h aV() {
        cX();
        return this.hs.aV();
    }

    @Override
    public ac aW() {
        return this.hs.aW();
    }

    @Override
    public ba aX() {
        cX();
        return this.hs.aX();
    }

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

    @Override
    public am av() {
        cX();
        return this.hs.av();
    }

    @Override
    public p ax() {
        cX();
        return this.hs.ax();
    }

    public boolean ay() {
        cX();
        return this.hs.ay();
    }

    @Override
    public Looper az() {
        return this.hs.az();
    }

    public void b(SurfaceHolder surfaceHolder) {
        cX();
        if (surfaceHolder == null || surfaceHolder != this.hH) {
            return;
        }
        cS();
    }

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

    @Override
    public void b(TextureView textureView) {
        cX();
        if (textureView == null || textureView != this.hK) {
            return;
        }
        cS();
    }

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

    @Override
    public List<com.applovin.exoplayer2.i.a> bd() {
        cX();
        return this.hU;
    }

    public void cS() {
        cX();
        cT();
        i((Object) null);
        g(0, 0);
    }

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

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

    public void h(float f10) {
        cX();
        float a10 = com.applovin.exoplayer2.l.ai.a(f10, 0.0f, 1.0f);
        if (this.hS == a10) {
            return;
        }
        this.hS = a10;
        cU();
        this.bM.g(a10);
        Iterator<an.d> it = this.hv.iterator();
        while (it.hasNext()) {
            it.next().g(a10);
        }
    }

    @Override
    public void k(boolean z7) {
        cX();
        int a10 = this.hx.a(z7, aB());
        b(z7, a10, f(z7, a10));
    }

    @Override
    public void l(boolean z7) {
        cX();
        this.hs.l(z7);
    }

    public void release() {
        AudioTrack audioTrack;
        cX();
        if (com.applovin.exoplayer2.l.ai.acV < 21 && (audioTrack = this.hE) != null) {
            audioTrack.release();
            this.hE = null;
        }
        this.hw.setEnabled(false);
        this.hy.release();
        this.hz.C(false);
        this.hA.C(false);
        this.hx.release();
        this.hs.release();
        this.bM.release();
        cT();
        Surface surface = this.hG;
        if (surface != null) {
            surface.release();
            this.hG = null;
        }
        if (this.hY) {
            ((com.applovin.exoplayer2.l.aa) com.applovin.exoplayer2.l.a.checkNotNull(this.hX)).fF(0);
            this.hY = false;
        }
        this.hU = Collections.emptyList();
        this.hZ = true;
    }

    @Override
    public void u(int i10) {
        cX();
        this.hs.u(i10);
    }
}