package com.tencent.mm.plugin.voip.model.a;

import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.ai.f;
import com.tencent.mm.ai.m;
import com.tencent.mm.compatible.e.q;
import com.tencent.mm.plugin.report.service.h;
import com.tencent.mm.plugin.voip.a.a;
import com.tencent.mm.plugin.voip.b;
import com.tencent.mm.plugin.voip.model.v2protocal;
import com.tencent.mm.protocal.protobuf.cpp;
import com.tencent.mm.protocal.protobuf.cpq;
import com.tencent.mm.sdk.platformtools.ab;
import com.tencent.mm.sdk.platformtools.ah;
import com.tencent.ytcommon.BuildConfig;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import org.xwalk.core.XWalkFeature;

class g$1 implements f {
    final /* synthetic */ g sTN;

    g$1(g gVar) {
        this.sTN = gVar;
    }

    public final void onSceneEnd(int i, int i2, String str, m mVar) {
        AppMethodBeat.i(4716);
        a.Logi("MicroMsg.NetSceneVoipInvite", "Invite response:" + i + " errCode:" + i2 + " status:" + this.sTN.sPK.mStatus);
        if (this.sTN.sPK.mStatus != 2) {
            a.Loge("MicroMsg.NetSceneVoipInvite", " invite response with error status:" + this.sTN.sPK.mStatus + " should:2");
            AppMethodBeat.o(4716);
            return;
        }
        int i3;
        cpq cpq = (cpq) this.sTN.cKx();
        this.sTN.sPK.sPp.sUE = cpq.xmf;
        this.sTN.sPK.sPp.sUF = cpq.xmg;
        this.sTN.sPK.sPp.sUG = cpq.xmh;
        this.sTN.sPK.sPp.sUH = cpq.xmi;
        this.sTN.sPK.sPp.sUJ = cpq.xmk;
        this.sTN.sPK.sPp.sUI = cpq.xmp;
        this.sTN.sPK.sPp.sVk = cpq.xna;
        this.sTN.sPK.sPp.sUi = cpq.xlW;
        this.sTN.sPK.sPp.sUL = cpq.xmr;
        this.sTN.sPK.Gn(cpq.xlU);
        this.sTN.sPK.sPp.sUk = cpq.xlX;
        if (cpq.xlY != null && cpq.xlY.getILen() >= 12) {
            ByteBuffer wrap = ByteBuffer.wrap(cpq.xlY.getBuffer().toByteArray(), 8, 4);
            ByteOrder nativeOrder = ByteOrder.nativeOrder();
            ByteOrder order = wrap.order();
            i3 = wrap.getInt();
            a.Logd("MicroMsg.NetSceneVoipInvite", "steve:nSvrBaseBRTuneRatio1:" + i3 + ", nativeOrder:" + nativeOrder + ", bbOrder:" + order);
            this.sTN.sPK.sPp.sUK = i3;
        }
        a.Logi("MicroMsg.NetSceneVoipInvite", "setSvrConfig onInviteResp: audioTsdfBeyond3G = " + this.sTN.sPK.sPp.sUE + ",audioTsdEdge = " + this.sTN.sPK.sPp.sUF + ",passthroughQosAlgorithm = " + this.sTN.sPK.sPp.sUG + ",fastPlayRepair = " + this.sTN.sPK.sPp.sUH + ", audioDtx = " + this.sTN.sPK.sPp.sUJ + ",switchtcpPktCnt = " + this.sTN.sPK.sPp.sUh + ",SvrCfgListV = " + this.sTN.sPK.sPp.sUI + ", setMaxBRForRelay=" + this.sTN.sPK.sPp.sUL + ",EnableDataAccept = " + this.sTN.sPK.sPp.sVk + ",WifiScanInterval = " + this.sTN.sPK.sPp.sUk + ",BaseBRTuneRatio=" + this.sTN.sPK.sPp.sUK);
        this.sTN.sPK.sPp.sUM = cpq.xmo;
        a.Logi("MicroMsg.NetSceneVoipInvite", "inviteResp AudioAecMode5 = " + this.sTN.sPK.sPp.sUM);
        this.sTN.sPK.sPp.sUN = cpq.xms;
        a.Logi("MicroMsg.NetSceneVoipInvite", "inviteResp AudioEnableXnoiseSup = " + this.sTN.sPK.sPp.sUN);
        i3 = a.getNetType(ah.getContext());
        if (i == 0) {
            this.sTN.sPK.setStatus(4);
            this.sTN.sPK.sPp.nwu = cpq.wem;
            this.sTN.sPK.sPp.nwv = cpq.wen;
            this.sTN.sPK.sPp.nwC = cpq.wPb;
            h.pYm.a(11518, true, true, new Object[]{Integer.valueOf(b.cIj().cJZ()), Long.valueOf(b.cIj().cKa()), Long.valueOf(b.cIj().cIK()), Integer.valueOf(1), Integer.valueOf(i3)});
            if (cpq.xmZ > 0) {
                long j = (long) (cpq.xmZ * XWalkFeature.INTERFACE_GEO_LOCATION_PERMISSION);
                this.sTN.sPK.sPD.ae(j, j);
            }
            b.cIj().cKd();
            boolean cKN = v2protocal.cKN();
            com.tencent.mm.bu.a aVar = com.tencent.mm.bu.a.xtM;
            boolean dmB = com.tencent.mm.bu.a.dmB();
            boolean z = b.cIl() == 0;
            int i4 = q.etc.erz;
            int i5 = (this.sTN.sPK.sPp.sUi >> 4) & 7;
            int i6 = 0;
            if (cKN && i4 != 0 && dmB && z) {
                if (i4 > 0) {
                    i6 = i4;
                } else if (i5 >= 0) {
                    i6 = i5;
                }
            }
            a.Logi("MicroMsg.NetSceneVoipInvite", "NetSceneInviteResp set voipbeauty local=" + cKN + ", server=" + i5 + ", blacklist=" + i4 + ", isLibReady=" + dmB + ",isLibInitOK=" + z + ", UICallback" + this.sTN.sPK.sPq + ", finalFlag=" + i6);
            if (this.sTN.sPK.sPq != null) {
                this.sTN.sPK.sPq.setVoipBeauty(i6);
            }
            this.sTN.sPK.sPp.sVl = i6;
            this.sTN.sPK.sPp.sVm = i5;
            a.Logi("MicroMsg.NetSceneVoipInvite", "invite ok, roomid =" + this.sTN.sPK.sPp.nwu + ",memberid = " + this.sTN.sPK.sPp.nwC + "VoipSyncInterval = " + cpq.xmZ);
            this.sTN.sPK.sPq.cJy();
            a.c(b.cIj().cJZ(), b.cIj().cKa(), 0, 1);
            AppMethodBeat.o(4716);
        } else if (i == 4) {
            a.Logi("MicroMsg.NetSceneVoipInvite", "RoomId in InviteResp: " + cpq.wem + "," + cpq.wen);
            switch (i2) {
                case 211:
                    this.sTN.sPK.sPp.sVH.sQe = 12;
                    this.sTN.sPK.sPp.sVH.sQq = 12;
                    h.pYm.a(11518, true, true, new Object[]{Integer.valueOf(b.cIj().cJZ()), Long.valueOf(b.cIj().cKa()), Long.valueOf(b.cIj().cIK()), Integer.valueOf(8), Integer.valueOf(i3)});
                    break;
                case 233:
                    this.sTN.sPK.sPp.sVH.sQe = 12;
                    this.sTN.sPK.sPp.sVH.sQq = 1;
                    h.pYm.a(11518, true, true, new Object[]{Integer.valueOf(b.cIj().cJZ()), Long.valueOf(b.cIj().cKa()), Long.valueOf(b.cIj().cIK()), Integer.valueOf(3), Integer.valueOf(i3)});
                    break;
                case 234:
                    this.sTN.sPK.sPp.sVH.sQe = 13;
                    this.sTN.sPK.sPp.sVH.sQq = 11;
                    h.pYm.a(11518, true, true, new Object[]{Integer.valueOf(b.cIj().cJZ()), Long.valueOf(b.cIj().cKa()), Long.valueOf(b.cIj().cIK()), Integer.valueOf(4), Integer.valueOf(i3)});
                    break;
                case 235:
                    this.sTN.sPK.sPp.sVH.sQe = 13;
                    this.sTN.sPK.sPp.sVH.sQq = 2;
                    h.pYm.a(11518, true, true, new Object[]{Integer.valueOf(b.cIj().cJZ()), Long.valueOf(b.cIj().cKa()), Long.valueOf(b.cIj().cIK()), Integer.valueOf(2), Integer.valueOf(i3)});
                    break;
                case 236:
                    this.sTN.sPK.sPp.sVH.sQe = 12;
                    this.sTN.sPK.sPp.sVH.sQq = 10;
                    h.pYm.a(11518, true, true, new Object[]{Integer.valueOf(b.cIj().cJZ()), Long.valueOf(b.cIj().cKa()), Long.valueOf(b.cIj().cIK()), Integer.valueOf(7), Integer.valueOf(i3)});
                    break;
                case 237:
                    this.sTN.sPK.sPp.sVH.sQe = 13;
                    this.sTN.sPK.sPp.sVH.sQq = 9;
                    h.pYm.a(11518, true, true, new Object[]{Integer.valueOf(b.cIj().cJZ()), Long.valueOf(b.cIj().cKa()), Long.valueOf(b.cIj().cIK()), Integer.valueOf(2), Integer.valueOf(i3)});
                    break;
                case 238:
                    this.sTN.sPK.sOP = true;
                    this.sTN.sPK.sOR = false;
                    this.sTN.sPK.sOQ = false;
                    this.sTN.sPK.sPp.sUD = 0;
                    this.sTN.sPK.sPp.sUC = 0;
                    this.sTN.sPK.setStatus(3);
                    this.sTN.sPK.sPp.nwu = cpq.wem;
                    this.sTN.sPK.sPp.nwv = cpq.wen;
                    this.sTN.sPK.sPp.nwC = cpq.wPb;
                    this.sTN.sPK.sPq.Gu(((cpp) ((g) mVar).cKy()).xcr);
                    AppMethodBeat.o(4716);
                    return;
                case 241:
                    ab.i("MicroMsg.NetSceneVoipInvite", "invite fail cuz server unavailable! reInvtieInterval is : " + cpq.xnb + " seconds!");
                    b.cIj().sSW = System.currentTimeMillis();
                    if (cpq.xnb == 0) {
                        b.cIj().sSX = 30000;
                        break;
                    } else {
                        b.cIj().sSX = (long) (cpq.xnb * XWalkFeature.INTERFACE_GEO_LOCATION_PERMISSION);
                        break;
                    }
                default:
                    this.sTN.sPK.sPp.sVH.sQe = 12;
                    this.sTN.sPK.sPp.sVH.sQq = 99;
                    h.pYm.a(11518, true, true, new Object[]{Integer.valueOf(b.cIj().cJZ()), Long.valueOf(b.cIj().cKa()), Long.valueOf(b.cIj().cIK()), Integer.valueOf(5), Integer.valueOf(i3)});
                    break;
            }
            this.sTN.sPK.sPp.sVH.sQf = i2;
            this.sTN.sPK.v(1, i2, str);
            AppMethodBeat.o(4716);
        } else {
            this.sTN.sPK.sPp.sVH.sQe = 12;
            this.sTN.sPK.sPp.sVH.sQf = i2;
            this.sTN.sPK.sPp.sVH.sQq = 99;
            h.pYm.a(11518, true, true, new Object[]{Integer.valueOf(b.cIj().cJZ()), Long.valueOf(b.cIj().cKa()), Long.valueOf(b.cIj().cIK()), Integer.valueOf(9), Integer.valueOf(i3)});
            this.sTN.sPK.v(1, -9004, BuildConfig.FLAVOR);
            AppMethodBeat.o(4716);
        }
    }
}
