package com.tencent.mm.modelvideo;

import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.al.e;
import com.tencent.mm.g.b.a.f;
import com.tencent.mm.i.c;
import com.tencent.mm.i.d;
import com.tencent.mm.i.g.a;
import com.tencent.mm.i.h;
import com.tencent.mm.sdk.platformtools.ab;
import com.tencent.mm.sdk.platformtools.ah;
import com.tencent.mm.sdk.platformtools.bo;
import com.tencent.ytcommon.BuildConfig;
import java.io.ByteArrayOutputStream;

class d$1 implements a {
    final /* synthetic */ d fVp;

    d$1(d dVar) {
        this.fVp = dVar;
    }

    public final int a(String str, int i, c cVar, d dVar, boolean z) {
        AppMethodBeat.i(50665);
        if (i == -21006) {
            ab.d("MicroMsg.NetSceneDownloadVideo", "%s cdntra  ERR_CNDCOM_MEDIA_IS_DOWNLOADING clientid:%s", new Object[]{this.fVp.alb(), this.fVp.fFa});
            AppMethodBeat.o(50665);
            return 0;
        } else if (i != 0) {
            u.um(this.fVp.fileName);
            String r = com.tencent.mm.plugin.report.a.r(new Object[]{Integer.valueOf(i), Integer.valueOf(2), Long.valueOf(this.fVp.startTime), Long.valueOf(bo.anU()), Integer.valueOf(com.tencent.mm.al.c.bW(ah.getContext())), Integer.valueOf(this.fVp.fVl), Integer.valueOf(this.fVp.frO), BuildConfig.FLAVOR});
            new f(r).ajK();
            new com.tencent.mm.g.b.a.d(r).ajK();
            this.fVp.ehi.onSceneEnd(3, i, BuildConfig.FLAVOR, this.fVp);
            AppMethodBeat.o(50665);
            return 0;
        } else {
            this.fVp.fVj = u.ut(this.fVp.fileName);
            int i2;
            if (this.fVp.fVj == null || this.fVp.fVj.status == 113) {
                if (this.fVp.fVj == null) {
                    i2 = -1;
                } else {
                    i2 = this.fVp.fVj.status;
                }
                ab.i("MicroMsg.NetSceneDownloadVideo", "%s upload video info is null or has paused, status:%d", new Object[]{this.fVp.alb(), Integer.valueOf(i2)});
                this.fVp.EH();
                this.fVp.ehi.onSceneEnd(3, i, "upload video info is null or has paused, status".concat(String.valueOf(i2)), this.fVp);
                AppMethodBeat.o(50665);
                return 0;
            } else if (cVar == null) {
                if (dVar != null) {
                    ab.i("MicroMsg.NetSceneDownloadVideo", "%s cdntra sceneResult.retCode:%d useTime:%d ", new Object[]{this.fVp.alb(), Integer.valueOf(dVar.field_retCode), Long.valueOf(bo.anU() - this.fVp.fVo)});
                    d dVar2 = this.fVp;
                    h hVar = this.fVp.fVk;
                    if (hVar == null || dVar == null) {
                        ab.w("MicroMsg.NetSceneDownloadVideo", "it had not task info or scene Result, don't report.");
                    } else if (hVar.field_smallVideoFlag == 1) {
                        ab.i("MicroMsg.NetSceneDownloadVideo", "it download short video, don't report.");
                    } else if (!(hVar == null || dVar == null)) {
                        ab.i("MicroMsg.NetSceneDownloadVideo", "%s sceneResult.field_recvedBytes %d, time [%d, %d]", new Object[]{dVar2.alb(), Integer.valueOf(dVar.field_recvedBytes), Long.valueOf(dVar.field_startTime), Long.valueOf(dVar.field_endTime)});
                        o.alm();
                        e.a(null, dVar, hVar, true);
                    }
                    if (dVar.field_retCode != 0) {
                        u.um(this.fVp.fileName);
                        if (this.fVp.fVh) {
                            com.tencent.mm.plugin.report.service.h.pYm.a(354, 13, 1, false);
                        }
                        if (this.fVp.fVi) {
                            com.tencent.mm.plugin.report.service.h.pYm.a(354, 252, 1, false);
                        }
                        this.fVp.ehi.onSceneEnd(3, dVar.field_retCode, BuildConfig.FLAVOR, this.fVp);
                    } else {
                        if (this.fVp.fVh) {
                            com.tencent.mm.plugin.report.service.h.pYm.a(354, 12, 1, false);
                        }
                        if (this.fVp.fVi) {
                            com.tencent.mm.plugin.report.service.h.pYm.a(354, 137, 1, false);
                        }
                        this.fVp.mo(dVar.field_fileLength);
                    }
                    new f(com.tencent.mm.plugin.report.a.r(new Object[]{Integer.valueOf(dVar.field_retCode), Integer.valueOf(2), Long.valueOf(this.fVp.startTime), Long.valueOf(bo.anU()), Integer.valueOf(com.tencent.mm.al.c.bW(ah.getContext())), Integer.valueOf(this.fVp.fVl), Integer.valueOf(this.fVp.frO), dVar.field_transInfo, BuildConfig.FLAVOR, BuildConfig.FLAVOR, BuildConfig.FLAVOR, BuildConfig.FLAVOR, BuildConfig.FLAVOR, BuildConfig.FLAVOR, BuildConfig.FLAVOR, dVar.efY})).ajK();
                    if (dVar.field_retCode != 0) {
                        new com.tencent.mm.g.b.a.d(com.tencent.mm.plugin.report.a.r(new Object[]{Integer.valueOf(dVar.field_retCode), Integer.valueOf(2), Long.valueOf(this.fVp.startTime), Long.valueOf(bo.anU()), Integer.valueOf(com.tencent.mm.al.c.bW(ah.getContext())), Integer.valueOf(this.fVp.fVl), Integer.valueOf(this.fVp.frO), dVar.field_transInfo, BuildConfig.FLAVOR, BuildConfig.FLAVOR, BuildConfig.FLAVOR, BuildConfig.FLAVOR, BuildConfig.FLAVOR, BuildConfig.FLAVOR, BuildConfig.FLAVOR, dVar.efY})).ajK();
                    }
                    a.a(this.fVp.fVj, 1);
                    this.fVp.fVk = null;
                }
                AppMethodBeat.o(50665);
                return 0;
            } else if (cVar.field_finishedLength == this.fVp.frO) {
                ab.d("MicroMsg.NetSceneDownloadVideo", "cdntra ignore progress 100%");
                AppMethodBeat.o(50665);
                return 0;
            } else if (this.fVp.fVj.fWY <= cVar.field_finishedLength || this.fVp.fVh) {
                i2 = 1024;
                this.fVp.fVj.fXb = bo.anT();
                if (this.fVp.fVj.fWY < cVar.field_finishedLength) {
                    this.fVp.fVj.fWY = cVar.field_finishedLength;
                    i2 = 1040;
                }
                this.fVp.fVj.bJt = i2;
                u.f(this.fVp.fVj);
                ab.d("MicroMsg.NetSceneDownloadVideo", "%s cdntra progresscallback id:%s finish:%d total:%d", new Object[]{this.fVp.alb(), this.fVp.fFa, Integer.valueOf(cVar.field_finishedLength), Integer.valueOf(cVar.field_toltalLength)});
                AppMethodBeat.o(50665);
                return 0;
            } else {
                ab.e("MicroMsg.NetSceneDownloadVideo", "%s cdnEndProc error oldpos:%d newpos:%d", new Object[]{this.fVp.alb(), Integer.valueOf(this.fVp.fVj.fWY), Integer.valueOf(cVar.field_finishedLength)});
                u.um(this.fVp.fileName);
                this.fVp.ehi.onSceneEnd(3, i, BuildConfig.FLAVOR, this.fVp);
                AppMethodBeat.o(50665);
                return 0;
            }
        }
    }

    public final void a(String str, ByteArrayOutputStream byteArrayOutputStream) {
    }

    public final byte[] l(String str, byte[] bArr) {
        return null;
    }
}
