2021-08-09 22:50:52 +00:00
|
|
|
package c.f.j.p;
|
|
|
|
|
|
|
|
import c.f.d.g.g;
|
|
|
|
import c.f.d.g.i;
|
|
|
|
import c.f.j.d.f;
|
|
|
|
import c.f.j.j.e;
|
|
|
|
import c.f.j.p.c0;
|
|
|
|
import c.f.j.s.c;
|
|
|
|
import c.f.j.s.d;
|
|
|
|
import com.facebook.common.references.CloseableReference;
|
|
|
|
import com.facebook.imagepipeline.memory.MemoryPooledByteBufferOutputStream;
|
|
|
|
import com.facebook.imagepipeline.request.ImageRequest;
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.Objects;
|
|
|
|
import java.util.concurrent.Executor;
|
|
|
|
/* compiled from: ResizeAndRotateProducer */
|
|
|
|
public class b1 implements v0<e> {
|
|
|
|
public final Executor a;
|
|
|
|
public final g b;
|
|
|
|
|
|
|
|
/* renamed from: c reason: collision with root package name */
|
2021-08-19 17:35:23 +00:00
|
|
|
public final v0<e> f472c;
|
2021-08-09 22:50:52 +00:00
|
|
|
public final boolean d;
|
|
|
|
public final c e;
|
|
|
|
|
|
|
|
/* compiled from: ResizeAndRotateProducer */
|
|
|
|
public class a extends p<e, e> {
|
|
|
|
|
|
|
|
/* renamed from: c reason: collision with root package name */
|
2021-08-19 17:35:23 +00:00
|
|
|
public final boolean f473c;
|
2021-08-09 22:50:52 +00:00
|
|
|
public final c d;
|
|
|
|
public final w0 e;
|
|
|
|
public boolean f = false;
|
|
|
|
public final c0 g;
|
|
|
|
|
|
|
|
/* compiled from: ResizeAndRotateProducer */
|
|
|
|
/* renamed from: c.f.j.p.b1$a$a reason: collision with other inner class name */
|
2021-08-18 07:29:27 +00:00
|
|
|
public class C0066a implements c0.c {
|
|
|
|
public C0066a(b1 b1Var) {
|
2021-08-09 22:50:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override // c.f.j.p.c0.c
|
|
|
|
public void a(e eVar, int i) {
|
|
|
|
a aVar = a.this;
|
|
|
|
c cVar = aVar.d;
|
|
|
|
eVar.w();
|
2021-08-19 17:35:23 +00:00
|
|
|
c.f.j.s.b createImageTranscoder = cVar.createImageTranscoder(eVar.k, a.this.f473c);
|
2021-08-09 22:50:52 +00:00
|
|
|
Objects.requireNonNull(createImageTranscoder);
|
|
|
|
aVar.e.o().e(aVar.e, "ResizeAndRotateProducer");
|
|
|
|
ImageRequest e = aVar.e.e();
|
|
|
|
i a = b1.this.b.a();
|
|
|
|
try {
|
|
|
|
c.f.j.s.a c2 = createImageTranscoder.c(eVar, a, e.j, e.i, null, 85);
|
|
|
|
if (c2.a != 2) {
|
|
|
|
Map<String, String> n = aVar.n(eVar, e.i, c2, createImageTranscoder.a());
|
|
|
|
CloseableReference C = CloseableReference.C(((MemoryPooledByteBufferOutputStream) a).b());
|
|
|
|
try {
|
|
|
|
e eVar2 = new e(C);
|
|
|
|
eVar2.k = c.f.i.b.a;
|
|
|
|
try {
|
|
|
|
eVar2.p();
|
|
|
|
aVar.e.o().j(aVar.e, "ResizeAndRotateProducer", n);
|
|
|
|
if (c2.a != 1) {
|
|
|
|
i |= 16;
|
|
|
|
}
|
|
|
|
aVar.b.b(eVar2, i);
|
|
|
|
a.close();
|
|
|
|
} finally {
|
|
|
|
eVar2.close();
|
|
|
|
}
|
|
|
|
} finally {
|
|
|
|
if (C != null) {
|
|
|
|
C.close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
throw new RuntimeException("Error while transcoding the image");
|
|
|
|
}
|
|
|
|
} catch (Exception e2) {
|
|
|
|
aVar.e.o().k(aVar.e, "ResizeAndRotateProducer", e2, null);
|
|
|
|
if (b.e(i)) {
|
|
|
|
aVar.b.c(e2);
|
|
|
|
}
|
|
|
|
} catch (Throwable th) {
|
|
|
|
a.close();
|
|
|
|
throw th;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: ResizeAndRotateProducer */
|
|
|
|
public class b extends e {
|
|
|
|
public final /* synthetic */ l a;
|
|
|
|
|
|
|
|
public b(b1 b1Var, l lVar) {
|
|
|
|
this.a = lVar;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // c.f.j.p.x0
|
|
|
|
public void a() {
|
|
|
|
a.this.g.a();
|
|
|
|
a.this.f = true;
|
|
|
|
this.a.d();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // c.f.j.p.e, c.f.j.p.x0
|
|
|
|
public void b() {
|
|
|
|
if (a.this.e.p()) {
|
|
|
|
a.this.g.d();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public a(l<e> lVar, w0 w0Var, boolean z2, c cVar) {
|
|
|
|
super(lVar);
|
|
|
|
this.e = w0Var;
|
|
|
|
Objects.requireNonNull(w0Var.e());
|
2021-08-19 17:35:23 +00:00
|
|
|
this.f473c = z2;
|
2021-08-09 22:50:52 +00:00
|
|
|
this.d = cVar;
|
2021-08-18 07:29:27 +00:00
|
|
|
this.g = new c0(b1.this.a, new C0066a(b1.this), 100);
|
2021-08-09 22:50:52 +00:00
|
|
|
w0Var.f(new b(b1.this, lVar));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* JADX WARNING: Code restructure failed: missing block: B:22:0x0075, code lost:
|
|
|
|
if (r6 != false) goto L_0x0077;
|
|
|
|
*/
|
|
|
|
@Override // c.f.j.p.b
|
|
|
|
public void i(Object obj, int i) {
|
|
|
|
c.f.d.l.a aVar;
|
|
|
|
boolean z2;
|
|
|
|
boolean z3;
|
|
|
|
e eVar = (e) obj;
|
|
|
|
c.f.d.l.a aVar2 = c.f.d.l.a.UNSET;
|
|
|
|
if (!this.f) {
|
|
|
|
boolean e = b.e(i);
|
|
|
|
boolean z4 = true;
|
|
|
|
if (eVar != null) {
|
|
|
|
eVar.w();
|
|
|
|
c.f.i.c cVar = eVar.k;
|
|
|
|
ImageRequest e2 = this.e.e();
|
2021-08-19 17:35:23 +00:00
|
|
|
c.f.j.s.b createImageTranscoder = this.d.createImageTranscoder(cVar, this.f473c);
|
2021-08-09 22:50:52 +00:00
|
|
|
Objects.requireNonNull(createImageTranscoder);
|
|
|
|
eVar.w();
|
|
|
|
if (eVar.k == c.f.i.c.a) {
|
|
|
|
aVar = aVar2;
|
|
|
|
} else {
|
|
|
|
eVar.w();
|
|
|
|
if (!createImageTranscoder.d(eVar.k)) {
|
|
|
|
aVar = c.f.d.l.a.NO;
|
|
|
|
} else {
|
|
|
|
f fVar = e2.j;
|
|
|
|
if (!fVar.d) {
|
|
|
|
if (d.b(fVar, eVar) == 0) {
|
|
|
|
if (!fVar.b() || fVar.d) {
|
|
|
|
eVar.m = 0;
|
|
|
|
z3 = false;
|
|
|
|
} else {
|
|
|
|
c.f.d.d.e<Integer> eVar2 = d.a;
|
|
|
|
eVar.w();
|
|
|
|
z3 = eVar2.contains(Integer.valueOf(eVar.m));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
z2 = true;
|
|
|
|
if (!z2 && !createImageTranscoder.b(eVar, e2.j, e2.i)) {
|
|
|
|
z4 = false;
|
|
|
|
}
|
|
|
|
aVar = c.f.d.l.a.f(z4);
|
|
|
|
}
|
|
|
|
z2 = false;
|
|
|
|
z4 = false;
|
|
|
|
aVar = c.f.d.l.a.f(z4);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!e && aVar == aVar2) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (aVar != c.f.d.l.a.YES) {
|
|
|
|
if (cVar != c.f.i.b.a && cVar != c.f.i.b.k) {
|
|
|
|
f fVar2 = this.e.e().j;
|
|
|
|
if (!fVar2.c() && fVar2.b()) {
|
|
|
|
int a = fVar2.a();
|
|
|
|
eVar = e.a(eVar);
|
|
|
|
if (eVar != null) {
|
|
|
|
eVar.l = a;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (!this.e.e().j.d) {
|
|
|
|
eVar.w();
|
|
|
|
if (eVar.l != 0) {
|
|
|
|
eVar.w();
|
|
|
|
if (!(eVar.l == -1 || (eVar = e.a(eVar)) == null)) {
|
|
|
|
eVar.l = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.b.b(eVar, i);
|
|
|
|
} else if (this.g.f(eVar, i)) {
|
|
|
|
if (e || this.e.p()) {
|
|
|
|
this.g.d();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (e) {
|
|
|
|
this.b.b(null, 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public final Map<String, String> n(e eVar, c.f.j.d.e eVar2, c.f.j.s.a aVar, String str) {
|
|
|
|
String str2;
|
|
|
|
long j;
|
|
|
|
if (!this.e.o().g(this.e, "ResizeAndRotateProducer")) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
eVar.w();
|
|
|
|
sb.append(eVar.n);
|
|
|
|
sb.append("x");
|
|
|
|
eVar.w();
|
|
|
|
sb.append(eVar.o);
|
|
|
|
String sb2 = sb.toString();
|
|
|
|
if (eVar2 != null) {
|
|
|
|
str2 = eVar2.a + "x" + eVar2.b;
|
|
|
|
} else {
|
|
|
|
str2 = "Unspecified";
|
|
|
|
}
|
|
|
|
HashMap hashMap = new HashMap();
|
|
|
|
eVar.w();
|
|
|
|
hashMap.put("Image format", String.valueOf(eVar.k));
|
|
|
|
hashMap.put("Original size", sb2);
|
|
|
|
hashMap.put("Requested size", str2);
|
|
|
|
c0 c0Var = this.g;
|
|
|
|
synchronized (c0Var) {
|
|
|
|
j = c0Var.j - c0Var.i;
|
|
|
|
}
|
|
|
|
hashMap.put("queueTime", String.valueOf(j));
|
|
|
|
hashMap.put("Transcoder id", str);
|
|
|
|
hashMap.put("Transcoding result", String.valueOf(aVar));
|
|
|
|
return new c.f.d.d.f(hashMap);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public b1(Executor executor, g gVar, v0<e> v0Var, boolean z2, c cVar) {
|
|
|
|
Objects.requireNonNull(executor);
|
|
|
|
this.a = executor;
|
|
|
|
Objects.requireNonNull(gVar);
|
|
|
|
this.b = gVar;
|
|
|
|
Objects.requireNonNull(v0Var);
|
2021-08-19 17:35:23 +00:00
|
|
|
this.f472c = v0Var;
|
2021-08-09 22:50:52 +00:00
|
|
|
Objects.requireNonNull(cVar);
|
|
|
|
this.e = cVar;
|
|
|
|
this.d = z2;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // c.f.j.p.v0
|
|
|
|
public void b(l<e> lVar, w0 w0Var) {
|
2021-08-19 17:35:23 +00:00
|
|
|
this.f472c.b(new a(lVar, w0Var, this.d, this.e), w0Var);
|
2021-08-09 22:50:52 +00:00
|
|
|
}
|
|
|
|
}
|