discord-jadx/app/src/main/java/c/i/a/c/j2/n.java

2624 lines
85 KiB
Java

package c.i.a.c.j2;
import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Point;
import android.media.MediaCodecInfo;
import android.media.MediaCrypto;
import android.media.MediaFormat;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.os.SystemClock;
import android.util.Log;
import android.util.Pair;
import android.view.Surface;
import androidx.annotation.CallSuper;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import c.i.a.c.b2.g;
import c.i.a.c.b2.r;
import c.i.a.c.b2.s;
import c.i.a.c.b2.t;
import c.i.a.c.i2.f0;
import c.i.a.c.j2.l;
import c.i.a.c.j2.t;
import c.i.a.c.j2.w;
import c.i.a.c.m1;
import c.i.a.c.s0;
import c.i.a.c.x1.d;
import c.i.a.c.x1.e;
import com.airbnb.lottie.parser.AnimatableValueParser;
import com.google.android.exoplayer2.ExoPlaybackException;
import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.decoder.DecoderInputBuffer;
import com.google.android.exoplayer2.mediacodec.MediaCodecDecoderException;
import com.google.android.exoplayer2.mediacodec.MediaCodecRenderer;
import com.google.android.exoplayer2.mediacodec.MediaCodecUtil;
import com.google.android.exoplayer2.video.ColorInfo;
import com.google.android.exoplayer2.video.DummySurface;
import com.google.android.exoplayer2.video.MediaCodecVideoDecoderException;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.regex.Pattern;
/* compiled from: MediaCodecVideoRenderer */
public class n extends MediaCodecRenderer {
public static final int[] P0 = {1920, 1600, 1440, 1280, 960, 854, 640, 540, 480};
public static boolean Q0;
public static boolean R0;
public boolean A1;
public int B1 = 0;
@Nullable
public b C1;
@Nullable
public s D1;
public final Context S0;
public final t T0;
public final w.a U0;
public final long V0;
public final int W0;
public final boolean X0 = "NVIDIA".equals(f0.f899c);
public a Y0;
public boolean Z0;
public boolean a1;
@Nullable
public Surface b1;
@Nullable
public Surface c1;
public boolean d1;
public int e1 = 1;
public boolean f1;
public boolean g1;
public boolean h1;
public long i1;
public long j1 = -9223372036854775807L;
public long k1;
public int l1;
public int m1;
public int n1;
public long o1;
public long p1;
public long q1;
public int r1;
public int s1 = -1;
public int t1 = -1;
public int u1;
public float v1 = -1.0f;
public int w1;
public int x1;
public int y1;
public float z1;
/* compiled from: MediaCodecVideoRenderer */
public static final class a {
public final int a;
public final int b;
/* renamed from: c reason: collision with root package name */
public final int f917c;
public a(int i, int i2, int i3) {
this.a = i;
this.b = i2;
this.f917c = i3;
}
}
/* compiled from: MediaCodecVideoRenderer */
@RequiresApi(23)
public final class b implements r.b, Handler.Callback {
public final Handler i;
public b(r rVar) {
int i = f0.a;
Looper myLooper = Looper.myLooper();
AnimatableValueParser.H(myLooper);
Handler handler = new Handler(myLooper, this);
this.i = handler;
rVar.e(this, handler);
}
public final void a(long j) {
n nVar = n.this;
if (this == nVar.C1) {
if (j == Long.MAX_VALUE) {
nVar.G0 = true;
return;
}
try {
nVar.P0(j);
} catch (ExoPlaybackException e) {
n.this.K0 = e;
}
}
}
public void b(r rVar, long j, long j2) {
if (f0.a < 30) {
this.i.sendMessageAtFrontOfQueue(Message.obtain(this.i, 0, (int) (j >> 32), (int) j));
return;
}
a(j);
}
@Override // android.os.Handler.Callback
public boolean handleMessage(Message message) {
if (message.what != 0) {
return false;
}
a((f0.L(message.arg1) << 32) | f0.L(message.arg2));
return true;
}
}
public n(Context context, t tVar, long j, boolean z2, @Nullable Handler handler, @Nullable w wVar, int i) {
super(2, r.a.a, tVar, z2, 30.0f);
this.V0 = j;
this.W0 = i;
Context applicationContext = context.getApplicationContext();
this.S0 = applicationContext;
this.T0 = new t(applicationContext);
this.U0 = new w.a(handler, wVar);
D0();
}
/* JADX INFO: Can't fix incorrect switch cases order, some code will duplicate */
/* JADX WARNING: Code restructure failed: missing block: B:438:0x07cf, code lost:
if (r0.equals("NX573J") == false) goto L_0x008c;
*/
/* JADX WARNING: Code restructure failed: missing block: B:462:0x0831, code lost:
if (r0.equals("AFTN") == false) goto L_0x0829;
*/
public static boolean F0() {
char c2;
int i = f0.a;
char c3 = 6;
char c4 = 2;
if (i <= 28) {
String str = f0.b;
str.hashCode();
switch (str.hashCode()) {
case -1339091551:
if (str.equals("dangal")) {
c2 = 0;
break;
}
c2 = 65535;
break;
case -1220081023:
if (str.equals("dangalFHD")) {
c2 = 1;
break;
}
c2 = 65535;
break;
case -1220066608:
if (str.equals("dangalUHD")) {
c2 = 2;
break;
}
c2 = 65535;
break;
case -1012436106:
if (str.equals("oneday")) {
c2 = 3;
break;
}
c2 = 65535;
break;
case -64886864:
if (str.equals("magnolia")) {
c2 = 4;
break;
}
c2 = 65535;
break;
case 3415681:
if (str.equals("once")) {
c2 = 5;
break;
}
c2 = 65535;
break;
case 825323514:
if (str.equals("machuca")) {
c2 = 6;
break;
}
c2 = 65535;
break;
default:
c2 = 65535;
break;
}
switch (c2) {
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
return true;
}
}
if (i <= 27 && "HWEML".equals(f0.b)) {
return true;
}
if (i <= 26) {
String str2 = f0.b;
str2.hashCode();
switch (str2.hashCode()) {
case -2144781245:
if (str2.equals("GIONEE_SWW1609")) {
c3 = 0;
break;
}
c3 = 65535;
break;
case -2144781185:
if (str2.equals("GIONEE_SWW1627")) {
c3 = 1;
break;
}
c3 = 65535;
break;
case -2144781160:
if (str2.equals("GIONEE_SWW1631")) {
c3 = 2;
break;
}
c3 = 65535;
break;
case -2097309513:
if (str2.equals("K50a40")) {
c3 = 3;
break;
}
c3 = 65535;
break;
case -2022874474:
if (str2.equals("CP8676_I02")) {
c3 = 4;
break;
}
c3 = 65535;
break;
case -1978993182:
if (str2.equals("NX541J")) {
c3 = 5;
break;
}
c3 = 65535;
break;
case -1978990237:
break;
case -1936688988:
if (str2.equals("PGN528")) {
c3 = 7;
break;
}
c3 = 65535;
break;
case -1936688066:
if (str2.equals("PGN610")) {
c3 = '\b';
break;
}
c3 = 65535;
break;
case -1936688065:
if (str2.equals("PGN611")) {
c3 = '\t';
break;
}
c3 = 65535;
break;
case -1931988508:
if (str2.equals("AquaPowerM")) {
c3 = '\n';
break;
}
c3 = 65535;
break;
case -1885099851:
if (str2.equals("RAIJIN")) {
c3 = 11;
break;
}
c3 = 65535;
break;
case -1696512866:
if (str2.equals("XT1663")) {
c3 = '\f';
break;
}
c3 = 65535;
break;
case -1680025915:
if (str2.equals("ComioS1")) {
c3 = '\r';
break;
}
c3 = 65535;
break;
case -1615810839:
if (str2.equals("Phantom6")) {
c3 = 14;
break;
}
c3 = 65535;
break;
case -1600724499:
if (str2.equals("pacificrim")) {
c3 = 15;
break;
}
c3 = 65535;
break;
case -1554255044:
if (str2.equals("vernee_M5")) {
c3 = 16;
break;
}
c3 = 65535;
break;
case -1481772737:
if (str2.equals("panell_dl")) {
c3 = 17;
break;
}
c3 = 65535;
break;
case -1481772730:
if (str2.equals("panell_ds")) {
c3 = 18;
break;
}
c3 = 65535;
break;
case -1481772729:
if (str2.equals("panell_dt")) {
c3 = 19;
break;
}
c3 = 65535;
break;
case -1320080169:
if (str2.equals("GiONEE_GBL7319")) {
c3 = 20;
break;
}
c3 = 65535;
break;
case -1217592143:
if (str2.equals("BRAVIA_ATV2")) {
c3 = 21;
break;
}
c3 = 65535;
break;
case -1180384755:
if (str2.equals("iris60")) {
c3 = 22;
break;
}
c3 = 65535;
break;
case -1139198265:
if (str2.equals("Slate_Pro")) {
c3 = 23;
break;
}
c3 = 65535;
break;
case -1052835013:
if (str2.equals("namath")) {
c3 = 24;
break;
}
c3 = 65535;
break;
case -993250464:
if (str2.equals("A10-70F")) {
c3 = 25;
break;
}
c3 = 65535;
break;
case -993250458:
if (str2.equals("A10-70L")) {
c3 = 26;
break;
}
c3 = 65535;
break;
case -965403638:
if (str2.equals("s905x018")) {
c3 = 27;
break;
}
c3 = 65535;
break;
case -958336948:
if (str2.equals("ELUGA_Ray_X")) {
c3 = 28;
break;
}
c3 = 65535;
break;
case -879245230:
if (str2.equals("tcl_eu")) {
c3 = 29;
break;
}
c3 = 65535;
break;
case -842500323:
if (str2.equals("nicklaus_f")) {
c3 = 30;
break;
}
c3 = 65535;
break;
case -821392978:
if (str2.equals("A7000-a")) {
c3 = 31;
break;
}
c3 = 65535;
break;
case -797483286:
if (str2.equals("SVP-DTV15")) {
c3 = ' ';
break;
}
c3 = 65535;
break;
case -794946968:
if (str2.equals("watson")) {
c3 = '!';
break;
}
c3 = 65535;
break;
case -788334647:
if (str2.equals("whyred")) {
c3 = '\"';
break;
}
c3 = 65535;
break;
case -782144577:
if (str2.equals("OnePlus5T")) {
c3 = '#';
break;
}
c3 = 65535;
break;
case -575125681:
if (str2.equals("GiONEE_CBL7513")) {
c3 = '$';
break;
}
c3 = 65535;
break;
case -521118391:
if (str2.equals("GIONEE_GBL7360")) {
c3 = '%';
break;
}
c3 = 65535;
break;
case -430914369:
if (str2.equals("Pixi4-7_3G")) {
c3 = '&';
break;
}
c3 = 65535;
break;
case -290434366:
if (str2.equals("taido_row")) {
c3 = '\'';
break;
}
c3 = 65535;
break;
case -282781963:
if (str2.equals("BLACK-1X")) {
c3 = '(';
break;
}
c3 = 65535;
break;
case -277133239:
if (str2.equals("Z12_PRO")) {
c3 = ')';
break;
}
c3 = 65535;
break;
case -173639913:
if (str2.equals("ELUGA_A3_Pro")) {
c3 = '*';
break;
}
c3 = 65535;
break;
case -56598463:
if (str2.equals("woods_fn")) {
c3 = '+';
break;
}
c3 = 65535;
break;
case 2126:
if (str2.equals("C1")) {
c3 = ',';
break;
}
c3 = 65535;
break;
case 2564:
if (str2.equals("Q5")) {
c3 = '-';
break;
}
c3 = 65535;
break;
case 2715:
if (str2.equals("V1")) {
c3 = '.';
break;
}
c3 = 65535;
break;
case 2719:
if (str2.equals("V5")) {
c3 = '/';
break;
}
c3 = 65535;
break;
case 3091:
if (str2.equals("b5")) {
c3 = '0';
break;
}
c3 = 65535;
break;
case 3483:
if (str2.equals("mh")) {
c3 = '1';
break;
}
c3 = 65535;
break;
case 73405:
if (str2.equals("JGZ")) {
c3 = '2';
break;
}
c3 = 65535;
break;
case 75537:
if (str2.equals("M04")) {
c3 = '3';
break;
}
c3 = 65535;
break;
case 75739:
if (str2.equals("M5c")) {
c3 = '4';
break;
}
c3 = 65535;
break;
case 76779:
if (str2.equals("MX6")) {
c3 = '5';
break;
}
c3 = 65535;
break;
case 78669:
if (str2.equals("P85")) {
c3 = '6';
break;
}
c3 = 65535;
break;
case 79305:
if (str2.equals("PLE")) {
c3 = '7';
break;
}
c3 = 65535;
break;
case 80618:
if (str2.equals("QX1")) {
c3 = '8';
break;
}
c3 = 65535;
break;
case 88274:
if (str2.equals("Z80")) {
c3 = '9';
break;
}
c3 = 65535;
break;
case 98846:
if (str2.equals("cv1")) {
c3 = ':';
break;
}
c3 = 65535;
break;
case 98848:
if (str2.equals("cv3")) {
c3 = ';';
break;
}
c3 = 65535;
break;
case 99329:
if (str2.equals("deb")) {
c3 = '<';
break;
}
c3 = 65535;
break;
case 101481:
if (str2.equals("flo")) {
c3 = '=';
break;
}
c3 = 65535;
break;
case 1513190:
if (str2.equals("1601")) {
c3 = '>';
break;
}
c3 = 65535;
break;
case 1514184:
if (str2.equals("1713")) {
c3 = '?';
break;
}
c3 = 65535;
break;
case 1514185:
if (str2.equals("1714")) {
c3 = '@';
break;
}
c3 = 65535;
break;
case 2133089:
if (str2.equals("F01H")) {
c3 = 'A';
break;
}
c3 = 65535;
break;
case 2133091:
if (str2.equals("F01J")) {
c3 = 'B';
break;
}
c3 = 65535;
break;
case 2133120:
if (str2.equals("F02H")) {
c3 = 'C';
break;
}
c3 = 65535;
break;
case 2133151:
if (str2.equals("F03H")) {
c3 = 'D';
break;
}
c3 = 65535;
break;
case 2133182:
if (str2.equals("F04H")) {
c3 = 'E';
break;
}
c3 = 65535;
break;
case 2133184:
if (str2.equals("F04J")) {
c3 = 'F';
break;
}
c3 = 65535;
break;
case 2436959:
if (str2.equals("P681")) {
c3 = 'G';
break;
}
c3 = 65535;
break;
case 2463773:
if (str2.equals("Q350")) {
c3 = 'H';
break;
}
c3 = 65535;
break;
case 2464648:
if (str2.equals("Q427")) {
c3 = 'I';
break;
}
c3 = 65535;
break;
case 2689555:
if (str2.equals("XE2X")) {
c3 = 'J';
break;
}
c3 = 65535;
break;
case 3154429:
if (str2.equals("fugu")) {
c3 = 'K';
break;
}
c3 = 65535;
break;
case 3284551:
if (str2.equals("kate")) {
c3 = 'L';
break;
}
c3 = 65535;
break;
case 3351335:
if (str2.equals("mido")) {
c3 = 'M';
break;
}
c3 = 65535;
break;
case 3386211:
if (str2.equals("p212")) {
c3 = 'N';
break;
}
c3 = 65535;
break;
case 41325051:
if (str2.equals("MEIZU_M5")) {
c3 = 'O';
break;
}
c3 = 65535;
break;
case 51349633:
if (str2.equals("601LV")) {
c3 = 'P';
break;
}
c3 = 65535;
break;
case 51350594:
if (str2.equals("602LV")) {
c3 = 'Q';
break;
}
c3 = 65535;
break;
case 55178625:
if (str2.equals("Aura_Note_2")) {
c3 = 'R';
break;
}
c3 = 65535;
break;
case 61542055:
if (str2.equals("A1601")) {
c3 = 'S';
break;
}
c3 = 65535;
break;
case 65355429:
if (str2.equals("E5643")) {
c3 = 'T';
break;
}
c3 = 65535;
break;
case 66214468:
if (str2.equals("F3111")) {
c3 = 'U';
break;
}
c3 = 65535;
break;
case 66214470:
if (str2.equals("F3113")) {
c3 = 'V';
break;
}
c3 = 65535;
break;
case 66214473:
if (str2.equals("F3116")) {
c3 = 'W';
break;
}
c3 = 65535;
break;
case 66215429:
if (str2.equals("F3211")) {
c3 = 'X';
break;
}
c3 = 65535;
break;
case 66215431:
if (str2.equals("F3213")) {
c3 = 'Y';
break;
}
c3 = 65535;
break;
case 66215433:
if (str2.equals("F3215")) {
c3 = 'Z';
break;
}
c3 = 65535;
break;
case 66216390:
if (str2.equals("F3311")) {
c3 = '[';
break;
}
c3 = 65535;
break;
case 76402249:
if (str2.equals("PRO7S")) {
c3 = '\\';
break;
}
c3 = 65535;
break;
case 76404105:
if (str2.equals("Q4260")) {
c3 = ']';
break;
}
c3 = 65535;
break;
case 76404911:
if (str2.equals("Q4310")) {
c3 = '^';
break;
}
c3 = 65535;
break;
case 80963634:
if (str2.equals("V23GB")) {
c3 = '_';
break;
}
c3 = 65535;
break;
case 82882791:
if (str2.equals("X3_HK")) {
c3 = '`';
break;
}
c3 = 65535;
break;
case 98715550:
if (str2.equals("i9031")) {
c3 = 'a';
break;
}
c3 = 65535;
break;
case 101370885:
if (str2.equals("l5460")) {
c3 = 'b';
break;
}
c3 = 65535;
break;
case 102844228:
if (str2.equals("le_x6")) {
c3 = 'c';
break;
}
c3 = 65535;
break;
case 165221241:
if (str2.equals("A2016a40")) {
c3 = 'd';
break;
}
c3 = 65535;
break;
case 182191441:
if (str2.equals("CPY83_I00")) {
c3 = 'e';
break;
}
c3 = 65535;
break;
case 245388979:
if (str2.equals("marino_f")) {
c3 = 'f';
break;
}
c3 = 65535;
break;
case 287431619:
if (str2.equals("griffin")) {
c3 = 'g';
break;
}
c3 = 65535;
break;
case 307593612:
if (str2.equals("A7010a48")) {
c3 = 'h';
break;
}
c3 = 65535;
break;
case 308517133:
if (str2.equals("A7020a48")) {
c3 = 'i';
break;
}
c3 = 65535;
break;
case 316215098:
if (str2.equals("TB3-730F")) {
c3 = 'j';
break;
}
c3 = 65535;
break;
case 316215116:
if (str2.equals("TB3-730X")) {
c3 = 'k';
break;
}
c3 = 65535;
break;
case 316246811:
if (str2.equals("TB3-850F")) {
c3 = 'l';
break;
}
c3 = 65535;
break;
case 316246818:
if (str2.equals("TB3-850M")) {
c3 = 'm';
break;
}
c3 = 65535;
break;
case 407160593:
if (str2.equals("Pixi5-10_4G")) {
c3 = 'n';
break;
}
c3 = 65535;
break;
case 507412548:
if (str2.equals("QM16XE_U")) {
c3 = 'o';
break;
}
c3 = 65535;
break;
case 793982701:
if (str2.equals("GIONEE_WBL5708")) {
c3 = 'p';
break;
}
c3 = 65535;
break;
case 794038622:
if (str2.equals("GIONEE_WBL7365")) {
c3 = 'q';
break;
}
c3 = 65535;
break;
case 794040393:
if (str2.equals("GIONEE_WBL7519")) {
c3 = 'r';
break;
}
c3 = 65535;
break;
case 835649806:
if (str2.equals("manning")) {
c3 = 's';
break;
}
c3 = 65535;
break;
case 917340916:
if (str2.equals("A7000plus")) {
c3 = 't';
break;
}
c3 = 65535;
break;
case 958008161:
if (str2.equals("j2xlteins")) {
c3 = 'u';
break;
}
c3 = 65535;
break;
case 1060579533:
if (str2.equals("panell_d")) {
c3 = 'v';
break;
}
c3 = 65535;
break;
case 1150207623:
if (str2.equals("LS-5017")) {
c3 = 'w';
break;
}
c3 = 65535;
break;
case 1176899427:
if (str2.equals("itel_S41")) {
c3 = 'x';
break;
}
c3 = 65535;
break;
case 1280332038:
if (str2.equals("hwALE-H")) {
c3 = 'y';
break;
}
c3 = 65535;
break;
case 1306947716:
if (str2.equals("EverStar_S")) {
c3 = 'z';
break;
}
c3 = 65535;
break;
case 1349174697:
if (str2.equals("htc_e56ml_dtul")) {
c3 = '{';
break;
}
c3 = 65535;
break;
case 1522194893:
if (str2.equals("woods_f")) {
c3 = '|';
break;
}
c3 = 65535;
break;
case 1691543273:
if (str2.equals("CPH1609")) {
c3 = '}';
break;
}
c3 = 65535;
break;
case 1691544261:
if (str2.equals("CPH1715")) {
c3 = '~';
break;
}
c3 = 65535;
break;
case 1709443163:
if (str2.equals("iball8735_9806")) {
c3 = 127;
break;
}
c3 = 65535;
break;
case 1865889110:
if (str2.equals("santoni")) {
c3 = 128;
break;
}
c3 = 65535;
break;
case 1906253259:
if (str2.equals("PB2-670M")) {
c3 = 129;
break;
}
c3 = 65535;
break;
case 1977196784:
if (str2.equals("Infinix-X572")) {
c3 = 130;
break;
}
c3 = 65535;
break;
case 2006372676:
if (str2.equals("BRAVIA_ATV3_4K")) {
c3 = 131;
break;
}
c3 = 65535;
break;
case 2019281702:
if (str2.equals("DM-01K")) {
c3 = 132;
break;
}
c3 = 65535;
break;
case 2029784656:
if (str2.equals("HWBLN-H")) {
c3 = 133;
break;
}
c3 = 65535;
break;
case 2030379515:
if (str2.equals("HWCAM-H")) {
c3 = 134;
break;
}
c3 = 65535;
break;
case 2033393791:
if (str2.equals("ASUS_X00AD_2")) {
c3 = 135;
break;
}
c3 = 65535;
break;
case 2047190025:
if (str2.equals("ELUGA_Note")) {
c3 = 136;
break;
}
c3 = 65535;
break;
case 2047252157:
if (str2.equals("ELUGA_Prim")) {
c3 = 137;
break;
}
c3 = 65535;
break;
case 2048319463:
if (str2.equals("HWVNS-H")) {
c3 = 138;
break;
}
c3 = 65535;
break;
case 2048855701:
if (str2.equals("HWWAS-H")) {
c3 = 139;
break;
}
c3 = 65535;
break;
default:
c3 = 65535;
break;
}
switch (c3) {
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case '\b':
case '\t':
case '\n':
case 11:
case '\f':
case '\r':
case 14:
case 15:
case 16:
case 17:
case 18:
case 19:
case 20:
case 21:
case 22:
case 23:
case 24:
case 25:
case 26:
case 27:
case 28:
case 29:
case 30:
case 31:
case ' ':
case '!':
case '\"':
case '#':
case '$':
case '%':
case '&':
case '\'':
case '(':
case ')':
case '*':
case '+':
case ',':
case '-':
case '.':
case '/':
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
case ':':
case ';':
case '<':
case '=':
case '>':
case '?':
case '@':
case 'A':
case 'B':
case 'C':
case 'D':
case 'E':
case 'F':
case 'G':
case 'H':
case 'I':
case 'J':
case 'K':
case 'L':
case 'M':
case 'N':
case 'O':
case 'P':
case 'Q':
case 'R':
case 'S':
case 'T':
case 'U':
case 'V':
case 'W':
case 'X':
case 'Y':
case 'Z':
case '[':
case '\\':
case ']':
case '^':
case '_':
case '`':
case 'a':
case 'b':
case 'c':
case 'd':
case 'e':
case 'f':
case 'g':
case 'h':
case 'i':
case 'j':
case 'k':
case 'l':
case 'm':
case 'n':
case 'o':
case 'p':
case 'q':
case 'r':
case 's':
case 't':
case 'u':
case 'v':
case 'w':
case 'x':
case 'y':
case 'z':
case '{':
case '|':
case '}':
case '~':
case 127:
case 128:
case 129:
case 130:
case 131:
case 132:
case 133:
case 134:
case 135:
case 136:
case 137:
case 138:
case 139:
break;
default:
String str3 = f0.d;
str3.hashCode();
switch (str3.hashCode()) {
case -594534941:
if (str3.equals("JSN-L21")) {
c4 = 0;
break;
}
c4 = 65535;
break;
case 2006354:
if (str3.equals("AFTA")) {
c4 = 1;
break;
}
c4 = 65535;
break;
case 2006367:
break;
default:
c4 = 65535;
break;
}
switch (c4) {
}
}
return true;
}
return false;
}
/* JADX INFO: Can't fix incorrect switch cases order, some code will duplicate */
public static int G0(s sVar, String str, int i, int i2) {
char c2;
int i3;
if (!(i == -1 || i2 == -1)) {
str.hashCode();
int i4 = 4;
switch (str.hashCode()) {
case -1851077871:
if (str.equals("video/dolby-vision")) {
c2 = 0;
break;
}
c2 = 65535;
break;
case -1664118616:
if (str.equals("video/3gpp")) {
c2 = 1;
break;
}
c2 = 65535;
break;
case -1662541442:
if (str.equals("video/hevc")) {
c2 = 2;
break;
}
c2 = 65535;
break;
case 1187890754:
if (str.equals("video/mp4v-es")) {
c2 = 3;
break;
}
c2 = 65535;
break;
case 1331836730:
if (str.equals("video/avc")) {
c2 = 4;
break;
}
c2 = 65535;
break;
case 1599127256:
if (str.equals("video/x-vnd.on2.vp8")) {
c2 = 5;
break;
}
c2 = 65535;
break;
case 1599127257:
if (str.equals("video/x-vnd.on2.vp9")) {
c2 = 6;
break;
}
c2 = 65535;
break;
default:
c2 = 65535;
break;
}
switch (c2) {
case 0:
case 4:
String str2 = f0.d;
if (!"BRAVIA 4K 2015".equals(str2) && (!"Amazon".equals(f0.f899c) || (!"KFSOWI".equals(str2) && (!"AFTS".equals(str2) || !sVar.f)))) {
i3 = f0.f(i2, 16) * f0.f(i, 16) * 16 * 16;
i4 = 2;
break;
}
case 1:
case 3:
case 5:
i3 = i * i2;
i4 = 2;
break;
case 2:
case 6:
i3 = i * i2;
break;
default:
return -1;
}
return (i3 * 3) / (i4 * 2);
}
return -1;
}
public static List<s> H0(t tVar, Format format, boolean z2, boolean z3) throws MediaCodecUtil.DecoderQueryException {
Pair<Integer, Integer> c2;
String str = format.t;
if (str == null) {
return Collections.emptyList();
}
List<s> a2 = tVar.a(str, z2, z3);
Pattern pattern = MediaCodecUtil.a;
ArrayList arrayList = new ArrayList(a2);
MediaCodecUtil.j(arrayList, new g(format));
if ("video/dolby-vision".equals(str) && (c2 = MediaCodecUtil.c(format)) != null) {
int intValue = ((Integer) c2.first).intValue();
if (intValue == 16 || intValue == 256) {
arrayList.addAll(tVar.a("video/hevc", z2, z3));
} else if (intValue == 512) {
arrayList.addAll(tVar.a("video/avc", z2, z3));
}
}
return Collections.unmodifiableList(arrayList);
}
public static int I0(s sVar, Format format) {
if (format.u == -1) {
return G0(sVar, format.t, format.f2195y, format.f2196z);
}
int size = format.v.size();
int i = 0;
for (int i2 = 0; i2 < size; i2++) {
i += format.v.get(i2).length;
}
return format.u + i;
}
public static boolean J0(long j) {
return j < -30000;
}
@Override // com.google.android.exoplayer2.mediacodec.MediaCodecRenderer, c.i.a.c.g0
public void B() {
D0();
C0();
this.d1 = false;
t tVar = this.T0;
if (tVar.b != null) {
t.a aVar = tVar.d;
if (aVar != null) {
aVar.a.unregisterDisplayListener(aVar);
}
t.b bVar = tVar.f919c;
Objects.requireNonNull(bVar);
bVar.k.sendEmptyMessage(2);
}
this.C1 = null;
try {
super.B();
w.a aVar2 = this.U0;
d dVar = this.L0;
Objects.requireNonNull(aVar2);
synchronized (dVar) {
}
Handler handler = aVar2.a;
if (handler != null) {
handler.post(new a(aVar2, dVar));
}
} catch (Throwable th) {
w.a aVar3 = this.U0;
d dVar2 = this.L0;
Objects.requireNonNull(aVar3);
synchronized (dVar2) {
Handler handler2 = aVar3.a;
if (handler2 != null) {
handler2.post(new a(aVar3, dVar2));
}
throw th;
}
}
}
@Override // c.i.a.c.g0
public void C(boolean z2, boolean z3) throws ExoPlaybackException {
this.L0 = new d();
m1 m1Var = this.k;
Objects.requireNonNull(m1Var);
boolean z4 = m1Var.b;
AnimatableValueParser.D(!z4 || this.B1 != 0);
if (this.A1 != z4) {
this.A1 = z4;
n0();
}
w.a aVar = this.U0;
d dVar = this.L0;
Handler handler = aVar.a;
if (handler != null) {
handler.post(new c(aVar, dVar));
}
t tVar = this.T0;
if (tVar.b != null) {
t.b bVar = tVar.f919c;
Objects.requireNonNull(bVar);
bVar.k.sendEmptyMessage(1);
t.a aVar2 = tVar.d;
if (aVar2 != null) {
aVar2.a.registerDisplayListener(aVar2, f0.j());
}
tVar.d();
}
this.g1 = z3;
this.h1 = false;
}
public final void C0() {
r rVar;
this.f1 = false;
if (f0.a >= 23 && this.A1 && (rVar = this.R) != null) {
this.C1 = new b(rVar);
}
}
@Override // com.google.android.exoplayer2.mediacodec.MediaCodecRenderer, c.i.a.c.g0
public void D(long j, boolean z2) throws ExoPlaybackException {
super.D(j, z2);
C0();
this.T0.b();
this.o1 = -9223372036854775807L;
this.i1 = -9223372036854775807L;
this.m1 = 0;
if (z2) {
S0();
} else {
this.j1 = -9223372036854775807L;
}
}
public final void D0() {
this.w1 = -1;
this.x1 = -1;
this.z1 = -1.0f;
this.y1 = -1;
}
/* JADX DEBUG: Multi-variable search result rejected for r4v0, resolved type: c.i.a.c.j2.n */
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARNING: Unknown variable types count: 1 */
@Override // com.google.android.exoplayer2.mediacodec.MediaCodecRenderer, c.i.a.c.g0
public void E() {
?? r0 = 0;
try {
N();
n0();
try {
} finally {
Surface surface = this.c1;
if (surface != null) {
if (this.b1 == surface) {
this.b1 = r0;
}
surface.release();
this.c1 = r0;
}
}
} finally {
t0(r0);
}
}
public boolean E0(String str) {
if (str.startsWith("OMX.google")) {
return false;
}
synchronized (n.class) {
if (!Q0) {
R0 = F0();
Q0 = true;
}
}
return R0;
}
@Override // c.i.a.c.g0
public void F() {
this.l1 = 0;
this.k1 = SystemClock.elapsedRealtime();
this.p1 = SystemClock.elapsedRealtime() * 1000;
this.q1 = 0;
this.r1 = 0;
t tVar = this.T0;
tVar.e = true;
tVar.b();
tVar.f(false);
}
@Override // c.i.a.c.g0
public void G() {
this.j1 = -9223372036854775807L;
K0();
int i = this.r1;
if (i != 0) {
w.a aVar = this.U0;
long j = this.q1;
Handler handler = aVar.a;
if (handler != null) {
handler.post(new i(aVar, j, i));
}
this.q1 = 0;
this.r1 = 0;
}
t tVar = this.T0;
tVar.e = false;
tVar.a();
}
@Override // com.google.android.exoplayer2.mediacodec.MediaCodecRenderer
public e K(s sVar, Format format, Format format2) {
e c2 = sVar.c(format, format2);
int i = c2.e;
int i2 = format2.f2195y;
a aVar = this.Y0;
if (i2 > aVar.a || format2.f2196z > aVar.b) {
i |= 256;
}
if (I0(sVar, format2) > this.Y0.f917c) {
i |= 64;
}
return new e(sVar.a, format, format2, i != 0 ? 0 : c2.d, i);
}
public final void K0() {
if (this.l1 > 0) {
long elapsedRealtime = SystemClock.elapsedRealtime();
long j = elapsedRealtime - this.k1;
w.a aVar = this.U0;
int i = this.l1;
Handler handler = aVar.a;
if (handler != null) {
handler.post(new e(aVar, i, j));
}
this.l1 = 0;
this.k1 = elapsedRealtime;
}
}
/* JADX WARNING: Code restructure failed: missing block: B:70:0x0146, code lost:
r21 = r5;
*/
/* JADX WARNING: Removed duplicated region for block: B:100:0x0234 */
/* JADX WARNING: Removed duplicated region for block: B:101:0x0241 */
/* JADX WARNING: Removed duplicated region for block: B:103:0x0244 */
/* JADX WARNING: Removed duplicated region for block: B:106:0x0252 */
/* JADX WARNING: Removed duplicated region for block: B:74:0x014c */
/* JADX WARNING: Removed duplicated region for block: B:79:0x018c */
/* JADX WARNING: Removed duplicated region for block: B:80:0x018f */
/* JADX WARNING: Removed duplicated region for block: B:83:0x01b7 */
/* JADX WARNING: Removed duplicated region for block: B:86:0x01c7 */
/* JADX WARNING: Removed duplicated region for block: B:96:0x0221 */
@Override // com.google.android.exoplayer2.mediacodec.MediaCodecRenderer
public void L(s sVar, r rVar, Format format, @Nullable MediaCrypto mediaCrypto, float f) {
String str;
a aVar;
boolean z2;
int i;
MediaFormat mediaFormat;
float f2;
ColorInfo colorInfo;
int i2;
boolean z3;
Pair<Integer, Integer> c2;
Point point;
MediaCodecInfo.VideoCapabilities videoCapabilities;
Format[] formatArr;
int G0;
String str2 = sVar.f765c;
Format[] formatArr2 = this.o;
Objects.requireNonNull(formatArr2);
int i3 = format.f2195y;
int i4 = format.f2196z;
int I0 = I0(sVar, format);
if (formatArr2.length == 1) {
if (!(I0 == -1 || (G0 = G0(sVar, format.t, format.f2195y, format.f2196z)) == -1)) {
I0 = Math.min((int) (((float) I0) * 1.5f), G0);
}
aVar = new a(i3, i4, I0);
str = str2;
} else {
int length = formatArr2.length;
int i5 = 0;
boolean z4 = false;
while (i5 < length) {
Format format2 = formatArr2[i5];
if (format.F != null && format2.F == null) {
Format.b a2 = format2.a();
a2.w = format.F;
format2 = a2.a();
}
if (sVar.c(format, format2).d != 0) {
int i6 = format2.f2195y;
formatArr = formatArr2;
z4 |= i6 == -1 || format2.f2196z == -1;
int max = Math.max(i3, i6);
int max2 = Math.max(i4, format2.f2196z);
I0 = Math.max(I0, I0(sVar, format2));
i4 = max2;
i3 = max;
} else {
formatArr = formatArr2;
}
i5++;
formatArr2 = formatArr;
}
if (z4) {
Log.w("MediaCodecVideoRenderer", "Resolutions unknown. Codec max resolution: " + i3 + "x" + i4);
int i7 = format.f2196z;
int i8 = format.f2195y;
boolean z5 = i7 > i8;
int i9 = z5 ? i7 : i8;
if (z5) {
i7 = i8;
}
float f3 = ((float) i7) / ((float) i9);
int[] iArr = P0;
int length2 = iArr.length;
int i10 = 0;
while (true) {
Point point2 = null;
if (i10 >= length2) {
break;
}
int i11 = iArr[i10];
int i12 = (int) (((float) i11) * f3);
if (i11 <= i9 || i12 <= i7) {
break;
}
if (f0.a >= 21) {
int i13 = z5 ? i12 : i11;
if (!z5) {
i11 = i12;
}
MediaCodecInfo.CodecCapabilities codecCapabilities = sVar.d;
if (!(codecCapabilities == null || (videoCapabilities = codecCapabilities.getVideoCapabilities()) == null)) {
point2 = s.a(videoCapabilities, i13, i11);
}
point = point2;
str = str2;
if (sVar.g(point.x, point.y, (double) format.A)) {
break;
}
} else {
str = str2;
try {
int f4 = f0.f(i11, 16) * 16;
int f5 = f0.f(i12, 16) * 16;
if (f4 * f5 <= MediaCodecUtil.i()) {
int i14 = z5 ? f5 : f4;
if (!z5) {
f4 = f5;
}
point = new Point(i14, f4);
}
} catch (MediaCodecUtil.DecoderQueryException unused) {
point = null;
if (point != null) {
}
aVar = new a(i3, i4, I0);
this.Y0 = aVar;
z2 = this.X0;
if (!this.A1) {
}
mediaFormat = new MediaFormat();
mediaFormat.setString("mime", str);
mediaFormat.setInteger("width", format.f2195y);
mediaFormat.setInteger("height", format.f2196z);
AnimatableValueParser.w2(mediaFormat, format.v);
f2 = format.A;
if (f2 != -1.0f) {
}
AnimatableValueParser.J1(mediaFormat, "rotation-degrees", format.B);
colorInfo = format.F;
if (colorInfo != null) {
}
AnimatableValueParser.J1(mediaFormat, "profile", ((Integer) c2.first).intValue());
mediaFormat.setInteger("max-width", aVar.a);
mediaFormat.setInteger("max-height", aVar.b);
AnimatableValueParser.J1(mediaFormat, "max-input-size", aVar.f917c);
i2 = f0.a;
if (i2 >= 23) {
}
if (!z2) {
}
if (i != 0) {
}
if (this.b1 == null) {
}
rVar.configure(mediaFormat, this.b1, mediaCrypto, 0);
if (i2 >= 23) {
return;
}
}
}
i10++;
length2 = length2;
iArr = iArr;
i7 = i7;
f3 = f3;
str2 = str;
}
if (point != null) {
i3 = Math.max(i3, point.x);
i4 = Math.max(i4, point.y);
I0 = Math.max(I0, G0(sVar, format.t, i3, i4));
Log.w("MediaCodecVideoRenderer", "Codec max resolution adjusted to: " + i3 + "x" + i4);
}
} else {
str = str2;
}
aVar = new a(i3, i4, I0);
}
this.Y0 = aVar;
z2 = this.X0;
i = !this.A1 ? this.B1 : 0;
mediaFormat = new MediaFormat();
mediaFormat.setString("mime", str);
mediaFormat.setInteger("width", format.f2195y);
mediaFormat.setInteger("height", format.f2196z);
AnimatableValueParser.w2(mediaFormat, format.v);
f2 = format.A;
if (f2 != -1.0f) {
mediaFormat.setFloat("frame-rate", f2);
}
AnimatableValueParser.J1(mediaFormat, "rotation-degrees", format.B);
colorInfo = format.F;
if (colorInfo != null) {
AnimatableValueParser.J1(mediaFormat, "color-transfer", colorInfo.k);
AnimatableValueParser.J1(mediaFormat, "color-standard", colorInfo.i);
AnimatableValueParser.J1(mediaFormat, "color-range", colorInfo.j);
byte[] bArr = colorInfo.l;
if (bArr != null) {
mediaFormat.setByteBuffer("hdr-static-info", ByteBuffer.wrap(bArr));
}
}
if ("video/dolby-vision".equals(format.t) && (c2 = MediaCodecUtil.c(format)) != null) {
AnimatableValueParser.J1(mediaFormat, "profile", ((Integer) c2.first).intValue());
}
mediaFormat.setInteger("max-width", aVar.a);
mediaFormat.setInteger("max-height", aVar.b);
AnimatableValueParser.J1(mediaFormat, "max-input-size", aVar.f917c);
i2 = f0.a;
if (i2 >= 23) {
mediaFormat.setInteger("priority", 0);
if (f != -1.0f) {
mediaFormat.setFloat("operating-rate", f);
}
}
if (!z2) {
z3 = true;
mediaFormat.setInteger("no-post-process", 1);
mediaFormat.setInteger("auto-frc", 0);
} else {
z3 = true;
}
if (i != 0) {
mediaFormat.setFeatureEnabled("tunneled-playback", z3);
mediaFormat.setInteger("audio-session-id", i);
}
if (this.b1 == null) {
if (T0(sVar)) {
if (this.c1 == null) {
this.c1 = DummySurface.c(this.S0, sVar.f);
}
this.b1 = this.c1;
} else {
throw new IllegalStateException();
}
}
rVar.configure(mediaFormat, this.b1, mediaCrypto, 0);
if (i2 >= 23 && this.A1) {
this.C1 = new b(rVar);
}
}
public void L0() {
this.h1 = true;
if (!this.f1) {
this.f1 = true;
w.a aVar = this.U0;
Surface surface = this.b1;
Handler handler = aVar.a;
if (handler != null) {
handler.post(new d(aVar, surface));
}
this.d1 = true;
}
}
@Override // com.google.android.exoplayer2.mediacodec.MediaCodecRenderer
public MediaCodecDecoderException M(Throwable th, @Nullable s sVar) {
return new MediaCodecVideoDecoderException(th, sVar, this.b1);
}
public final void M0() {
int i = this.s1;
if (i != -1 || this.t1 != -1) {
if (this.w1 != i || this.x1 != this.t1 || this.y1 != this.u1 || this.z1 != this.v1) {
this.U0.a(i, this.t1, this.u1, this.v1);
this.w1 = this.s1;
this.x1 = this.t1;
this.y1 = this.u1;
this.z1 = this.v1;
}
}
}
public final void N0() {
int i = this.w1;
if (i != -1 || this.x1 != -1) {
this.U0.a(i, this.x1, this.y1, this.z1);
}
}
public final void O0(long j, long j2, Format format) {
s sVar = this.D1;
if (sVar != null) {
sVar.c(j, j2, format, this.T);
}
}
public void P0(long j) throws ExoPlaybackException {
B0(j);
M0();
this.L0.e++;
L0();
super.h0(j);
if (!this.A1) {
this.n1--;
}
}
public void Q0(r rVar, int i) {
M0();
AnimatableValueParser.g("releaseOutputBuffer");
rVar.releaseOutputBuffer(i, true);
AnimatableValueParser.f0();
this.p1 = SystemClock.elapsedRealtime() * 1000;
this.L0.e++;
this.m1 = 0;
L0();
}
@RequiresApi(21)
public void R0(r rVar, int i, long j) {
M0();
AnimatableValueParser.g("releaseOutputBuffer");
rVar.b(i, j);
AnimatableValueParser.f0();
this.p1 = SystemClock.elapsedRealtime() * 1000;
this.L0.e++;
this.m1 = 0;
L0();
}
public final void S0() {
this.j1 = this.V0 > 0 ? SystemClock.elapsedRealtime() + this.V0 : -9223372036854775807L;
}
public final boolean T0(s sVar) {
return f0.a >= 23 && !this.A1 && !E0(sVar.a) && (!sVar.f || DummySurface.b(this.S0));
}
public void U0(r rVar, int i) {
AnimatableValueParser.g("skipVideoBuffer");
rVar.releaseOutputBuffer(i, false);
AnimatableValueParser.f0();
this.L0.f++;
}
@Override // com.google.android.exoplayer2.mediacodec.MediaCodecRenderer
public boolean V() {
return this.A1 && f0.a < 23;
}
public void V0(int i) {
d dVar = this.L0;
dVar.g += i;
this.l1 += i;
int i2 = this.m1 + i;
this.m1 = i2;
dVar.h = Math.max(i2, dVar.h);
int i3 = this.W0;
if (i3 > 0 && this.l1 >= i3) {
K0();
}
}
@Override // com.google.android.exoplayer2.mediacodec.MediaCodecRenderer
public float W(float f, Format format, Format[] formatArr) {
float f2 = -1.0f;
for (Format format2 : formatArr) {
float f3 = format2.A;
if (f3 != -1.0f) {
f2 = Math.max(f2, f3);
}
}
if (f2 == -1.0f) {
return -1.0f;
}
return f2 * f;
}
public void W0(long j) {
d dVar = this.L0;
dVar.j += j;
dVar.k++;
this.q1 += j;
this.r1++;
}
@Override // com.google.android.exoplayer2.mediacodec.MediaCodecRenderer
public List<s> X(c.i.a.c.b2.t tVar, Format format, boolean z2) throws MediaCodecUtil.DecoderQueryException {
return H0(tVar, format, z2, this.A1);
}
@Override // com.google.android.exoplayer2.mediacodec.MediaCodecRenderer
@TargetApi(29)
public void Z(DecoderInputBuffer decoderInputBuffer) throws ExoPlaybackException {
if (this.a1) {
ByteBuffer byteBuffer = decoderInputBuffer.n;
Objects.requireNonNull(byteBuffer);
if (byteBuffer.remaining() >= 7) {
byte b2 = byteBuffer.get();
short s2 = byteBuffer.getShort();
short s3 = byteBuffer.getShort();
byte b3 = byteBuffer.get();
byte b4 = byteBuffer.get();
byteBuffer.position(0);
if (b2 == -75 && s2 == 60 && s3 == 1 && b3 == 4 && b4 == 0) {
byte[] bArr = new byte[byteBuffer.remaining()];
byteBuffer.get(bArr);
byteBuffer.position(0);
r rVar = this.R;
Bundle bundle = new Bundle();
bundle.putByteArray("hdr10-plus-info", bArr);
rVar.setParameters(bundle);
}
}
}
}
@Override // com.google.android.exoplayer2.mediacodec.MediaCodecRenderer, c.i.a.c.k1
public boolean d() {
Surface surface;
if (super.d() && (this.f1 || (((surface = this.c1) != null && this.b1 == surface) || this.R == null || this.A1))) {
this.j1 = -9223372036854775807L;
return true;
} else if (this.j1 == -9223372036854775807L) {
return false;
} else {
if (SystemClock.elapsedRealtime() < this.j1) {
return true;
}
this.j1 = -9223372036854775807L;
return false;
}
}
@Override // com.google.android.exoplayer2.mediacodec.MediaCodecRenderer
public void d0(String str, long j, long j2) {
w.a aVar = this.U0;
Handler handler = aVar.a;
if (handler != null) {
handler.post(new f(aVar, str, j, j2));
}
this.Z0 = E0(str);
s sVar = this.Y;
Objects.requireNonNull(sVar);
boolean z2 = false;
if (f0.a >= 29 && "video/x-vnd.on2.vp9".equals(sVar.b)) {
MediaCodecInfo.CodecProfileLevel[] d = sVar.d();
int length = d.length;
int i = 0;
while (true) {
if (i >= length) {
break;
} else if (d[i].profile == 16384) {
z2 = true;
break;
} else {
i++;
}
}
}
this.a1 = z2;
}
@Override // com.google.android.exoplayer2.mediacodec.MediaCodecRenderer
public void e0(String str) {
w.a aVar = this.U0;
Handler handler = aVar.a;
if (handler != null) {
handler.post(new b(aVar, str));
}
}
@Override // com.google.android.exoplayer2.mediacodec.MediaCodecRenderer
@Nullable
public e f0(s0 s0Var) throws ExoPlaybackException {
e f02 = super.f0(s0Var);
w.a aVar = this.U0;
Format format = s0Var.b;
Handler handler = aVar.a;
if (handler != null) {
handler.post(new g(aVar, format, f02));
}
return f02;
}
@Override // com.google.android.exoplayer2.mediacodec.MediaCodecRenderer
public void g0(Format format, @Nullable MediaFormat mediaFormat) {
r rVar = this.R;
if (rVar != null) {
rVar.f(this.e1);
}
if (this.A1) {
this.s1 = format.f2195y;
this.t1 = format.f2196z;
} else {
Objects.requireNonNull(mediaFormat);
boolean z2 = mediaFormat.containsKey("crop-right") && mediaFormat.containsKey("crop-left") && mediaFormat.containsKey("crop-bottom") && mediaFormat.containsKey("crop-top");
this.s1 = z2 ? (mediaFormat.getInteger("crop-right") - mediaFormat.getInteger("crop-left")) + 1 : mediaFormat.getInteger("width");
this.t1 = z2 ? (mediaFormat.getInteger("crop-bottom") - mediaFormat.getInteger("crop-top")) + 1 : mediaFormat.getInteger("height");
}
float f = format.C;
this.v1 = f;
if (f0.a >= 21) {
int i = format.B;
if (i == 90 || i == 270) {
int i2 = this.s1;
this.s1 = this.t1;
this.t1 = i2;
this.v1 = 1.0f / f;
}
} else {
this.u1 = format.B;
}
t tVar = this.T0;
tVar.g = format.A;
l lVar = tVar.a;
lVar.a.c();
lVar.b.c();
lVar.f914c = false;
lVar.d = -9223372036854775807L;
lVar.e = 0;
tVar.e();
}
@Override // c.i.a.c.k1, c.i.a.c.l1
public String getName() {
return "MediaCodecVideoRenderer";
}
@Override // com.google.android.exoplayer2.mediacodec.MediaCodecRenderer
@CallSuper
public void h0(long j) {
super.h0(j);
if (!this.A1) {
this.n1--;
}
}
@Override // com.google.android.exoplayer2.mediacodec.MediaCodecRenderer
public void i0() {
C0();
}
@Override // com.google.android.exoplayer2.mediacodec.MediaCodecRenderer
@CallSuper
public void j0(DecoderInputBuffer decoderInputBuffer) throws ExoPlaybackException {
boolean z2 = this.A1;
if (!z2) {
this.n1++;
}
if (f0.a < 23 && z2) {
P0(decoderInputBuffer.m);
}
}
/* JADX WARNING: Code restructure failed: missing block: B:19:0x0075, code lost:
if ((r11 == 0 ? false : r13.g[(int) ((r11 - 1) % 15)]) != false) goto L_0x0077;
*/
/* JADX WARNING: Code restructure failed: missing block: B:72:0x012f, code lost:
if ((J0(r5) && r22 > 100000) != false) goto L_0x0131;
*/
/* JADX WARNING: Removed duplicated region for block: B:77:0x0138 */
/* JADX WARNING: Removed duplicated region for block: B:83:0x0157 */
@Override // com.google.android.exoplayer2.mediacodec.MediaCodecRenderer
public boolean l0(long j, long j2, @Nullable r rVar, @Nullable ByteBuffer byteBuffer, int i, int i2, int i3, long j3, boolean z2, boolean z3, Format format) throws ExoPlaybackException {
boolean z4;
long j4;
boolean z5;
boolean z6;
long j5;
long j6;
Objects.requireNonNull(rVar);
if (this.i1 == -9223372036854775807L) {
this.i1 = j;
}
if (j3 != this.o1) {
t tVar = this.T0;
long j7 = tVar.n;
if (j7 != -1) {
tVar.p = j7;
tVar.q = tVar.o;
}
tVar.m++;
l lVar = tVar.a;
long j8 = j3 * 1000;
lVar.a.b(j8);
if (lVar.a.a()) {
lVar.f914c = false;
} else if (lVar.d != -9223372036854775807L) {
if (lVar.f914c) {
l.a aVar = lVar.b;
long j9 = aVar.d;
}
lVar.b.c();
lVar.b.b(lVar.d);
lVar.f914c = true;
lVar.b.b(j8);
}
if (lVar.f914c && lVar.b.a()) {
l.a aVar2 = lVar.a;
lVar.a = lVar.b;
lVar.b = aVar2;
lVar.f914c = false;
}
lVar.d = j8;
lVar.e = lVar.a.a() ? 0 : lVar.e + 1;
tVar.e();
this.o1 = j3;
}
long j10 = this.N0;
long j11 = j3 - j10;
if (!z2 || z3) {
double d = (double) this.P;
boolean z7 = this.m == 2;
long elapsedRealtime = SystemClock.elapsedRealtime() * 1000;
long j12 = (long) (((double) (j3 - j)) / d);
if (z7) {
j12 -= elapsedRealtime - j2;
}
if (this.b1 != this.c1) {
long j13 = elapsedRealtime - this.p1;
boolean z8 = this.h1 ? !this.f1 : !(!z7 && !this.g1);
if (this.j1 == -9223372036854775807L && j >= j10) {
if (!z8) {
if (z7) {
}
}
z4 = true;
if (!z4) {
long nanoTime = System.nanoTime();
O0(j11, nanoTime, format);
if (f0.a >= 21) {
R0(rVar, i, nanoTime);
} else {
Q0(rVar, i);
}
W0(j12);
return true;
} else if (!z7 || j == this.i1) {
return false;
} else {
long nanoTime2 = System.nanoTime();
long j14 = (j12 * 1000) + nanoTime2;
t tVar2 = this.T0;
if (tVar2.p == -1 || !tVar2.a.a()) {
j4 = j11;
} else {
l lVar2 = tVar2.a;
if (lVar2.a()) {
l.a aVar3 = lVar2.a;
long j15 = aVar3.e;
if (j15 == 0) {
j6 = 0;
j4 = j11;
} else {
j4 = j11;
j6 = aVar3.f / j15;
}
} else {
j4 = j11;
j6 = -9223372036854775807L;
}
long j16 = tVar2.q + ((long) (((float) ((tVar2.m - tVar2.p) * j6)) / tVar2.j));
if (Math.abs(j14 - j16) <= 20000000) {
j14 = j16;
} else {
tVar2.b();
}
}
tVar2.n = tVar2.m;
tVar2.o = j14;
t.b bVar = tVar2.f919c;
if (!(bVar == null || tVar2.k == -9223372036854775807L)) {
long j17 = bVar.j;
if (j17 != -9223372036854775807L) {
long j18 = tVar2.k;
long j19 = (((j14 - j17) / j18) * j18) + j17;
if (j14 <= j19) {
j5 = j19 - j18;
} else {
j5 = j19;
j19 = j18 + j19;
}
if (j19 - j14 >= j14 - j5) {
j19 = j5;
}
j14 = j19 - tVar2.l;
}
}
long j20 = (j14 - nanoTime2) / 1000;
boolean z9 = this.j1 != -9223372036854775807L;
if (((j20 > -500000 ? 1 : (j20 == -500000 ? 0 : -1)) < 0) && !z3) {
c.i.a.c.d2.f0 f0Var = this.n;
Objects.requireNonNull(f0Var);
int c2 = f0Var.c(j - this.p);
if (c2 == 0) {
z6 = false;
} else {
d dVar = this.L0;
dVar.i++;
int i4 = this.n1 + c2;
if (z9) {
dVar.f += i4;
} else {
V0(i4);
}
if (T()) {
b0();
}
z6 = true;
}
if (z6) {
return false;
}
}
if (J0(j20) && !z3) {
if (z9) {
U0(rVar, i);
z5 = true;
} else {
AnimatableValueParser.g("dropVideoBuffer");
rVar.releaseOutputBuffer(i, false);
AnimatableValueParser.f0();
z5 = true;
V0(1);
}
W0(j20);
return z5;
} else if (f0.a >= 21) {
if (j20 >= 50000) {
return false;
}
O0(j4, j14, format);
R0(rVar, i, j14);
W0(j20);
return true;
} else if (j20 >= 30000) {
return false;
} else {
if (j20 > 11000) {
try {
Thread.sleep((j20 - 10000) / 1000);
} catch (InterruptedException unused) {
Thread.currentThread().interrupt();
return false;
}
}
O0(j4, j14, format);
Q0(rVar, i);
W0(j20);
return true;
}
}
}
z4 = false;
if (!z4) {
}
} else if (!J0(j12)) {
return false;
} else {
U0(rVar, i);
W0(j12);
return true;
}
} else {
U0(rVar, i);
return true;
}
}
@Override // com.google.android.exoplayer2.mediacodec.MediaCodecRenderer, c.i.a.c.g0, c.i.a.c.k1
public void n(float f, float f2) throws ExoPlaybackException {
super.n(f, f2);
t tVar = this.T0;
tVar.j = f;
tVar.b();
tVar.f(false);
}
@Override // com.google.android.exoplayer2.mediacodec.MediaCodecRenderer
@CallSuper
public void p0() {
super.p0();
this.n1 = 0;
}
@Override // c.i.a.c.g0, c.i.a.c.h1.b
public void r(int i, @Nullable Object obj) throws ExoPlaybackException {
int intValue;
if (i == 1) {
Surface surface = (Surface) obj;
if (surface == null) {
Surface surface2 = this.c1;
if (surface2 != null) {
surface = surface2;
} else {
s sVar = this.Y;
if (sVar != null && T0(sVar)) {
surface = DummySurface.c(this.S0, sVar.f);
this.c1 = surface;
}
}
}
if (this.b1 != surface) {
this.b1 = surface;
t tVar = this.T0;
Objects.requireNonNull(tVar);
Surface surface3 = surface instanceof DummySurface ? null : surface;
if (tVar.f != surface3) {
tVar.a();
tVar.f = surface3;
tVar.f(true);
}
this.d1 = false;
int i2 = this.m;
r rVar = this.R;
if (rVar != null) {
if (f0.a < 23 || surface == null || this.Z0) {
n0();
b0();
} else {
rVar.h(surface);
}
}
if (surface == null || surface == this.c1) {
D0();
C0();
return;
}
N0();
C0();
if (i2 == 2) {
S0();
}
} else if (surface != null && surface != this.c1) {
N0();
if (this.d1) {
w.a aVar = this.U0;
Surface surface4 = this.b1;
Handler handler = aVar.a;
if (handler != null) {
handler.post(new d(aVar, surface4));
}
}
}
} else if (i == 4) {
int intValue2 = ((Integer) obj).intValue();
this.e1 = intValue2;
r rVar2 = this.R;
if (rVar2 != null) {
rVar2.f(intValue2);
}
} else if (i == 6) {
this.D1 = (s) obj;
} else if (i == 102 && this.B1 != (intValue = ((Integer) obj).intValue())) {
this.B1 = intValue;
if (this.A1) {
n0();
}
}
}
@Override // com.google.android.exoplayer2.mediacodec.MediaCodecRenderer
public boolean v0(s sVar) {
return this.b1 != null || T0(sVar);
}
@Override // com.google.android.exoplayer2.mediacodec.MediaCodecRenderer
public int x0(c.i.a.c.b2.t tVar, Format format) throws MediaCodecUtil.DecoderQueryException {
int i = 0;
if (!c.i.a.c.i2.s.j(format.t)) {
return 0;
}
boolean z2 = format.w != null;
List<s> H0 = H0(tVar, format, z2, false);
if (z2 && H0.isEmpty()) {
H0 = H0(tVar, format, false, false);
}
if (H0.isEmpty()) {
return 1;
}
if (!MediaCodecRenderer.y0(format)) {
return 2;
}
s sVar = H0.get(0);
boolean e = sVar.e(format);
int i2 = sVar.f(format) ? 16 : 8;
if (e) {
List<s> H02 = H0(tVar, format, z2, true);
if (!H02.isEmpty()) {
s sVar2 = H02.get(0);
if (sVar2.e(format) && sVar2.f(format)) {
i = 32;
}
}
}
return (e ? 4 : 3) | i2 | i;
}
}