新浪彩票 v0.96.37版本的 MD5 值为:0c7ddce345383506e2959f5d75bdceab

以下内容为反编译后的 b.java 源代码,内容仅作参考


package com.netease.nrtc;

import ScQQfj7RBI9EASOsKPvc.Dk2cftRKk79bPCa4V9xt.C1672;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.SystemClock;
import android.text.TextUtils;
import com.meizu.cloud.pushsdk.constants.PushConstants;
import com.netease.nrtc.a;
import com.netease.nrtc.b;
import com.netease.nrtc.debug.NRtcDebugBridge;
import com.netease.nrtc.debug.NRtcDebugBridgeDevOnly;
import com.netease.nrtc.debug.NRtcDebugBridgeNop;
import com.netease.nrtc.device.DeviceUtils;
import com.netease.nrtc.engine.impl.i;
import com.netease.nrtc.engine.rawapi.INetDetectEngine;
import com.netease.nrtc.engine.rawapi.IRtcEngine;
import com.netease.nrtc.engine.rawapi.IRtcEventHandler;
import com.netease.nrtc.engine.rawapi.IRtcRoomServerHandler;
import com.netease.nrtc.engine.rawapi.RtcCode;
import com.netease.nrtc.engine.rawapi.RtcConfig;
import com.netease.nrtc.engine.rawapi.RtcNetworkProxy;
import com.netease.nrtc.engine.rawapi.RtcParameters;
import com.netease.nrtc.engine.rawapi.RtcPrivatizationConfig;
import com.netease.nrtc.engine.rawapi.RtcServerAddresses;
import com.netease.nrtc.sdk.EngineConfig;
import com.netease.nrtc.sdk.NRtc;
import com.netease.nrtc.sdk.NRtcCallback;
import com.netease.nrtc.sdk.NRtcCallbackEx;
import com.netease.nrtc.sdk.NRtcEx;
import com.netease.nrtc.sdk.NRtcNetworkProxy;
import com.netease.nrtc.sdk.NRtcParameters;
import com.netease.nrtc.sdk.NRtcRoomServerCallback;
import com.netease.nrtc.sdk.NRtcServerAddresses;
import com.netease.nrtc.sdk.audio.AudioFrame;
import com.netease.nrtc.sdk.audio.IPlayAudioCallBack;
import com.netease.nrtc.sdk.audio.IRemoteAudioCallBack;
import com.netease.nrtc.sdk.common.VideoFilterParameter;
import com.netease.nrtc.sdk.common.statistics.NetStats;
import com.netease.nrtc.sdk.common.statistics.RtcStats;
import com.netease.nrtc.sdk.common.statistics.SessionStats;
import com.netease.nrtc.sdk.video.IVideoCapturer;
import com.netease.nrtc.sdk.video.VideoFrame;
import com.netease.nrtc.utility.j;
import com.netease.nrtc.utility.l;
import com.netease.nrtc.video.render.IVideoRender;
import com.netease.yunxin.base.crypto.MD5;
import com.netease.yunxin.base.http.HttpStack;
import com.netease.yunxin.base.http.URIUtils;
import com.netease.yunxin.base.thread.ThreadUtils;
import com.netease.yunxin.base.trace.Trace;
import com.netease.yunxin.base.utils.Checker;
import com.netease.yunxin.base.utils.FileUtils;
import com.netease.yunxin.base.utils.StringUtils;
import com.tencent.smtt.sdk.TbsReaderView;
import ewUlBWKNoApzb1Mnhgn4.pNJn4Jge4fbYEleFhu1r.tuTnrQl15gwcjciRsKuT.C5117;
import ewUlBWKNoApzb1Mnhgn4.qZtQObWCEz23oxlEusaw.tuTnrQl15gwcjciRsKuT.C5308;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
import javax.microedition.khronos.egl.EGLContext;
import uN6ZT9mbO48DshpK4Gta.tuTnrQl15gwcjciRsKuT.tuTnrQl15gwcjciRsKuT.C5923;
public class b extends NRtcEx implements IRtcEventHandler {
    private static String b = "https://nrtc.netease.im/nrtc/getChannelInfos.action";
    private AtomicInteger a;
    private Context c;
    private NRtcCallback d;
    private IRtcEngine e;
    private Handler f;
    private volatile long g;
    private String n;
    private long p;
    private String q;
    private NRtcDebugBridge r;
    private String s;
    private boolean h = false;
    private boolean i = false;
    private boolean j = false;
    private boolean k = false;
    private boolean l = false;
    private boolean m = true;
    private NRtcNetworkProxy o = null;
    private a.InterfaceC3313a t = new a.InterfaceC3313a() {
        @Override
        public final void config(int i, RtcConfig rtcConfig) {
            b.this.a(i, rtcConfig);
        }
    };

    public static class a {
        private final long a;
        private final String b;
        private final String c;
        private final String d;
        private final boolean e;
        private final boolean f;

        public a(String str, String str2, long j, String str3, boolean z, boolean z2) {
            this.a = j;
            this.b = str2;
            this.c = str;
            this.d = str3;
            this.e = z;
            this.f = z2;
        }

        private Map<String, String> b(Context context) {
            HashMap hashMap = new HashMap();
            hashMap.put("uid", this.a + "");
            hashMap.put("channelName", this.b);
            hashMap.put("osType", PushConstants.PUSH_TYPE_UPLOAD_LOG);
            StringBuilder sb = new StringBuilder();
            sb.append(StringUtils.isEmpty(this.c) ? 2 : 1);
            sb.append("");
            hashMap.put("secureType", sb.toString());
            hashMap.put("version", NRtc.version().versionName + C5117.f17943 + NRtc.version().versionCode);
            int a = com.netease.nrtc.utility.c.c.a(context);
            if (a == 0) {
                hashMap.put("netType", PushConstants.PUSH_TYPE_NOTIFY);
            } else if (a == 10) {
                hashMap.put("netType", "5");
            } else if (a == 20) {
                hashMap.put("netType", "4");
            } else if (a == 30) {
                hashMap.put("netType", "3");
            } else if (a == 40) {
                hashMap.put("netType", PushConstants.PUSH_TYPE_UPLOAD_LOG);
            } else if (a == 50) {
                hashMap.put("netType", "1");
            }
            if (this.e) {
                hashMap.put("mode", PushConstants.PUSH_TYPE_UPLOAD_LOG);
            } else {
                hashMap.put("mode", "1");
            }
            if (this.e && this.f) {
                hashMap.put("live", "1");
            } else {
                hashMap.put("live", PushConstants.PUSH_TYPE_NOTIFY);
            }
            hashMap.put("webrtc", String.valueOf(1));
            hashMap.put("deviceid", DeviceUtils.a(context));
            hashMap.put(C5308.f18330, context.getPackageName());
            StringBuilder sb2 = new StringBuilder("{ ");
            if (l.a(context)) {
                sb2.append("appkey:");
                sb2.append(this.d);
                sb2.append(" ");
            } else {
                sb2.append("appkey:");
                sb2.append(this.d.substring(0, 3));
                sb2.append("***");
                String str = this.d;
                sb2.append(str.substring(str.length() - 3));
                sb2.append(" ");
            }
            for (Map.Entry entry : hashMap.entrySet()) {
                sb2.append((String) entry.getKey());
                sb2.append(":");
                sb2.append((String) entry.getValue());
                sb2.append(" ");
            }
            sb2.append("}");
            Trace.i("NRtcImpl", sb2.toString());
            return hashMap;
        }

        private String a(String str, long j, String str2, Map<String, String> map) {
            long currentTimeMillis = System.currentTimeMillis() / 1000;
            if (StringUtils.isEmpty(str2)) {
                str2 = a(str, j, currentTimeMillis);
            }
            StringBuilder sb = new StringBuilder();
            sb.append("appkey=");
            sb.append(str);
            sb.append("&checksum=");
            sb.append(str2);
            sb.append("&curtime=");
            sb.append(currentTimeMillis);
            for (Map.Entry<String, String> entry : map.entrySet()) {
                sb.append(C1672.f6726);
                sb.append(entry.getKey());
                sb.append('=');
                sb.append(entry.getValue());
            }
            Trace.i("NRtcImpl", "curtime->" + currentTimeMillis + ", sum->" + str2.substring(0, 2) + "***" + str2.substring(str2.length() - 2, str2.length()));
            return sb.toString();
        }

        private String a(String str, long j, long j2) {
            return MD5.md5(str + C5117.f17943 + j + C5117.f17943 + j2);
        }

        public String a(Context context) {
            String str;
            try {
                str = URIUtils.encodeQuery(a(this.d, this.a, this.c, b(context)), "UTF-8");
            } catch (Exception e) {
                Trace.e("NRtcImpl", e.getMessage());
                str = null;
            }
            if (StringUtils.isEmpty(str)) {
                return null;
            }
            return b.b + "?" + str;
        }
    }

    public b(Context context, String str, String str2, NRtcCallback nRtcCallback, EngineConfig engineConfig) throws Exception {
        try {
            Checker.checkArgument(context != null, "Context is null");
            Checker.checkArgument(nRtcCallback != null, "Callback is null");
            NRtcDebugBridge nRtcDebugBridgeDevOnly = l.a() ? new NRtcDebugBridgeDevOnly() : new NRtcDebugBridgeNop();
            this.r = nRtcDebugBridgeDevOnly;
            com.netease.nrtc.engine.impl.a.r = nRtcDebugBridgeDevOnly;
            this.a = new AtomicInteger(1);
            this.d = nRtcCallback;
            this.n = str;
            this.c = context.getApplicationContext();
            this.q = a(str2);
            engineConfig = engineConfig == null ? new EngineConfig.Builder().build() : engineConfig;
            RtcServerAddresses a2 = a(engineConfig.getServerAddresses(), context);
            this.e = IRtcEngine.create(this.c, str, this.q, engineConfig.isLowEnergy(), engineConfig.getOsType(), a2, this);
            this.f = new Handler(Looper.getMainLooper());
            b();
            if (a2 != null) {
                if (com.netease.nrtc.utility.a.a(a2.channelServer)) {
                    b = a2.channelServer;
                }
                if (com.netease.nrtc.utility.a.a(a2.netDetectServer)) {
                    INetDetectEngine.setCustomNetDetectServer(a2.netDetectServer);
                }
                com.netease.nrtc.a.a(a2.reLoginConfigServer);
            }
        } catch (Exception e) {
            String str3 = "exception -> " + e;
            throw new Exception(e.getMessage());
        }
    }

    private static String a(int i) {
        return i != 3102 ? i != 3104 ? "" : "audio mixing finished" : "audio mixing error";
    }

    private void b() {
        Bundle bundle;
        try {
            ApplicationInfo applicationInfo = this.c.getPackageManager().getApplicationInfo(this.c.getPackageName(), 128);
            if (applicationInfo == null || (bundle = applicationInfo.metaData) == null) {
                return;
            }
            String string = bundle.getString("com.netease.nrtc.server");
            if (StringUtils.isNotEmpty(string)) {
                b = string;
            }
        } catch (Throwable th) {
            Trace.e("NRtcImpl", th.getMessage());
        }
    }

    private NRtcCallbackEx c() {
        NRtcCallback nRtcCallback = this.d;
        if (nRtcCallback == null || !(nRtcCallback instanceof NRtcCallbackEx)) {
            return null;
        }
        return (NRtcCallbackEx) nRtcCallback;
    }

    @Override
    public boolean allRemoteAudioStreamMuted() {
        return remoteAudioStreamMuted(-1L);
    }

    @Override
    public int disableVideo() {
        IRtcEngine iRtcEngine = this.e;
        return iRtcEngine == null ? RtcCode.ERR_UNINITIALIZED : iRtcEngine.disableVideo();
    }

    @Override
    @SuppressLint({"NewApi"})
    public int dispose() throws IllegalStateException {
        IRtcEngine iRtcEngine = this.e;
        int dispose = iRtcEngine != null ? iRtcEngine.dispose() : 0;
        this.r.clear();
        this.e = null;
        this.d = null;
        return dispose;
    }

    @Override
    public int enableVideo() {
        IRtcEngine iRtcEngine = this.e;
        return iRtcEngine == null ? RtcCode.ERR_UNINITIALIZED : iRtcEngine.enableVideo();
    }

    @Override
    public int getConnectStatus() {
        IRtcEngine iRtcEngine = this.e;
        if (iRtcEngine == null) {
            return 0;
        }
        return iRtcEngine.getConnectStatus();
    }

    @Override
    public NRtcDebugBridge getDebugBridge() {
        return this.r;
    }

    @Override
    public NRtcNetworkProxy getNetworkProxy() {
        return this.o;
    }

    @Override
    public <T> T getParameter(NRtcParameters.Key<T> key) {
        NRtcParameters nRtcParameters = new NRtcParameters();
        nRtcParameters.setRequestKey(key);
        NRtcParameters parameters = getParameters(nRtcParameters);
        if (parameters == null || !parameters.containsKey(key)) {
            return null;
        }
        return (T) parameters.get(key);
    }

    @Override
    public NRtcParameters getParameters(NRtcParameters nRtcParameters) {
        if (this.e != null) {
            NRtcParameters nRtcParameters2 = new NRtcParameters();
            nRtcParameters2.setRawParameters(this.e.getParameters(nRtcParameters != null ? nRtcParameters.getRawParameters() : null));
            return nRtcParameters2;
        }
        return null;
    }

    @Override
    public int getRole() {
        IRtcEngine iRtcEngine = this.e;
        if (iRtcEngine != null) {
            return iRtcEngine.getRole();
        }
        return 0;
    }

    @Override
    public boolean isAutoPublishVideo() {
        IRtcEngine iRtcEngine = this.e;
        return iRtcEngine != null && iRtcEngine.isAutoPublishVideo();
    }

    @Override
    public boolean isAutoSubscribeAudio() {
        IRtcEngine iRtcEngine = this.e;
        return iRtcEngine != null && iRtcEngine.isAutoSubscribeAudio();
    }

    @Override
    public boolean isAutoSubscribeVideo() {
        IRtcEngine iRtcEngine = this.e;
        return iRtcEngine != null && iRtcEngine.isAutoSubscribeVideo();
    }

    @Override
    public boolean isMicrophoneMute() {
        IRtcEngine iRtcEngine = this.e;
        return iRtcEngine != null && iRtcEngine.isMicrophoneMute();
    }

    @Override
    public int joinChannel(String str, String str2, long j) {
        Trace.i("NRtcImpl", "joinChannel, name = " + str2 + ", uid = " + j);
        this.p = SystemClock.elapsedRealtime();
        if (StringUtils.isEmpty(str2)) {
            Trace.e("NRtcImpl", "joinChannel error: channel name is empty!");
            return -400;
        } else if (j == 0) {
            Trace.e("NRtcImpl", "joinChannel error: uid == 0!");
            return -400;
        } else if (!this.a.compareAndSet(1, 2)) {
            Trace.e("NRtcImpl", "joinChannel error: statue illegal!");
            return -500;
        } else {
            return a(str, str2, j);
        }
    }

    @Override
    public int leaveChannel() {
        int i;
        IRtcEngine iRtcEngine;
        if (!this.a.compareAndSet(3, 4) || (iRtcEngine = this.e) == null) {
            i = -500;
        } else {
            iRtcEngine.leaveChannel();
            i = 0;
        }
        this.a.set(1);
        return i;
    }

    @Override
    public boolean localAudioStreamMuted() {
        IRtcEngine iRtcEngine = this.e;
        return iRtcEngine != null && iRtcEngine.localAudioStreamMuted();
    }

    @Override
    public boolean localVideoStreamMuted() {
        IRtcEngine iRtcEngine = this.e;
        return iRtcEngine != null && iRtcEngine.localVideoStreamMuted();
    }

    @Override
    public int muteAllRemoteAudioStream(boolean z) {
        return muteRemoteAudioStream(-1L, z);
    }

    @Override
    public int muteLocalAudioStream(boolean z) {
        IRtcEngine iRtcEngine = this.e;
        return iRtcEngine == null ? RtcCode.ERR_UNINITIALIZED : iRtcEngine.muteLocalAudioStream(z);
    }

    @Override
    public int muteLocalVideoStream(boolean z) {
        IRtcEngine iRtcEngine = this.e;
        return iRtcEngine == null ? RtcCode.ERR_UNINITIALIZED : iRtcEngine.muteLocalVideoStream(z);
    }

    @Override
    public int muteRemoteAudioStream(long j, boolean z) {
        IRtcEngine iRtcEngine = this.e;
        return iRtcEngine == null ? RtcCode.ERR_UNINITIALIZED : iRtcEngine.muteRemoteAudioStream(j, z);
    }

    @Override
    public int muteRemoteVideoStream(long j, boolean z) {
        IRtcEngine iRtcEngine = this.e;
        return iRtcEngine == null ? RtcCode.ERR_UNINITIALIZED : iRtcEngine.muteRemoteVideoStream(j, z);
    }

    @Override
    public void onAVRecordingCompletion(long j, String str) {
        NRtcCallbackEx c = c();
        if (c != null) {
            c.onAVRecordingCompletion(j, str);
        }
    }

    @Override
    public void onAVRecordingStart(long j, String str) {
        NRtcCallbackEx c = c();
        if (c != null) {
            c.onAVRecordingStart(j, str);
        }
    }

    @Override
    public void onAudioDeviceChanged(int i, Set<Integer> set, boolean z) {
        NRtcCallback nRtcCallback = this.d;
        if (nRtcCallback != null) {
            nRtcCallback.onAudioDeviceChanged(i, set, z);
        }
    }

    @Override
    public void onAudioEffectPlayEvent(int i, int i2) {
        NRtcCallback nRtcCallback = this.d;
        if (nRtcCallback != null) {
            nRtcCallback.onAudioEffectPlayEvent(i, i2);
        }
    }

    @Override
    public void onAudioEffectPreload(int i, int i2) {
        NRtcCallback nRtcCallback = this.d;
        if (nRtcCallback != null) {
            nRtcCallback.onAudioEffectPreload(i, i2);
        }
    }

    @Override
    public boolean onAudioFrameFilter(AudioFrame audioFrame) {
        NRtcCallback nRtcCallback = this.d;
        return nRtcCallback == null || nRtcCallback.onAudioFrameFilter(audioFrame);
    }

    @Override
    public void onAudioMixingEvent(int i) {
        NRtcCallback nRtcCallback = this.d;
        if (nRtcCallback != null) {
            nRtcCallback.onDeviceEvent(i, a(i));
        }
    }

    @Override
    public void onAudioMixingProgressUpdated(long j, long j2) {
        NRtcCallback nRtcCallback = this.d;
        if (nRtcCallback != null) {
            nRtcCallback.onAudioMixingProgressUpdated(j, j2);
        }
    }

    @Override
    public void onAudioRecordingCompletion(String str) {
        NRtcCallbackEx c = c();
        if (c != null) {
            c.onAudioRecordingCompletion(str);
        } else {
            Trace.e("NRtcImpl", "onAudioRecordingCompletion: Unable to find a callback");
        }
    }

    @Override
    public void onAudioRecordingStart(String str) {
        NRtcCallbackEx c = c();
        if (c != null) {
            c.onAudioRecordingStart(str);
        }
    }

    @Override
    public void onCallEstablished() {
        NRtcCallback nRtcCallback = this.d;
        if (nRtcCallback != null) {
            nRtcCallback.onCallEstablished();
        }
    }

    @Override
    public void onConnectionTypeChanged(int i) {
        NRtcCallback nRtcCallback = this.d;
        if (nRtcCallback != null) {
            nRtcCallback.onConnectionTypeChanged(i);
        }
    }

    @Override
    public void onDeviceEvent(int i, String str) {
        NRtcCallback nRtcCallback = this.d;
        if (nRtcCallback != null) {
            nRtcCallback.onDeviceEvent(i, str);
        }
    }

    @Override
    public void onDisconnectServer(int i) {
        if (i == 2) {
            b(3, 11004);
        } else if (i != 3) {
            b(3, 11001);
        } else {
            b(3, 11005);
        }
    }

    @Override
    public void onFirstVideoFrameAvailable(long j) {
        NRtcCallback nRtcCallback = this.d;
        if (nRtcCallback != null) {
            nRtcCallback.onFirstVideoFrameAvailable(j);
        }
    }

    @Override
    public void onFirstVideoFrameRendered(long j) {
        NRtcCallback nRtcCallback = this.d;
        if (nRtcCallback != null) {
            nRtcCallback.onFirstVideoFrameRendered(j);
        }
    }

    @Override
    public void onJoinedChannel(int i, String str, String str2, int i2) {
        if (i != 200) {
            b(2, i);
            return;
        }
        NRtcCallback nRtcCallback = this.d;
        if (nRtcCallback != null) {
            nRtcCallback.onJoinedChannel(this.g, str2, str, i2);
        }
    }

    @Override
    public void onLeaveChannel(SessionStats sessionStats) {
        NRtcCallback nRtcCallback = this.d;
        if (nRtcCallback != null) {
            nRtcCallback.onLeftChannel(sessionStats);
        }
    }

    @Override
    public void onLiveEvent(int i) {
        NRtcCallback nRtcCallback = this.d;
        if (nRtcCallback != null) {
            nRtcCallback.onLiveEvent(i);
        }
    }

    @Override
    public void onLowStorageSpaceWarning(long j) {
        NRtcCallbackEx c = c();
        if (c != null) {
            c.onLowStorageSpaceWarning(j);
        } else {
            Trace.e("NRtcImpl", "onLowStorageSpaceWarning: Unable to find a callback");
        }
    }

    @Override
    public void onNetworkQuality(long j, int i, NetStats netStats) {
        NRtcCallback nRtcCallback = this.d;
        if (nRtcCallback != null) {
            nRtcCallback.onNetworkQuality(j, i, netStats);
        }
    }

    @Override
    public void onProtocolIncompatible(int i) {
        b(3, i == 0 ? 11002 : 11003);
    }

    @Override
    public void onPublishVideoResult(int i) {
        NRtcCallback nRtcCallback = this.d;
        if (nRtcCallback != null) {
            nRtcCallback.onPublishVideoResult(i);
        }
    }

    @Override
    public void onReloginCallback(int i, RtcConfig rtcConfig) {
        com.netease.nrtc.a.a().a(this.n, rtcConfig, this.t);
    }

    @Override
    public void onRemotePublishVideo(long j, int[] iArr) {
        NRtcCallback nRtcCallback = this.d;
        if (nRtcCallback != null) {
            nRtcCallback.onRemotePublishVideo(j, iArr);
        }
    }

    @Override
    public void onRemoteUnpublishVideo(long j) {
        NRtcCallback nRtcCallback = this.d;
        if (nRtcCallback != null) {
            nRtcCallback.onRemoteUnpublishVideo(j);
        }
    }

    @Override
    public void onReportSpeaker(int i, long[] jArr, int[] iArr, int i2) {
        NRtcCallback nRtcCallback = this.d;
        if (nRtcCallback != null) {
            nRtcCallback.onReportSpeaker(i, jArr, iArr, i2);
        }
    }

    @Override
    public void onSessionStats(SessionStats sessionStats) {
        NRtcCallback nRtcCallback = this.d;
        if (nRtcCallback != null) {
            nRtcCallback.onSessionStats(sessionStats);
        }
    }

    @Override
    public void onSubscribeAudioResult(int i) {
        NRtcCallback nRtcCallback = this.d;
        if (nRtcCallback != null) {
            nRtcCallback.onSubscribeAudioResult(i);
        }
    }

    @Override
    public void onSubscribeVideoResult(long j, int i, int i2) {
        NRtcCallback nRtcCallback = this.d;
        if (nRtcCallback != null) {
            nRtcCallback.onSubscribeVideoResult(j, i, i2);
        }
    }

    @Override
    public void onTakeSnapshotResult(long j, boolean z, String str) {
        NRtcCallbackEx c = c();
        if (c != null) {
            c.onTakeSnapshotResult(j, z, str);
        } else {
            Trace.e("NRtcImpl", "onTakeSnapshotResult: Unable to find a callback");
        }
    }

    @Override
    public void onUnpublishVideoResult(int i) {
        NRtcCallback nRtcCallback = this.d;
        if (nRtcCallback != null) {
            nRtcCallback.onUnpublishVideoResult(i);
        }
    }

    @Override
    public void onUnsubscribeAudioResult(int i) {
        NRtcCallback nRtcCallback = this.d;
        if (nRtcCallback != null) {
            nRtcCallback.onUnsubscribeAudioResult(i);
        }
    }

    @Override
    public void onUnsubscribeVideoResult(long j, int i, int i2) {
        NRtcCallback nRtcCallback = this.d;
        if (nRtcCallback != null) {
            nRtcCallback.onUnsubscribeVideoResult(j, i, i2);
        }
    }

    @Override
    public void onUserEnableVideo(long j, boolean z) {
        NRtcCallback nRtcCallback = this.d;
        if (nRtcCallback != null) {
            nRtcCallback.onUserEnableVideo(j, z);
        }
    }

    @Override
    public void onUserJoined(long j) {
        NRtcCallback nRtcCallback = this.d;
        if (nRtcCallback != null) {
            nRtcCallback.onUserJoined(j);
        }
    }

    @Override
    public void onUserLeave(long j, RtcStats rtcStats, int i) {
        NRtcCallback nRtcCallback = this.d;
        if (nRtcCallback != null) {
            nRtcCallback.onUserLeft(j, rtcStats, i);
        }
    }

    @Override
    public void onUserMuteAudio(long j, boolean z) {
        NRtcCallback nRtcCallback = this.d;
        if (nRtcCallback != null) {
            nRtcCallback.onUserMuteAudio(j, z);
        }
    }

    @Override
    public void onUserMuteVideo(long j, boolean z) {
        NRtcCallback nRtcCallback = this.d;
        if (nRtcCallback != null) {
            nRtcCallback.onUserMuteVideo(j, z);
        }
    }

    @Override
    public void onVideoCapturerStarted(boolean z) {
        NRtcCallback nRtcCallback = this.d;
        if (nRtcCallback != null) {
            nRtcCallback.onVideoCapturerStarted(z);
        }
    }

    @Override
    public void onVideoCapturerStopped() {
        NRtcCallback nRtcCallback = this.d;
        if (nRtcCallback != null) {
            nRtcCallback.onVideoCapturerStopped();
        }
    }

    @Override
    public void onVideoFpsReported(long j, int i) {
        NRtcCallback nRtcCallback = this.d;
        if (nRtcCallback != null) {
            nRtcCallback.onVideoFpsReported(j, i);
        }
    }

    @Override
    public boolean onVideoFrameFilter(VideoFrame videoFrame, VideoFrame[] videoFrameArr, VideoFilterParameter videoFilterParameter) {
        NRtcCallback nRtcCallback = this.d;
        if (nRtcCallback != null) {
            return nRtcCallback.onVideoFrameFilter(videoFrame, videoFrameArr, videoFilterParameter);
        }
        return false;
    }

    @Override
    public void onVideoFrameResolutionChanged(long j, int i, int i2, int i3) {
        NRtcCallback nRtcCallback = this.d;
        if (nRtcCallback != null) {
            nRtcCallback.onVideoFrameResolutionChanged(j, i, i2, i3);
        }
    }

    @Override
    public int pauseAudioMixing() {
        IRtcEngine iRtcEngine = this.e;
        return iRtcEngine == null ? RtcCode.ERR_UNINITIALIZED : iRtcEngine.pauseAudioMixing();
    }

    @Override
    public int playAudioEffect(int i, int i2, boolean z, float f) {
        IRtcEngine iRtcEngine = this.e;
        return iRtcEngine == null ? RtcCode.ERR_UNINITIALIZED : iRtcEngine.playAudioEffect(i, i2, z, f);
    }

    @Override
    public void preloadAudioEffect(int i, String str) {
        IRtcEngine iRtcEngine = this.e;
        if (iRtcEngine != null) {
            iRtcEngine.preloadAudioEffect(i, str);
        }
    }

    @Override
    public int publishVideo() {
        IRtcEngine iRtcEngine = this.e;
        if (iRtcEngine != null) {
            return iRtcEngine.publishVideo();
        }
        return -1;
    }

    @Override
    public int pushExternalAudioData(byte[] bArr, int i, int i2, int i3, int i4, boolean z) throws NullPointerException, IllegalArgumentException {
        IRtcEngine iRtcEngine = this.e;
        return iRtcEngine == null ? RtcCode.ERR_UNINITIALIZED : iRtcEngine.pushExternalAudioData(bArr, i, i2, i3, i4, z);
    }

    @Override
    public int pushExternalAudioMixingStream(byte[] bArr, int i, int i2, int i3) {
        IRtcEngine iRtcEngine = this.e;
        return iRtcEngine == null ? RtcCode.ERR_UNINITIALIZED : iRtcEngine.pushExternalAudioMixingStream(bArr, i, i2, i3);
    }

    @Override
    public void rate(int i, String str) {
        IRtcEngine iRtcEngine = this.e;
        if (iRtcEngine == null) {
            return;
        }
        iRtcEngine.rate(i, str);
    }

    @Override
    public boolean registerPlayAudioCallBack(IPlayAudioCallBack iPlayAudioCallBack) {
        IRtcEngine iRtcEngine = this.e;
        return iRtcEngine != null && iRtcEngine.registerPlayAudioCallBack(iPlayAudioCallBack);
    }

    @Override
    public boolean registerRemoteAudioCallBack(long j, IRemoteAudioCallBack iRemoteAudioCallBack) {
        IRtcEngine iRtcEngine = this.e;
        return iRtcEngine != null && iRtcEngine.registerRemoteAudioCallBack(j, iRemoteAudioCallBack);
    }

    @Override
    public boolean remoteAudioStreamMuted(long j) {
        IRtcEngine iRtcEngine = this.e;
        return iRtcEngine != null && iRtcEngine.remoteAudioStreamMuted(j);
    }

    @Override
    public boolean remoteVideoStreamMuted(long j) {
        IRtcEngine iRtcEngine = this.e;
        return iRtcEngine != null && iRtcEngine.remoteVideoStreamMuted(j);
    }

    @Override
    public int resumeAudioMixing() {
        IRtcEngine iRtcEngine = this.e;
        return iRtcEngine == null ? RtcCode.ERR_UNINITIALIZED : iRtcEngine.resumeAudioMixing();
    }

    @Override
    public int seekAudioMixing(long j) {
        IRtcEngine iRtcEngine = this.e;
        return iRtcEngine == null ? RtcCode.ERR_UNINITIALIZED : iRtcEngine.seekAudioMixing(j);
    }

    @Override
    public void selectAudioDevice(int i) {
        IRtcEngine iRtcEngine = this.e;
        if (iRtcEngine != null) {
            iRtcEngine.selectAudioDevice(i);
        }
    }

    @Override
    public void setAsMainArea(long j, final NRtcRoomServerCallback nRtcRoomServerCallback) {
        IRtcEngine iRtcEngine = this.e;
        if (iRtcEngine != null) {
            iRtcEngine.setAsMainArea(j, new IRtcRoomServerHandler() {
                @Override
                public final void onResult(int i, String str) {
                    b.this.a(nRtcRoomServerCallback, i, str);
                }
            });
        } else if (nRtcRoomServerCallback != null) {
            nRtcRoomServerCallback.onResult(RtcCode.ERR_UNINITIALIZED, "mEngine == null");
        }
    }

    @Override
    public int setAudioMixingPlaybackVolume(float f) {
        IRtcEngine iRtcEngine = this.e;
        return iRtcEngine == null ? RtcCode.ERR_UNINITIALIZED : iRtcEngine.setAudioMixingPlaybackVolume(f);
    }

    @Override
    public int setAudioMixingSendVolume(float f) {
        IRtcEngine iRtcEngine = this.e;
        return iRtcEngine == null ? RtcCode.ERR_UNINITIALIZED : iRtcEngine.setAudioMixingSendVolume(f);
    }

    @Override
    public int setAutoPublish(boolean z, boolean z2) {
        IRtcEngine iRtcEngine = this.e;
        if (iRtcEngine == null) {
            return -1;
        }
        return iRtcEngine.setAutoPublish(z, z2);
    }

    @Override
    public int setChannelProfile(int i) {
        IRtcEngine iRtcEngine = this.e;
        return iRtcEngine == null ? RtcCode.ERR_UNINITIALIZED : iRtcEngine.setChannelProfile(i);
    }

    @Override
    public int setExternalAudioMixingStream(boolean z, boolean z2, boolean z3) {
        IRtcEngine iRtcEngine = this.e;
        return iRtcEngine == null ? RtcCode.ERR_UNINITIALIZED : iRtcEngine.setExternalAudioMixingStream(z, z2, z3);
    }

    @Override
    public int setExternalAudioSource(boolean z) {
        IRtcEngine iRtcEngine = this.e;
        return iRtcEngine == null ? RtcCode.ERR_UNINITIALIZED : iRtcEngine.setExternalAudioSource(z);
    }

    @Override
    public int setLocalVideoSimulcastModel(int i) {
        IRtcEngine iRtcEngine = this.e;
        if (iRtcEngine != null) {
            return iRtcEngine.setLocalVideoSimulcastModel(i);
        }
        return -1;
    }

    @Override
    public int setMicrophoneMute(boolean z) {
        IRtcEngine iRtcEngine = this.e;
        return iRtcEngine == null ? RtcCode.ERR_UNINITIALIZED : iRtcEngine.setMicrophoneMute(z);
    }

    @Override
    public void setNetworkProxy(NRtcNetworkProxy nRtcNetworkProxy) {
        this.o = nRtcNetworkProxy;
    }

    @Override
    public <T> void setParameter(NRtcParameters.Key<T> key, T t) throws IllegalArgumentException {
        Checker.checkNotNull(key, "key is null");
        NRtcParameters nRtcParameters = new NRtcParameters();
        nRtcParameters.set(key, t);
        a(nRtcParameters);
        IRtcEngine iRtcEngine = this.e;
        if (iRtcEngine != null) {
            iRtcEngine.setParameters(nRtcParameters.getRawParameters());
        }
    }

    @Override
    public void setParameters(NRtcParameters nRtcParameters) throws IllegalArgumentException {
        Checker.checkArgument(nRtcParameters != null, "parameters is null");
        a(nRtcParameters);
        IRtcEngine iRtcEngine = this.e;
        if (iRtcEngine != null) {
            iRtcEngine.setParameters(nRtcParameters.getRawParameters());
        }
    }

    @Override
    public int setPlayCapturedAudioVolume(float f) {
        IRtcEngine iRtcEngine = this.e;
        return iRtcEngine == null ? RtcCode.ERR_UNINITIALIZED : iRtcEngine.setPlayCapturedAudioVolume(f);
    }

    @Override
    public int setPublishFallbackOption(int i) {
        IRtcEngine iRtcEngine = this.e;
        if (iRtcEngine == null) {
            return -1;
        }
        return iRtcEngine.setPublishFallbackOption(i);
    }

    @Override
    public int setRole(int i) {
        IRtcEngine iRtcEngine = this.e;
        return iRtcEngine == null ? RtcCode.ERR_UNINITIALIZED : iRtcEngine.setRole(i);
    }

    @Override
    public int setSpeaker(boolean z) {
        IRtcEngine iRtcEngine = this.e;
        if (iRtcEngine == null) {
            return RtcCode.ERR_UNINITIALIZED;
        }
        int speakerphoneOn = iRtcEngine.setSpeakerphoneOn(z);
        return speakerphoneOn == 0 ? speakerEnabled() == z ? 0 : -1 : speakerphoneOn;
    }

    @Override
    public int setVideoQualityStrategy(int i) {
        IRtcEngine iRtcEngine = this.e;
        return iRtcEngine == null ? RtcCode.ERR_UNINITIALIZED : iRtcEngine.setVideoQualityStrategy(i);
    }

    @Override
    public int setupLocalVideoRenderer(IVideoRender iVideoRender, int i, boolean z) {
        IRtcEngine iRtcEngine = this.e;
        return iRtcEngine == null ? RtcCode.ERR_UNINITIALIZED : iRtcEngine.setupLocalVideoRenderer(iVideoRender, i, z);
    }

    @Override
    public int setupRemoteVideoRenderer(IVideoRender iVideoRender, long j, int i, boolean z) {
        IRtcEngine iRtcEngine = this.e;
        return iRtcEngine == null ? RtcCode.ERR_UNINITIALIZED : iRtcEngine.setupRemoteVideoRenderer(iVideoRender, j, i, z);
    }

    @Override
    public int setupVideoCapturer(IVideoCapturer iVideoCapturer) {
        IRtcEngine iRtcEngine = this.e;
        return iRtcEngine == null ? RtcCode.ERR_UNINITIALIZED : iRtcEngine.setupVideoCapturer(iVideoCapturer);
    }

    @Override
    public boolean speakerEnabled() {
        IRtcEngine iRtcEngine = this.e;
        return iRtcEngine != null && iRtcEngine.isSpeakerphoneOn();
    }

    @Override
    public int startAVRecording(long j) {
        IRtcEngine iRtcEngine = this.e;
        return iRtcEngine == null ? RtcCode.ERR_UNINITIALIZED : iRtcEngine.startAVRecording(j);
    }

    @Override
    public int startAudioMixing(String str, boolean z, boolean z2, int i, float f) {
        IRtcEngine iRtcEngine = this.e;
        return iRtcEngine == null ? RtcCode.ERR_UNINITIALIZED : iRtcEngine.startAudioMixing(str, z, z2, i, f);
    }

    @Override
    public int startAudioRecording() {
        IRtcEngine iRtcEngine = this.e;
        return iRtcEngine == null ? RtcCode.ERR_UNINITIALIZED : iRtcEngine.startAudioRecording();
    }

    @Override
    public int startPlayCapturedAudio() {
        IRtcEngine iRtcEngine = this.e;
        return iRtcEngine == null ? RtcCode.ERR_UNINITIALIZED : iRtcEngine.startPlayCapturedAudio();
    }

    @Override
    public int startVideoPreview() {
        IRtcEngine iRtcEngine = this.e;
        return iRtcEngine == null ? RtcCode.ERR_UNINITIALIZED : iRtcEngine.startVideoPreview();
    }

    @Override
    public int stopAVRecording(long j) {
        IRtcEngine iRtcEngine = this.e;
        return iRtcEngine == null ? RtcCode.ERR_UNINITIALIZED : iRtcEngine.stopAVRecording(j);
    }

    @Override
    public int stopAudioMixing() {
        IRtcEngine iRtcEngine = this.e;
        return iRtcEngine == null ? RtcCode.ERR_UNINITIALIZED : iRtcEngine.stopAudioMixing();
    }

    @Override
    public int stopAudioRecording() {
        IRtcEngine iRtcEngine = this.e;
        return iRtcEngine == null ? RtcCode.ERR_UNINITIALIZED : iRtcEngine.stopAudioRecording();
    }

    @Override
    public int stopPlayAudioEffect(int i) {
        IRtcEngine iRtcEngine = this.e;
        return iRtcEngine == null ? RtcCode.ERR_UNINITIALIZED : iRtcEngine.stopPlayAudioEffect(i);
    }

    @Override
    public int stopPlayCapturedAudio() {
        IRtcEngine iRtcEngine = this.e;
        return iRtcEngine == null ? RtcCode.ERR_UNINITIALIZED : iRtcEngine.stopPlayCapturedAudio();
    }

    @Override
    public int stopVideoPreview() {
        IRtcEngine iRtcEngine = this.e;
        return iRtcEngine == null ? RtcCode.ERR_UNINITIALIZED : iRtcEngine.stopVideoPreview();
    }

    @Override
    public int subscribeActiveAudio() {
        IRtcEngine iRtcEngine = this.e;
        if (iRtcEngine == null) {
            return -1;
        }
        return iRtcEngine.subscribeActiveAudio();
    }

    @Override
    public int subscribeVideo(long j, int i) {
        IRtcEngine iRtcEngine = this.e;
        if (iRtcEngine == null) {
            return -1;
        }
        return iRtcEngine.subscribeVideo(j, i);
    }

    @Override
    public int switchCommunicateMode(int i) {
        IRtcEngine iRtcEngine = this.e;
        if (iRtcEngine == null) {
            return 0;
        }
        return iRtcEngine.switchCommunicateMode(i);
    }

    @Override
    public int takeSnapshot(long j) {
        IRtcEngine iRtcEngine = this.e;
        return iRtcEngine == null ? RtcCode.ERR_UNINITIALIZED : iRtcEngine.takeSnapshot(j);
    }

    @Override
    public int unpublishVideo() {
        IRtcEngine iRtcEngine = this.e;
        if (iRtcEngine != null) {
            return iRtcEngine.unpublishVideo();
        }
        return -1;
    }

    @Override
    public int unsubscribeActiveAudio() {
        IRtcEngine iRtcEngine = this.e;
        if (iRtcEngine == null) {
            return -1;
        }
        return iRtcEngine.unsubscribeActiveAudio();
    }

    @Override
    public int unsubscribeVideo(long j) {
        IRtcEngine iRtcEngine = this.e;
        if (iRtcEngine == null) {
            return -1;
        }
        return iRtcEngine.unsubscribeVideo(j);
    }

    @Override
    public int updateSharedEGLContext(EGLContext eGLContext) {
        IRtcEngine iRtcEngine = this.e;
        return iRtcEngine == null ? RtcCode.ERR_UNINITIALIZED : iRtcEngine.updateSharedEGLContext(eGLContext);
    }

    private String a(String str) {
        String absolutePath;
        if (StringUtils.isNotEmpty(str)) {
            try {
                File file = new File(str);
                FileUtils.forceMkdir(file);
                absolutePath = file.getAbsolutePath();
            } catch (Exception unused) {
            }
            if (StringUtils.isEmpty(absolutePath)) {
                return absolutePath;
            }
            File externalFilesDir = this.c.getExternalFilesDir("log");
            if (externalFilesDir == null || -1 == this.c.getPackageManager().checkPermission("android.permission.WRITE_EXTERNAL_STORAGE", this.c.getPackageName())) {
                externalFilesDir = this.c.getDir("log", 0);
            }
            return externalFilesDir.getAbsolutePath();
        }
        absolutePath = null;
        if (StringUtils.isEmpty(absolutePath)) {
        }
    }

    @Override
    public boolean onVideoFrameFilter(com.netease.nrtc.sdk.common.VideoFrame videoFrame, boolean z) {
        NRtcCallback nRtcCallback = this.d;
        if (nRtcCallback != null) {
            return nRtcCallback.onVideoFrameFilter(videoFrame, z);
        }
        return false;
    }

    @Override
    public int startAudioRecording(int i) {
        IRtcEngine iRtcEngine = this.e;
        return iRtcEngine == null ? RtcCode.ERR_UNINITIALIZED : iRtcEngine.startAudioRecording(i);
    }

    @Override
    public int updateSharedEGLContext(android.opengl.EGLContext eGLContext) {
        IRtcEngine iRtcEngine = this.e;
        return iRtcEngine == null ? RtcCode.ERR_UNINITIALIZED : iRtcEngine.updateSharedEGLContext(eGLContext);
    }

    public static void b(NRtcRoomServerCallback nRtcRoomServerCallback, int i, String str) {
        if (nRtcRoomServerCallback != null) {
            nRtcRoomServerCallback.onResult(i, str);
        }
    }

    public void b(RtcConfig rtcConfig) {
        if (this.e != null && this.a.get() == 2) {
            r2 = this.e.joinChannel(rtcConfig, this.p) == 0;
            this.a.set(3);
        }
        if (r2) {
            return;
        }
        Trace.e("NRtcImpl", "joint channel return false ");
        b(3, -10);
    }

    private void a(NRtcParameters nRtcParameters) {
        RtcParameters rawParameters = nRtcParameters.getRawParameters();
        if (rawParameters.containsKey(RtcParameters.KEY_SESSION_MULTI_MODE)) {
            this.h = nRtcParameters.getBoolean(NRtcParameters.KEY_SESSION_MULTI_MODE);
        }
        if (rawParameters.containsKey(RtcParameters.KEY_SERVER_AUDIO_RECORD)) {
            this.i = nRtcParameters.getBoolean(NRtcParameters.KEY_SERVER_AUDIO_RECORD);
        }
        if (rawParameters.containsKey(RtcParameters.KEY_SERVER_VIDEO_RECORD)) {
            this.j = nRtcParameters.getBoolean(NRtcParameters.KEY_SERVER_VIDEO_RECORD);
        }
        if (rawParameters.containsKey(RtcParameters.KEY_SERVER_RECORD_SPEAKER)) {
            this.k = nRtcParameters.getBoolean(NRtcParameters.KEY_SERVER_RECORD_SPEAKER);
        }
        if (rawParameters.containsKey(RtcParameters.KEY_SESSION_LIVE_MODE)) {
            this.l = nRtcParameters.getBoolean(NRtcParameters.KEY_SESSION_LIVE_MODE);
        }
        if (rawParameters.containsKey(RtcParameters.KEY_NET_P2P)) {
            this.m = rawParameters.getBoolean(RtcParameters.KEY_NET_P2P);
            rawParameters.removeParameters(RtcParameters.KEY_NET_P2P);
        }
        if (rawParameters.containsKey(RtcParameters.KEY_SESSION_PRIVATE_SERVER)) {
            b = rawParameters.getString(RtcParameters.KEY_SESSION_PRIVATE_SERVER);
            rawParameters.removeParameters(RtcParameters.KEY_SESSION_PRIVATE_SERVER);
        }
        if (rawParameters.containsKey(RtcParameters.KEY_DISPATCHER_FORWARDED_IP)) {
            this.s = l.c(this.c) ? rawParameters.getString(RtcParameters.KEY_DISPATCHER_FORWARDED_IP) : null;
            rawParameters.removeParameters(RtcParameters.KEY_DISPATCHER_FORWARDED_IP);
            Trace.d("NRtcImpl", "forward ip : " + this.s);
        }
    }

    public void a(final NRtcRoomServerCallback nRtcRoomServerCallback, final int i, final String str) {
        Handler handler = this.f;
        if (handler != null) {
            handler.post(new Runnable() {
                @Override
                public final void run() {
                    b.b(NRtcRoomServerCallback.this, i, str);
                }
            });
        }
    }

    private int a(String str, String str2, long j) {
        final a aVar = new a(str, str2, j, this.n, this.h, this.l);
        ThreadUtils.runOnThread(j.b().f(), new Runnable() {
            @Override
            public final void run() {
                b.this.b(aVar);
            }
        });
        return 0;
    }

    public void b(a aVar) {
        String str;
        boolean z;
        final int i;
        String str2;
        final int i2;
        int i3;
        Trace.i("NRtcImpl", "request with req");
        i iVar = null;
        HttpStack.HttpStackResponse httpStackResponse = null;
        int i4 = -1;
        while (true) {
            str = "";
            z = false;
            i = 1;
            if (httpStackResponse != null && httpStackResponse.code == 200) {
                break;
            }
            int i5 = i4 + 1;
            if (i4 >= 3) {
                break;
            }
            int pow = i5 == 0 ? 0 : ((int) Math.pow(2.0d, i5)) * 400;
            Trace.i("NRtcImpl", "request rtc info delay: " + pow);
            if (pow > 0) {
                try {
                    Thread.sleep(pow);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
            String a2 = aVar.a(this.c);
            if (TextUtils.isEmpty(a2)) {
                str2 = "encode query failed";
                i2 = -1;
                i3 = 1;
                break;
            }
            HashMap hashMap = new HashMap();
            if (!TextUtils.isEmpty(this.s)) {
                hashMap.put("X-Forwarded-For", this.s);
            }
            httpStackResponse = HttpStack.doPost(a2, hashMap, null, TbsReaderView.ReaderCallback.GET_BAR_ANIMATING);
            i4 = i5;
        }
        str2 = "";
        i2 = 0;
        i3 = 0;
        if (i3 == 0) {
            if (httpStackResponse == null) {
                i2 = -2;
                str2 = "http response is null";
            } else {
                int i6 = httpStackResponse.code;
                if (i6 != 200) {
                    str2 = "http failed ->" + httpStackResponse.code;
                    i2 = i6;
                } else {
                    try {
                        iVar = new i(httpStackResponse.result);
                    } catch (Exception e2) {
                        str = e2.getMessage();
                    }
                    if (iVar == null) {
                        i2 = -3;
                        str2 = "parse config failed " + str;
                    } else if (iVar.c() != 200) {
                        i2 = iVar.c();
                        str2 = "get config ->" + iVar.c() + " # " + iVar.d();
                    } else {
                        RtcConfig b2 = iVar.b();
                        this.g = b2.channel;
                        b2.userId = aVar.a;
                        b2.userType = (byte) 3;
                        b2.peerUserType = (byte) 3;
                        b2.encrypt_type = 0;
                        this.i = this.i && iVar.a();
                        this.j = this.j && iVar.a();
                        if (this.k && iVar.a()) {
                            z = true;
                        }
                        this.k = z;
                        RtcParameters rtcParameters = new RtcParameters();
                        rtcParameters.setObject(RtcParameters.KEY_SERVER_AUDIO_RECORD, Boolean.valueOf(this.i));
                        rtcParameters.setObject(RtcParameters.KEY_SERVER_VIDEO_RECORD, Boolean.valueOf(this.j));
                        rtcParameters.setObject(RtcParameters.KEY_SERVER_RECORD_SPEAKER, Boolean.valueOf(this.k));
                        if (!this.m && l.c(this.c)) {
                            b2.p2p = this.m;
                        }
                        if (this.o != null) {
                            RtcNetworkProxy rtcNetworkProxy = new RtcNetworkProxy();
                            NRtcNetworkProxy nRtcNetworkProxy = this.o;
                            rtcNetworkProxy.scheme = nRtcNetworkProxy.scheme;
                            rtcNetworkProxy.userName = nRtcNetworkProxy.userName;
                            rtcNetworkProxy.userPassword = nRtcNetworkProxy.userPassword;
                            rtcNetworkProxy.host = nRtcNetworkProxy.host;
                            rtcNetworkProxy.port = nRtcNetworkProxy.port;
                            b2.networkProxy = rtcNetworkProxy;
                        }
                        IRtcEngine iRtcEngine = this.e;
                        if (iRtcEngine != null) {
                            iRtcEngine.setParameters(rtcParameters);
                        }
                        a(b2);
                    }
                }
            }
            if (i == 0) {
                Trace.e("NRtcImpl", "joint channel error {" + str2 + "}");
                Handler handler = this.f;
                if (handler != null) {
                    handler.post(new Runnable() {
                        @Override
                        public final void run() {
                            b.this.b(i, i2);
                        }
                    });
                    return;
                }
                return;
            }
            return;
        }
        i = i3;
        if (i == 0) {
        }
    }

    private void a(final RtcConfig rtcConfig) {
        ThreadUtils.runOnThread(this.f, new Runnable() {
            @Override
            public final void run() {
                b.this.b(rtcConfig);
            }
        });
    }

    public void b(int i, int i2) {
        if (this.d != null) {
            Trace.e("NRtcImpl", "onError(" + i + "#" + i2 + C5923.C5925.f19790);
            this.d.onError(i, i2);
        }
    }

    public void a(int i, RtcConfig rtcConfig) {
        IRtcEngine iRtcEngine;
        if (i != 200 || (iRtcEngine = this.e) == null) {
            return;
        }
        iRtcEngine.setNewLoginConfig(rtcConfig);
    }

    private static RtcServerAddresses a(NRtcServerAddresses nRtcServerAddresses, Context context) {
        if (nRtcServerAddresses != null) {
            RtcServerAddresses rtcServerAddresses = new RtcServerAddresses();
            rtcServerAddresses.channelServer = nRtcServerAddresses.channelServer;
            rtcServerAddresses.compatServer = nRtcServerAddresses.compatServer;
            rtcServerAddresses.functionServer = nRtcServerAddresses.functionServer;
            rtcServerAddresses.netDetectServer = nRtcServerAddresses.netDetectServer;
            rtcServerAddresses.roomServer = nRtcServerAddresses.roomServer;
            rtcServerAddresses.statisticsServer = nRtcServerAddresses.statisticsServer;
            rtcServerAddresses.nosLbsServer = nRtcServerAddresses.nosLbsServer;
            rtcServerAddresses.nosDefaultUploadSever = nRtcServerAddresses.nosDefaultUploadSever;
            rtcServerAddresses.nosTokenServer = nRtcServerAddresses.nosTokenServer;
            rtcServerAddresses.reLoginConfigServer = nRtcServerAddresses.reLoginConfigServer;
            rtcServerAddresses.eventReportServer = nRtcServerAddresses.eventReportServer;
            return rtcServerAddresses;
        }
        return RtcPrivatizationConfig.getServerAddress(context);
    }
}