智慧城市 v1.2.1版本的 MD5 值为:d4aeacb5153a2710d0b6882be5dd2b15
以下内容为反编译后的 MediaSignalWrapper.java 源代码,内容仅作参考
package cn.rongcloud.rtc.signal;
import android.os.Build;
import android.text.TextUtils;
import android.util.Log;
import cn.rongcloud.rtc.api.callback.IRCRTCResultCallback;
import cn.rongcloud.rtc.api.callback.IRCRTCResultDataCallback;
import cn.rongcloud.rtc.base.AsyncResult;
import cn.rongcloud.rtc.base.RCRTCAVStreamType;
import cn.rongcloud.rtc.base.RCRTCParamsType;
import cn.rongcloud.rtc.base.RCRTCRoomType;
import cn.rongcloud.rtc.base.RTCErrorCode;
import cn.rongcloud.rtc.center.stream.RCMicOutputStreamImpl;
import cn.rongcloud.rtc.core.SessionDescription;
import cn.rongcloud.rtc.engine.RTCEngineImpl;
import cn.rongcloud.rtc.media.http.HttpClient;
import cn.rongcloud.rtc.media.http.Request;
import cn.rongcloud.rtc.proxy.message.messagebeans.ExchangeSDPDataResult;
import cn.rongcloud.rtc.proxy.message.messagebeans.MediaResourceInfo;
import cn.rongcloud.rtc.proxy.message.messagebeans.SubscribeLiveDataResult;
import cn.rongcloud.rtc.sniffer.SnifferInfo;
import cn.rongcloud.rtc.sniffer.SnifferListener;
import cn.rongcloud.rtc.sniffer.SnifferManager;
import cn.rongcloud.rtc.utils.DeviceUtils;
import cn.rongcloud.rtc.utils.FinLog;
import cn.rongcloud.rtc.utils.RCConsts;
import cn.rongcloud.rtc.utils.ReportUtil;
import cn.rongcloud.rtc.utils.RongRTCUtils;
import cn.rongcloud.rtc.webrtc.ILocalVideoStreamResource;
import cn.rongcloud.rtc.webrtc.IRemoteVideoStreamResource;
import cn.rongcloud.rtc.webrtc.IStreamResource;
import io.rong.common.RLog;
import io.rong.imlib.IMLibRTCClient;
import io.rong.imlib.IRongCoreListener;
import io.rong.imlib.common.RongLibConst;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public class MediaSignalWrapper {
private static String CHANGERESOLUTION = "/server/resolution/change";
private static final int ENGINE_RTC = 4;
private static String EXCHANGE_SDP = "/exchange";
private static String EXIT = "/exit";
private static final String FEATURE_SUPPORT_OBFUSCATION = "Udp-Obfuscation";
private static final String HEAD_CLIENT_SESSION_ID = "Client-Session-Id";
private static final String HEAD_REQUEST_ID = "Request-Id";
private static final int LIVE_ROOM_TYPE = 2;
private static final String PREFIX_HTTPS = "https://";
private static final int RESPONSE_OK = 10000;
private static String RONG_RTC_CONFIG_SERVER_URL = "MESERVER";
private static String RONG_RTC_MEDIA_SERVER_URL = "";
private static final String TAG = "MediaSignalWrapper";
private static String mediaServer;
private String clusterId;
private boolean isSniffing;
private IMSignalWrapper mImSignal;
private IUpdateUdpObfuscationKeyListener mObfuscationKeyListener;
private String[] mOrderedMediaServer;
private int maxStreamCount;
private int mediaServerIndex;
private String rtcToken;
private final String SUBSCRIBE_LIVE_SDP = "/broadcast/subscribe ";
private final String EXIT_LIVE = "/broadcast/exit ";
private long lastSnifferTime = 0;
private final int TWO_HOURS = 7200000;
private int retry = 0;
private int getBackupMediaServerIndex() {
return 0;
}
static int access$808(MediaSignalWrapper mediaSignalWrapper) {
int i = mediaSignalWrapper.retry;
mediaSignalWrapper.retry = i + 1;
return i;
}
public MediaSignalWrapper(IMSignalWrapper iMSignalWrapper, IUpdateUdpObfuscationKeyListener iUpdateUdpObfuscationKeyListener) {
this.mObfuscationKeyListener = iUpdateUdpObfuscationKeyListener;
this.mImSignal = iMSignalWrapper;
}
public String getRtcToken() {
return this.rtcToken;
}
public void setRtcToken(String str) {
ReportUtil.TAG tag = ReportUtil.TAG.GETRTCTOKEN;
ReportUtil.libStatus(tag, "desc", "MediaSignalWrapper.setRtcToken : " + str);
this.rtcToken = str;
}
public void setMediaServerUrl(String str) {
RONG_RTC_MEDIA_SERVER_URL = str;
FinLog.d(TAG, "setMediaServerUrl as:: " + str);
}
private String getMediaServer() {
String str;
if (TextUtils.isEmpty(this.clusterId)) {
if (!TextUtils.isEmpty(RONG_RTC_MEDIA_SERVER_URL)) {
return RONG_RTC_MEDIA_SERVER_URL;
}
String[] strArr = this.mOrderedMediaServer;
if (strArr == null || strArr.length == 0) {
FinLog.i(TAG, "getMediaServer() return null !");
parseVoIPInfo();
String[] strArr2 = this.mOrderedMediaServer;
if (strArr2 == null || strArr2.length == 0) {
return null;
}
}
int i = 0;
while (true) {
String[] strArr3 = this.mOrderedMediaServer;
if (i >= strArr3.length) {
str = "";
break;
} else if (!TextUtils.isEmpty(strArr3[i])) {
str = this.mOrderedMediaServer[i];
break;
} else {
i++;
}
}
FinLog.i(TAG, "Valid media server address :" + str);
return str;
}
return this.clusterId;
}
public void onIMConnectChanged(IRongCoreListener.ConnectionStatusListener.ConnectionStatus connectionStatus) {
RLog.i(TAG, "onIMConnectChanged status " + connectionStatus);
if (this.mOrderedMediaServer == null && connectionStatus == IRongCoreListener.ConnectionStatusListener.ConnectionStatus.CONNECTED) {
parseVoIPInfo();
}
if (!(System.currentTimeMillis() - this.lastSnifferTime >= 7200000) || connectionStatus != IRongCoreListener.ConnectionStatusListener.ConnectionStatus.CONNECTED || RTCEngineImpl.getInstance().isInRoom() || TextUtils.isEmpty(mediaServer)) {
return;
}
RLog.i(TAG, "onIMConnectChanged sniff ");
this.isSniffing = true;
this.lastSnifferTime = System.currentTimeMillis();
SnifferManager.getInstance().snifferServer(mediaServer, new SnifferListener() {
@Override
public void onSuccess(SnifferInfo snifferInfo) {
RLog.i(MediaSignalWrapper.TAG, "sniff success() :");
MediaSignalWrapper mediaSignalWrapper = MediaSignalWrapper.this;
mediaSignalWrapper.printOrderedServer("before sniff host add ", mediaSignalWrapper.mOrderedMediaServer);
try {
int length = MediaSignalWrapper.this.mOrderedMediaServer.length - MediaSignalWrapper.this.mediaServerIndex;
String[] strArr = new String[snifferInfo.getOrderedHosts().size() + length];
String[] strArr2 = (String[]) snifferInfo.getOrderedHosts().toArray(new String[0]);
System.arraycopy(strArr2, 0, strArr, 0, strArr2.length);
System.arraycopy(MediaSignalWrapper.this.mOrderedMediaServer, MediaSignalWrapper.this.mediaServerIndex, strArr, strArr2.length, length);
MediaSignalWrapper.this.mediaServerIndex = strArr2.length;
MediaSignalWrapper.this.mOrderedMediaServer = strArr;
} catch (Exception e) {
FinLog.e(MediaSignalWrapper.TAG, "handle sniffer result error: " + e.getMessage());
}
MediaSignalWrapper mediaSignalWrapper2 = MediaSignalWrapper.this;
mediaSignalWrapper2.printOrderedServer("after sniff host add ", mediaSignalWrapper2.mOrderedMediaServer);
MediaSignalWrapper.this.isSniffing = false;
}
@Override
public void onFailed() {
MediaSignalWrapper.this.isSniffing = false;
RLog.i(MediaSignalWrapper.TAG, "sniff failed()");
}
});
}
private void parseVoIPInfo() {
int optInt;
if (RONG_RTC_CONFIG_SERVER_URL.contains("http")) {
mediaServer = RONG_RTC_CONFIG_SERVER_URL;
FinLog.i(TAG, "Change mediaServer as configured: " + mediaServer);
}
if (!TextUtils.isEmpty(RONG_RTC_MEDIA_SERVER_URL)) {
mediaServer = RONG_RTC_MEDIA_SERVER_URL;
FinLog.i(TAG, "Change mediaServer as set: " + mediaServer);
}
if (!TextUtils.isEmpty(mediaServer)) {
this.mOrderedMediaServer = r0;
String[] strArr = {mediaServer};
mediaServer = solveAddress();
return;
}
try {
String voIPInfo = IMLibRTCClient.getInstance().getVoIPInfo();
if (TextUtils.isEmpty(voIPInfo)) {
FinLog.e(TAG, "Can't get VoIP info: please check whether is VoIP service available!!");
return;
}
ReportUtil.libStatus(ReportUtil.TAG.RTCNAVIDATA, "navi", voIPInfo);
JSONArray jSONArray = new JSONObject(voIPInfo).getJSONArray("callEngine");
boolean z = false;
for (int i = 0; i < jSONArray.length(); i++) {
JSONObject jSONObject = (JSONObject) jSONArray.get(i);
if (jSONObject.getInt("engineType") == 4) {
String string = jSONObject.getString("mediaServer");
mediaServer = string;
this.mOrderedMediaServer = r9;
String[] strArr2 = {string};
this.maxStreamCount = jSONObject.getInt("maxStreamCount");
JSONArray optJSONArray = jSONObject.optJSONArray("backupMediaServer");
FinLog.i(TAG, "backupMediaServers::" + optJSONArray);
if (optJSONArray != null) {
int length = optJSONArray.length();
int length2 = this.mOrderedMediaServer.length;
String[] strArr3 = new String[length2 + length];
for (int i2 = 0; i2 < length2; i2++) {
strArr3[i2] = this.mOrderedMediaServer[i2];
}
for (int i3 = 0; i3 < length; i3++) {
strArr3[length2 + i3] = optJSONArray.optString(i3);
}
this.mOrderedMediaServer = strArr3;
}
if (jSONObject.has("timeOut") && (optInt = jSONObject.optInt("timeOut")) > 0) {
FinLog.d(TAG, "change timeOut as nav config : " + optInt);
HttpClient.getDefault().CONNECT_TIME_OUT = optInt * 1000;
}
mediaServer = solveAddress();
printOrderedServer("nav parseVoIPInfo end ", this.mOrderedMediaServer);
z = true;
}
}
if (z) {
return;
}
FinLog.e(TAG, "Current selection is not RTC Engine. Please check navigation settings:: " + voIPInfo);
} catch (Exception e) {
FinLog.e(TAG, "parseVoIPInfo error: " + e.getMessage());
}
}
public void printOrderedServer(String str, String[] strArr) {
if (strArr == null) {
FinLog.i(TAG, "printOrderedServer orderedServer is null!");
return;
}
StringBuilder sb = new StringBuilder();
for (String str2 : strArr) {
sb.append(str2);
sb.append(", ");
}
FinLog.i(TAG, str + "printOrderedServer: " + sb.substring(0, sb.length() - 2));
}
private String solveAddress() {
if (this.mOrderedMediaServer == null) {
return mediaServer;
}
int i = 0;
while (true) {
String[] strArr = this.mOrderedMediaServer;
if (i < strArr.length) {
String str = strArr[i];
if (!str.contains("http")) {
String[] strArr2 = this.mOrderedMediaServer;
strArr2[i] = PREFIX_HTTPS + str;
}
i++;
} else {
FinLog.d(TAG, "mOrderedMediaServer = " + Arrays.toString(this.mOrderedMediaServer));
return this.mOrderedMediaServer[0];
}
}
}
public void sendSDPOffer(String str, SessionDescription sessionDescription, String str2, List<? extends IStreamResource> list, List<? extends IStreamResource> list2, RCRTCRoomType rCRTCRoomType, String str3, String str4, IRCRTCResultDataCallback<ExchangeSDPDataResult> iRCRTCResultDataCallback) {
sendSDPOffer(str, sessionDescription, getMediaServer(), false, str2, getBackupMediaServerIndex(), list, list2, rCRTCRoomType.getRoomType(), rCRTCRoomType.getMediaType(), str3, str4, iRCRTCResultDataCallback);
}
public void sendSDPOffer(final String str, final SessionDescription sessionDescription, final String str2, final boolean z, final String str3, final int i, final List<? extends IStreamResource> list, final List<? extends IStreamResource> list2, final int i2, final int i3, final String str4, final String str5, final IRCRTCResultDataCallback<ExchangeSDPDataResult> iRCRTCResultDataCallback) {
if (TextUtils.isEmpty(str)) {
if (iRCRTCResultDataCallback != null) {
iRCRTCResultDataCallback.onFailed(RTCErrorCode.RongRTCCodeNotInRoom);
}
} else if (TextUtils.isEmpty(this.rtcToken)) {
ReportUtil.libError(ReportUtil.TAG.SDPEXCHANGE, "roomId|code|desc", str, Integer.valueOf(RTCErrorCode.RongRTCCodeRTCTokenIsNull.getValue()), RTCErrorCode.RongRTCCodeRTCTokenIsNull.getReason());
if (iRCRTCResultDataCallback != null) {
iRCRTCResultDataCallback.onFailed(RTCErrorCode.RongRTCCodeRTCTokenIsNull);
}
} else {
JSONObject jSONObject = new JSONObject();
try {
JSONObject jSONObject2 = new JSONObject();
JSONObject extentInfo = getExtentInfo(list, str5);
JSONArray parseSubscribeList = parseSubscribeList(list2);
ReportUtil.libTask(ReportUtil.TAG.SDPEXCHANGE, "roomId|mediaUrl|isRetry|subList|sdp", str, str2, Boolean.valueOf(z), parseSubscribeList.toString(), sessionDescription.toJsonString());
jSONObject2.put("type", sessionDescription.type.name().toLowerCase());
jSONObject2.put("sdp", sessionDescription.description);
jSONObject.put("sdp", jSONObject2);
jSONObject.put("subscribeList", parseSubscribeList);
jSONObject.put("resolutionInfo", getResolutionInfo(list));
jSONObject.put(RongLibConst.KEY_TOKEN, this.rtcToken);
jSONObject.put("extend", extentInfo);
if ((i2 == RCRTCRoomType.LIVE_AUDIO.getRoomType() || i2 == RCRTCRoomType.LIVE_AUDIO_VIDEO.getRoomType()) && !TextUtils.isEmpty(str4)) {
jSONObject.put("pushOtherRooms", new JSONArray(str4));
FinLog.i(TAG, "sendSDPOffer autoMixJSON: " + str4);
ReportUtil.libStatus(ReportUtil.TAG.SDPEXCHANGE, "pushOtherRooms", str4);
}
FinLog.i(TAG, "sendSDPOffer extend: " + extentInfo);
HttpClient.getDefault().request(getRequest(this.rtcToken, str, i2, str3, EXCHANGE_SDP, str2, jSONObject), new HttpClient.ResultCallback() {
@Override
public void onResponse(String str6) {
String str7;
String str8;
String str9;
String str10;
JSONObject jSONObject3;
String str11 = " , result: ";
try {
try {
try {
JSONObject jSONObject4 = new JSONObject(str6);
int parseInt = Integer.parseInt(jSONObject4.getString("resultCode"));
if (parseInt == 10000) {
MediaSignalWrapper.this.changeMediaServer2ClusterId(str2, jSONObject4);
JSONObject jSONObject5 = jSONObject4.getJSONObject("sdp");
String string = jSONObject5.getString("sdp");
String string2 = jSONObject5.getString("type");
SessionDescription.Type type = SessionDescription.Type.ANSWER;
if (!TextUtils.isEmpty(string2)) {
if (string2.equals("answer")) {
type = SessionDescription.Type.ANSWER;
} else if (string2.equals("offer")) {
type = SessionDescription.Type.OFFER;
}
}
SessionDescription sessionDescription2 = new SessionDescription(type, string);
JSONArray jSONArray = jSONObject4.getJSONArray("publishList");
FinLog.d(MediaSignalWrapper.TAG, "sendSDPOffer success res = \n" + jSONArray.toString());
String str12 = "";
List list3 = null;
if (jSONObject4.has("urls")) {
jSONObject3 = jSONObject4.optJSONObject("urls");
if (jSONObject3 != null) {
str12 = jSONObject3.toString();
}
} else {
jSONObject3 = null;
}
MediaSignalWrapper.this.parseUDPObfuscation(jSONObject4);
List parsePublishList = MediaSignalWrapper.this.parsePublishList(jSONArray);
if (jSONObject4.has("mcuPublishList")) {
jSONArray = jSONObject4.getJSONArray("mcuPublishList");
list3 = MediaSignalWrapper.this.parsePublishList(jSONArray);
}
ReportUtil.libRes(ReportUtil.TAG.SDPEXCHANGE, "roomId|liveInfo|clusterId|code|pubList|sdp", str, str12, MediaSignalWrapper.this.clusterId, 0, jSONArray.toString(), sessionDescription2.toJsonString());
IRCRTCResultDataCallback iRCRTCResultDataCallback2 = iRCRTCResultDataCallback;
if (iRCRTCResultDataCallback2 != null) {
iRCRTCResultDataCallback2.onSuccess(new ExchangeSDPDataResult(sessionDescription2, parsePublishList, jSONObject3, list3));
return;
}
return;
}
RTCErrorCode valueOf = RTCErrorCode.valueOf(parseInt);
if (valueOf != RTCErrorCode.RongRTCCodeTokenExpired && valueOf != RTCErrorCode.RongRTCCodeTokenNotInRoom) {
ReportUtil.libError(ReportUtil.TAG.SDPEXCHANGE, "roomId|code|desc", str, Integer.valueOf(valueOf.getValue()), str6);
IRCRTCResultDataCallback iRCRTCResultDataCallback3 = iRCRTCResultDataCallback;
if (iRCRTCResultDataCallback3 != null) {
iRCRTCResultDataCallback3.onFailed(valueOf);
return;
}
return;
}
ReportUtil.libError(ReportUtil.TAG.SDPEXCHANGE, "roomId|code|desc", str, Integer.valueOf(valueOf.getValue()), str6);
if (MediaSignalWrapper.this.retry > 0) {
MediaSignalWrapper.this.retry = 0;
IRCRTCResultDataCallback iRCRTCResultDataCallback4 = iRCRTCResultDataCallback;
if (iRCRTCResultDataCallback4 != null) {
iRCRTCResultDataCallback4.onFailed(valueOf);
return;
}
return;
}
MediaSignalWrapper.access$808(MediaSignalWrapper.this);
AsyncResult<String> syncGetRTCToken = MediaSignalWrapper.this.mImSignal.syncGetRTCToken(str, i2, i3);
if (syncGetRTCToken.isFailed()) {
MediaSignalWrapper.this.retry = 0;
IRCRTCResultDataCallback iRCRTCResultDataCallback5 = iRCRTCResultDataCallback;
if (iRCRTCResultDataCallback5 != null) {
iRCRTCResultDataCallback5.onFailed(syncGetRTCToken.getErrorCode());
}
}
MediaSignalWrapper.this.rtcToken = syncGetRTCToken.getData();
str8 = "roomId|code|desc";
try {
str7 = " , result: ";
try {
MediaSignalWrapper.this.sendSDPOffer(str, sessionDescription, str2, z, str3, i, list, list2, i2, i3, str4, str5, iRCRTCResultDataCallback);
} catch (JSONException e) {
e = e;
str10 = str6;
str9 = str8;
str11 = str7;
ReportUtil.libError(ReportUtil.TAG.SDPEXCHANGE, str9, str, Integer.valueOf(RTCErrorCode.JsonParseError.getValue()), "Exception: " + e.getMessage() + str11 + str10);
MediaSignalWrapper.this.retrySendSDPOffer(str, sessionDescription, str3, i, RTCErrorCode.JsonParseError, list, list2, i2, i3, str4, str5, iRCRTCResultDataCallback);
} catch (Exception e2) {
e = e2;
ReportUtil.libError(ReportUtil.TAG.SDPEXCHANGE, str8, str, Integer.valueOf(RTCErrorCode.UnknownError.getValue()), "Exception: " + e.getMessage() + str7 + str6);
IRCRTCResultDataCallback iRCRTCResultDataCallback6 = iRCRTCResultDataCallback;
if (iRCRTCResultDataCallback6 != null) {
iRCRTCResultDataCallback6.onFailed(RTCErrorCode.UnknownError);
}
}
} catch (JSONException e3) {
e = e3;
str10 = str6;
str9 = str8;
} catch (Exception e4) {
e = e4;
str7 = " , result: ";
}
} catch (JSONException e5) {
e = e5;
str9 = "roomId|code|desc";
str10 = str6;
}
} catch (JSONException e6) {
e = e6;
str9 = "roomId|code|desc";
str10 = str6;
}
} catch (Exception e7) {
e = e7;
str7 = " , result: ";
str8 = "roomId|code|desc";
}
}
@Override
public void onFailure(int i4) {
ReportUtil.libError(ReportUtil.TAG.SDPEXCHANGE, 2, "roomId|code|desc", str, Integer.valueOf(i4), "sendSDPOffer onFailure");
MediaSignalWrapper.this.retrySendSDPOffer(str, sessionDescription, str3, i, RTCErrorCode.valueOf(i4), list, list2, i2, i3, str4, str5, iRCRTCResultDataCallback);
}
});
} catch (JSONException e) {
e.printStackTrace();
ReportUtil.libError(ReportUtil.TAG.SDPEXCHANGE, "roomId|code|desc", str, Integer.valueOf(RTCErrorCode.RongRTCCodeParameterError.getValue()), e.getMessage());
if (iRCRTCResultDataCallback != null) {
iRCRTCResultDataCallback.onFailed(RTCErrorCode.RongRTCCodeParameterError);
}
}
}
}
public void onResolutionChanged(String str, RCRTCRoomType rCRTCRoomType, String str2, List<? extends IStreamResource> list, final IRCRTCResultCallback iRCRTCResultCallback) {
ReportUtil.libTask(ReportUtil.TAG.RESOLUTIONCHANGED, "roomId|roomType|resolutionInfo", str, rCRTCRoomType, getResolutionInfo(list).toString());
changeResolution(str, rCRTCRoomType.getRoomType(), str2, getMediaServer(), list, -1, new IRCRTCResultDataCallback<String>() {
@Override
public void onSuccess(String str3) {
try {
int parseInt = Integer.parseInt(new JSONObject(str3).getString("resultCode"));
if (parseInt == 10000) {
FinLog.v(MediaSignalWrapper.TAG, "onResolutionChanged() success");
ReportUtil.libRes(ReportUtil.TAG.RESOLUTIONCHANGED, "code", 0);
IRCRTCResultCallback iRCRTCResultCallback2 = iRCRTCResultCallback;
if (iRCRTCResultCallback2 != null) {
iRCRTCResultCallback2.onSuccess();
}
} else {
RTCErrorCode valueOf = RTCErrorCode.valueOf(parseInt);
ReportUtil.libError(ReportUtil.TAG.RESOLUTIONCHANGED, "code|msg", Integer.valueOf(valueOf.getValue()), str3);
IRCRTCResultCallback iRCRTCResultCallback3 = iRCRTCResultCallback;
if (iRCRTCResultCallback3 != null) {
iRCRTCResultCallback3.onFailed(valueOf);
}
}
} catch (Exception e) {
e.printStackTrace();
ReportUtil.libError(ReportUtil.TAG.RESOLUTIONCHANGED, "code|msg", RTCErrorCode.RongRTCCodeParameterError.getReason(), str3);
IRCRTCResultCallback iRCRTCResultCallback4 = iRCRTCResultCallback;
if (iRCRTCResultCallback4 != null) {
iRCRTCResultCallback4.onFailed(RTCErrorCode.RongRTCCodeParameterError);
}
}
}
@Override
public void onFailed(RTCErrorCode rTCErrorCode) {
ReportUtil.libError(ReportUtil.TAG.RESOLUTIONCHANGED, "code|msg", Integer.valueOf(rTCErrorCode.getValue()), rTCErrorCode.getReason());
IRCRTCResultCallback iRCRTCResultCallback2 = iRCRTCResultCallback;
if (iRCRTCResultCallback2 != null) {
iRCRTCResultCallback2.onFailed(rTCErrorCode);
}
}
});
}
public void changeResolution(java.lang.String r16, int r17, java.lang.String r18, java.lang.String r19, java.util.List<? extends cn.rongcloud.rtc.webrtc.IStreamResource> r20, int r21, cn.rongcloud.rtc.api.callback.IRCRTCResultDataCallback<java.lang.String> r22) {
throw new UnsupportedOperationException("Method not decompiled: cn.rongcloud.rtc.signal.MediaSignalWrapper.changeResolution(java.lang.String, int, java.lang.String, java.lang.String, java.util.List, int, cn.rongcloud.rtc.api.callback.IRCRTCResultDataCallback):void");
}
public void quit(String str, RCRTCRoomType rCRTCRoomType, String str2, IRCRTCResultCallback iRCRTCResultCallback) {
quit(str, rCRTCRoomType.getRoomType(), str2, getMediaServer(), iRCRTCResultCallback);
}
private void quit(final String str, int i, String str2, String str3, final IRCRTCResultCallback iRCRTCResultCallback) {
if (TextUtils.isEmpty(str)) {
iRCRTCResultCallback.onFailed(RTCErrorCode.RongRTCCodeNotInRoom);
return;
}
ReportUtil.libTask(ReportUtil.TAG.LEAVEROOM, "roomId|mediaUrl ", str, str3);
String rtcToken = getRtcToken();
setRtcToken(null);
JSONObject jSONObject = new JSONObject();
try {
jSONObject.put(RongLibConst.KEY_TOKEN, rtcToken);
} catch (JSONException e) {
e.printStackTrace();
ReportUtil.libError(ReportUtil.TAG.LEAVEROOM, RTCErrorCode.RongRTCCodeParameterError, "roomId", str);
if (iRCRTCResultCallback != null) {
iRCRTCResultCallback.onFailed(RTCErrorCode.RongRTCCodeParameterError);
}
}
request(rtcToken, str, i, str2, EXIT, str3, jSONObject, false, getBackupMediaServerIndex(), new HttpClient.ResultCallback() {
@Override
public void onResponse(String str4) {
try {
String string = new JSONObject(str4).getString("resultCode");
if (string.equals("10000")) {
ReportUtil.libRes(ReportUtil.TAG.LEAVEROOM, str);
IRCRTCResultCallback iRCRTCResultCallback2 = iRCRTCResultCallback;
if (iRCRTCResultCallback2 != null) {
iRCRTCResultCallback2.onSuccess();
return;
}
return;
}
ReportUtil.TAG tag = ReportUtil.TAG.LEAVEROOM;
ReportUtil.libError(tag, "roomId|code|desc", str, string, "Server Result: " + str4);
if (iRCRTCResultCallback != null) {
int i2 = -1;
try {
i2 = Integer.valueOf(string).intValue();
} catch (Exception e2) {
e2.printStackTrace();
}
iRCRTCResultCallback.onFailed(RTCErrorCode.valueOf(i2));
}
} catch (JSONException e3) {
ReportUtil.TAG tag2 = ReportUtil.TAG.LEAVEROOM;
ReportUtil.libError(tag2, "roomId|code|desc", str, Integer.valueOf(RTCErrorCode.JsonParseError.getValue()), "JSONException:" + e3.getMessage());
IRCRTCResultCallback iRCRTCResultCallback3 = iRCRTCResultCallback;
if (iRCRTCResultCallback3 != null) {
iRCRTCResultCallback3.onFailed(RTCErrorCode.JsonParseError);
}
}
}
@Override
public void onFailure(int i2) {
ReportUtil.libError(ReportUtil.TAG.LEAVEROOM, "roomId|code|desc", str, Integer.valueOf(i2), "Http Request Failed");
IRCRTCResultCallback iRCRTCResultCallback2 = iRCRTCResultCallback;
if (iRCRTCResultCallback2 != null) {
iRCRTCResultCallback2.onFailed(RTCErrorCode.valueOf(i2));
}
}
});
}
public void request(final String str, final String str2, final int i, final String str3, final String str4, String str5, final JSONObject jSONObject, final boolean z, final int i2, final HttpClient.ResultCallback resultCallback) {
HttpClient.getDefault().request(getRequest(str, str2, i, str3, str4, str5, jSONObject, z), new HttpClient.ResultCallback() {
@Override
public void onResponse(String str6) {
HttpClient.ResultCallback resultCallback2 = resultCallback;
if (resultCallback2 != null) {
resultCallback2.onResponse(str6);
}
}
@Override
public void onFailure(int i3) {
if (MediaSignalWrapper.this.needRetry(i2)) {
MediaSignalWrapper mediaSignalWrapper = MediaSignalWrapper.this;
String str6 = str;
String str7 = str2;
int i4 = i;
String str8 = str3;
String str9 = str4;
String[] strArr = mediaSignalWrapper.mOrderedMediaServer;
int i5 = i2;
mediaSignalWrapper.request(str6, str7, i4, str8, str9, strArr[i5 + 1], jSONObject, z, i5 + 1, resultCallback);
return;
}
HttpClient.ResultCallback resultCallback2 = resultCallback;
if (resultCallback2 != null) {
resultCallback2.onFailure(i3);
}
}
});
}
public List<MediaResourceInfo> parsePublishList(JSONArray jSONArray) {
if (jSONArray != null) {
ArrayList arrayList = new ArrayList();
for (int i = 0; i < jSONArray.length(); i++) {
try {
arrayList.add(new MediaResourceInfo((JSONObject) jSONArray.get(i), getUserId()));
} catch (JSONException e) {
FinLog.v(TAG, "e.getMessage() = " + e.getMessage());
}
}
FinLog.v(TAG, "parsePublishList size: " + arrayList.size());
return arrayList;
}
return null;
}
private JSONObject getResolutionInfo(List<? extends IStreamResource> list) {
JSONObject jSONObject = new JSONObject();
if (RongRTCUtils.isEmpty(list)) {
return jSONObject;
}
try {
for (IStreamResource iStreamResource : list) {
if (iStreamResource instanceof ILocalVideoStreamResource) {
ILocalVideoStreamResource iLocalVideoStreamResource = (ILocalVideoStreamResource) iStreamResource;
JSONObject jSONObject2 = new JSONObject();
JSONArray jSONArray = new JSONArray();
jSONObject2.put("simulcast", iLocalVideoStreamResource.getStreamType().getValue());
jSONObject2.put("resolution", iLocalVideoStreamResource.getWidth() + "X" + iLocalVideoStreamResource.getHeight());
jSONArray.put(jSONObject2);
jSONObject.put(iStreamResource.getStreamId(), jSONArray);
}
}
} catch (JSONException e) {
e.printStackTrace();
}
return jSONObject;
}
private JSONObject getExtentInfo(List<? extends IStreamResource> list, String str) {
JSONObject jSONObject = new JSONObject();
JSONArray jSONArray = new JSONArray();
try {
} catch (Exception e) {
e.printStackTrace();
}
if (RongRTCUtils.isEmpty(list)) {
return jSONObject;
}
int value = RCRTCParamsType.AudioScenario.DEFAULT.getValue();
for (IStreamResource iStreamResource : list) {
if (iStreamResource instanceof RCMicOutputStreamImpl) {
value = ((RCMicOutputStreamImpl) iStreamResource).getAudioScenario().getValue();
}
if (iStreamResource instanceof ILocalVideoStreamResource) {
ILocalVideoStreamResource iLocalVideoStreamResource = (ILocalVideoStreamResource) iStreamResource;
JSONObject jSONObject2 = new JSONObject();
jSONObject2.put("trackId", iLocalVideoStreamResource.getStreamId());
jSONObject2.put("simulcast", iLocalVideoStreamResource.getStreamType().getValue());
jSONObject2.put("resolution", iLocalVideoStreamResource.getWidth() + "X" + iLocalVideoStreamResource.getHeight());
jSONArray.put(jSONObject2);
}
}
jSONObject.put("resolutionInfo", jSONArray);
jSONObject.put("audioScenario", value);
if (!TextUtils.isEmpty(str)) {
jSONObject.put("role", str);
}
return jSONObject;
}
private JSONArray parseSubscribeList(List<? extends IStreamResource> list) {
JSONArray jSONArray = new JSONArray();
for (IStreamResource iStreamResource : list) {
try {
JSONObject jSONObject = new JSONObject();
jSONObject.put("uri", iStreamResource.getUri());
if (iStreamResource instanceof IRemoteVideoStreamResource) {
jSONObject.put("simulcast", ((IRemoteVideoStreamResource) iStreamResource).getStreamType().getValue());
}
jSONArray.put(jSONObject);
} catch (JSONException unused) {
}
}
FinLog.i(TAG, "subscribe stream total:" + list.size() + " / subscribed:" + jSONArray.length());
StringBuilder sb = new StringBuilder();
sb.append("parseSubscribeList () SubscribeList : ");
sb.append(jSONArray.toString());
Log.i(TAG, sb.toString());
return jSONArray;
}
public void retrySendSDPOffer(String str, SessionDescription sessionDescription, String str2, int i, RTCErrorCode rTCErrorCode, List<? extends IStreamResource> list, List<? extends IStreamResource> list2, int i2, int i3, String str3, String str4, IRCRTCResultDataCallback<ExchangeSDPDataResult> iRCRTCResultDataCallback) {
if (!needRetry(i)) {
if (iRCRTCResultDataCallback != null) {
iRCRTCResultDataCallback.onFailed(rTCErrorCode);
return;
}
return;
}
int i4 = i + 1;
String str5 = this.mOrderedMediaServer[i4];
FinLog.i(TAG, "sendSDPOffer retry with mOrderedMediaServer: " + str5);
sendSDPOffer(str, sessionDescription, str5, true, str2, i4, list, list2, i2, i3, str3, str4, iRCRTCResultDataCallback);
}
public boolean needRetry(int i) {
String[] strArr = this.mOrderedMediaServer;
return strArr != null && strArr.length > i + 1;
}
public void parseUDPObfuscation(JSONObject jSONObject) {
try {
if (this.mObfuscationKeyListener == null || jSONObject == null || !jSONObject.has("udpObfuscationKey")) {
return;
}
this.mObfuscationKeyListener.onUpdate(jSONObject.getString("udpObfuscationKey"));
} catch (JSONException unused) {
}
}
private Request getRequest(String str, String str2, int i, String str3, String str4, String str5, JSONObject jSONObject) {
return getRequest(str, str2, i, str3, str4, str5, jSONObject, false);
}
private Request getRequest(String str, String str2, int i, String str3, String str4, String str5, JSONObject jSONObject, boolean z) {
return getRequestBuilder(str, str2, i, str3, str4, str5, z).body(jSONObject.toString()).build();
}
private Request.Builder getRequestBuilder(String str, String str2, int i, String str3, String str4, String str5, boolean z) {
Request.Builder builder = new Request.Builder();
Request.Builder header = builder.url(str5 + str4).method("POST").header("clientVersion", "5.1.7.1").header("App-Key", getAppKey()).header("Token", str).header("RoomId", str2);
return header.header("clientType", "Android|" + DeviceUtils.getBuildModel() + "|" + Build.VERSION.RELEASE).header("RoomType", String.valueOf(i)).header("UserId", getUserId()).header(FEATURE_SUPPORT_OBFUSCATION, "XOR").header(HEAD_CLIENT_SESSION_ID, str3).header(HEAD_REQUEST_ID, String.valueOf(System.currentTimeMillis()));
}
public int getMaxStreamCount() {
int i = this.maxStreamCount;
if (i == 0) {
return 30;
}
return i;
}
public void subscribeLive(SessionDescription sessionDescription, String str, RCRTCAVStreamType rCRTCAVStreamType, List<? extends IStreamResource> list, String str2, String str3, IRCRTCResultDataCallback<SubscribeLiveDataResult> iRCRTCResultDataCallback) {
subscribeLive(sessionDescription, str, rCRTCAVStreamType, list, false, getMediaServer(), str2, str3, -1, iRCRTCResultDataCallback);
}
private String getUserId() {
String userId = this.mImSignal.getUserId();
FinLog.i(TAG, "userId = " + userId);
return userId;
}
public void subscribeLive(cn.rongcloud.rtc.core.SessionDescription r17, java.lang.String r18, cn.rongcloud.rtc.base.RCRTCAVStreamType r19, java.util.List<? extends cn.rongcloud.rtc.webrtc.IStreamResource> r20, boolean r21, java.lang.String r22, java.lang.String r23, java.lang.String r24, int r25, cn.rongcloud.rtc.api.callback.IRCRTCResultDataCallback<cn.rongcloud.rtc.proxy.message.messagebeans.SubscribeLiveDataResult> r26) {
throw new UnsupportedOperationException("Method not decompiled: cn.rongcloud.rtc.signal.MediaSignalWrapper.subscribeLive(cn.rongcloud.rtc.core.SessionDescription, java.lang.String, cn.rongcloud.rtc.base.RCRTCAVStreamType, java.util.List, boolean, java.lang.String, java.lang.String, java.lang.String, int, cn.rongcloud.rtc.api.callback.IRCRTCResultDataCallback):void");
}
public void changeMediaServer2ClusterId(String str, JSONObject jSONObject) {
String optString = jSONObject.optString("clusterId");
if (!TextUtils.isEmpty(optString)) {
if (!TextUtils.isEmpty(this.clusterId)) {
if (this.clusterId.contains(optString)) {
return;
}
this.mOrderedMediaServer[0] = optString;
} else {
String[] strArr = this.mOrderedMediaServer;
int length = strArr.length + 1;
String[] strArr2 = new String[length];
System.arraycopy(strArr, 0, strArr2, 1, length - 1);
strArr2[0] = optString;
this.mOrderedMediaServer = strArr2;
}
this.clusterId = solveAddress();
FinLog.i(TAG, "Change media server to clusterId: " + this.clusterId);
return;
}
this.clusterId = str;
FinLog.i(TAG, "Change media server to clusterId: " + this.clusterId);
}
public void quitLive(final String str, int i, String str2, String str3, final IRCRTCResultCallback iRCRTCResultCallback) {
final String mediaServer2 = getMediaServer();
ReportUtil.libTask(ReportUtil.TAG.LEAVELIVE, "liveUrl|mediaUrl|userId", str, mediaServer2, getUserId());
JSONObject jSONObject = new JSONObject();
try {
if (!TextUtils.isEmpty(str)) {
jSONObject.put("liveUrl", str);
}
} catch (JSONException e) {
ReportUtil.libError(ReportUtil.TAG.LEAVELIVE, "liveUrl|code|desc", str, Integer.valueOf(RTCErrorCode.RongRTCCodeParameterError.getValue()), e.getMessage());
e.printStackTrace();
if (iRCRTCResultCallback != null) {
iRCRTCResultCallback.onFailed(RTCErrorCode.RongRTCCodeParameterError);
}
}
Request.Builder requestBuilder = getRequestBuilder(getRtcToken(), getUserId(), i, str3, "/broadcast/exit ", mediaServer2, true);
if (!TextUtils.isEmpty(str2)) {
requestBuilder.header("Session-Id", str2);
}
HttpClient.getDefault().request(requestBuilder.body(jSONObject.toString()).build(), new HttpClient.ResultCallback() {
@Override
public void onResponse(String str4) {
try {
String string = new JSONObject(str4).getString("resultCode");
if (string.equals("10000")) {
ReportUtil.libRes(ReportUtil.TAG.LEAVELIVE, "code", 0);
IRCRTCResultCallback iRCRTCResultCallback2 = iRCRTCResultCallback;
if (iRCRTCResultCallback2 != null) {
iRCRTCResultCallback2.onSuccess();
return;
}
return;
}
ReportUtil.libError(ReportUtil.TAG.LEAVELIVE, "code|mediaUrl|liveUrl|desc", string, mediaServer2, str, str4);
if (iRCRTCResultCallback != null) {
int i2 = -1;
try {
i2 = Integer.valueOf(string).intValue();
} catch (Exception e2) {
e2.printStackTrace();
}
iRCRTCResultCallback.onFailed(RTCErrorCode.valueOf(i2));
}
} catch (JSONException e3) {
ReportUtil.TAG tag = ReportUtil.TAG.LEAVELIVE;
ReportUtil.libError(tag, "liveUrl|code|desc", str, Integer.valueOf(RTCErrorCode.JsonParseError.getValue()), "JSONException: " + e3.getMessage() + " , result: " + str4);
IRCRTCResultCallback iRCRTCResultCallback3 = iRCRTCResultCallback;
if (iRCRTCResultCallback3 != null) {
iRCRTCResultCallback3.onFailed(RTCErrorCode.JsonParseError);
}
}
}
@Override
public void onFailure(int i2) {
ReportUtil.libError(ReportUtil.TAG.LEAVELIVE, "code|mediaUrl|liveUrl|desc", Integer.valueOf(i2), mediaServer2, str, "HttpRequest Failed");
IRCRTCResultCallback iRCRTCResultCallback2 = iRCRTCResultCallback;
if (iRCRTCResultCallback2 != null) {
iRCRTCResultCallback2.onFailed(RTCErrorCode.valueOf(i2));
}
}
});
}
public void setMCUConfig(final String str, final String str2, String str3, String str4, final IRCRTCResultDataCallback<String> iRCRTCResultDataCallback) {
ReportUtil.libTask(ReportUtil.TAG.MCUCONFIGREQUEST, "serverUrl|roomId|sessionId|configJson", str, str2, str3, str4);
Request.Builder builder = new Request.Builder();
HttpClient.getDefault().request(builder.url(str + "/server/mcu/config").method("POST").addHeader("RoomId", str2).addHeader("UserId", getUserId()).addHeader("AppKey", getAppKey()).addHeader("SessionId", str3).addHeader("Token", getRtcToken()).body(str4).build(), new HttpClient.ResultCallback() {
@Override
public void onResponse(String str5) {
ReportUtil.libRes(ReportUtil.TAG.MCU_CONFIG, "roomId|response", str2, str5);
try {
String string = new JSONObject(str5).getString("resultCode");
if (string.equals("10000")) {
ReportUtil.libRes(ReportUtil.TAG.MCUCONFIGREQUEST, "code", 0);
IRCRTCResultDataCallback iRCRTCResultDataCallback2 = iRCRTCResultDataCallback;
if (iRCRTCResultDataCallback2 != null) {
iRCRTCResultDataCallback2.onSuccess(str5);
return;
}
return;
}
int i = -1;
try {
i = Integer.valueOf(string).intValue();
} catch (Exception e) {
e.printStackTrace();
}
RTCErrorCode valueOf = RTCErrorCode.valueOf(i);
ReportUtil.libError(ReportUtil.TAG.MCUCONFIGREQUEST, "serverUrl|code|msg", str, Integer.valueOf(i), str5);
IRCRTCResultDataCallback iRCRTCResultDataCallback3 = iRCRTCResultDataCallback;
if (iRCRTCResultDataCallback3 != null) {
iRCRTCResultDataCallback3.onFailed(valueOf);
}
} catch (JSONException unused) {
ReportUtil.libError(ReportUtil.TAG.MCUCONFIGREQUEST, "serverUrl|code|msg", str, Integer.valueOf(RTCErrorCode.JsonParseError.getValue()), str5);
IRCRTCResultDataCallback iRCRTCResultDataCallback4 = iRCRTCResultDataCallback;
if (iRCRTCResultDataCallback4 != null) {
iRCRTCResultDataCallback4.onFailed(RTCErrorCode.JsonParseError);
}
}
}
@Override
public void onFailure(int i) {
RTCErrorCode valueOf = RTCErrorCode.valueOf(i);
ReportUtil.libError(ReportUtil.TAG.MCUCONFIGREQUEST, "serverUrl|code|msg", str, Integer.valueOf(valueOf.getValue()), valueOf.getReason());
IRCRTCResultDataCallback iRCRTCResultDataCallback2 = iRCRTCResultDataCallback;
if (iRCRTCResultDataCallback2 != null) {
iRCRTCResultDataCallback2.onFailed(valueOf);
}
}
});
}
public void enableInnerCDN(String str, final String str2, String str3, String str4, final IRCRTCResultDataCallback<String> iRCRTCResultDataCallback) {
ReportUtil.libTask(ReportUtil.TAG.MCU_CONFIG, "roomId|configJson", str2, str4);
Request.Builder builder = new Request.Builder();
HttpClient.getDefault().request(builder.url(str + "/server/mcu/config").method("POST").addHeader("RoomId", str2).addHeader("UserId", getUserId()).addHeader("AppKey", getAppKey()).addHeader("SessionId", str3).addHeader("Token", getRtcToken()).body(str4).build(), new HttpClient.ResultCallback() {
@Override
public void onResponse(String str5) {
ReportUtil.libRes(ReportUtil.TAG.MCU_CONFIG, "roomId|response", str2, str5);
if (!TextUtils.isEmpty(str5)) {
try {
JSONObject jSONObject = new JSONObject(str5);
int optInt = jSONObject.has("resultCode") ? jSONObject.optInt("resultCode") : -1;
if (optInt == 10000) {
if (jSONObject.has(RCConsts.JSON_KEY_PULL_URL)) {
String optString = jSONObject.optString(RCConsts.JSON_KEY_PULL_URL);
if (new JSONObject(optString).has(RCConsts.JSON_KEY_CDN_URI)) {
iRCRTCResultDataCallback.onSuccess(optString);
return;
}
ReportUtil.libError(ReportUtil.TAG.MCU_CONFIG, "code|desc", RTCErrorCode.RongRTCCodeParameterError, "rtmpUrl is empty");
iRCRTCResultDataCallback.onFailed(RTCErrorCode.RongRTCCodeParameterError);
return;
}
ReportUtil.libError(ReportUtil.TAG.MCU_CONFIG, "code|desc", RTCErrorCode.RongRTCCodeParameterError, "pullUrl is empty");
iRCRTCResultDataCallback.onFailed(RTCErrorCode.RongRTCCodeParameterError);
return;
}
String optString2 = jSONObject.has(RCConsts.JSON_KEY_REASON) ? jSONObject.optString(RCConsts.JSON_KEY_REASON) : null;
RTCErrorCode valueOf = RTCErrorCode.valueOf(optInt);
ReportUtil.libError(ReportUtil.TAG.MCU_CONFIG, "code|desc", valueOf, optString2);
iRCRTCResultDataCallback.onFailed(valueOf);
return;
} catch (JSONException e) {
e.printStackTrace();
ReportUtil.libError(ReportUtil.TAG.MCU_CONFIG, "code|desc", RTCErrorCode.JsonParseError, e.getMessage());
iRCRTCResultDataCallback.onFailed(RTCErrorCode.JsonParseError);
return;
}
}
ReportUtil.libError(ReportUtil.TAG.MCU_CONFIG, "code|desc", RTCErrorCode.RongRTCCodeParameterError, "data is empty");
iRCRTCResultDataCallback.onFailed(RTCErrorCode.RongRTCCodeParameterError);
}
@Override
public void onFailure(int i) {
ReportUtil.libError(ReportUtil.TAG.MCU_CONFIG, "code|desc", Integer.valueOf(i), "HttpRequest Failed");
IRCRTCResultDataCallback iRCRTCResultDataCallback2 = iRCRTCResultDataCallback;
if (iRCRTCResultDataCallback2 != null) {
iRCRTCResultDataCallback2.onFailed(RTCErrorCode.valueOf(i));
}
}
});
}
private String getAppKey() {
return RTCEngineImpl.getInstance().getAppKey();
}
public void reset() {
mediaServer = null;
this.clusterId = null;
}
public void getCDNUri(String str, final String str2, String str3, int i, int i2, int i3, final IRCRTCResultDataCallback<Object[]> iRCRTCResultDataCallback) {
ReportUtil.libTask(ReportUtil.TAG.GET_CDN_URI, "roomId|cdnServer|userId|w|h|fps", str2, str, getUserId(), Integer.valueOf(i), Integer.valueOf(i2), Integer.valueOf(i3));
StringBuilder sb = new StringBuilder();
sb.append(str);
if (i != 0 && i2 != 0) {
sb.append("?");
sb.append("w=");
sb.append(i);
sb.append("&");
sb.append("h=");
sb.append(i2);
sb.append("&");
sb.append("fps=");
sb.append(i3);
}
HttpClient.getDefault().request(new Request.Builder().url(sb.toString()).method("GET").addHeader("RoomId", str2).addHeader("UserId", getUserId()).addHeader("AppKey", getAppKey()).addHeader("SessionId", str3).addHeader("Token", getRtcToken()).addHeader(HEAD_REQUEST_ID, String.valueOf(System.currentTimeMillis())).build(), new HttpClient.ResultCallback() {
@Override
public void onResponse(String str4) {
String str5;
ReportUtil.libRes(ReportUtil.TAG.GET_CDN_URI, "roomId|response", str2, str4);
try {
JSONObject jSONObject = new JSONObject(str4);
int optInt = jSONObject.has("resultCode") ? jSONObject.optInt("resultCode") : -1;
if (optInt == 10000) {
JSONObject jSONObject2 = null;
if (jSONObject.has(RCConsts.JSON_KEY_DATA)) {
JSONObject jSONObject3 = new JSONObject(jSONObject.optString(RCConsts.JSON_KEY_DATA));
jSONObject2 = jSONObject3;
str5 = jSONObject3.has(RCConsts.JSON_KEY_PULL_URL) ? jSONObject3.optString(RCConsts.JSON_KEY_PULL_URL) : null;
} else {
str5 = null;
}
if (jSONObject2 != null && !TextUtils.isEmpty(str5)) {
iRCRTCResultDataCallback.onSuccess(new Object[]{str5, Integer.valueOf(jSONObject2.has(RCConsts.JSON_KEY_W) ? jSONObject2.optInt(RCConsts.JSON_KEY_W) : 0), Integer.valueOf(jSONObject2.has(RCConsts.JSON_KEY_H) ? jSONObject2.optInt(RCConsts.JSON_KEY_H) : 0), Integer.valueOf(jSONObject2.has(RCConsts.JSON_KEY_FPS) ? jSONObject2.optInt(RCConsts.JSON_KEY_FPS) : 0)});
return;
}
ReportUtil.libError(ReportUtil.TAG.GET_CDN_URI, "roomId|desc", str2, "pull_url is empty");
iRCRTCResultDataCallback.onFailed(RTCErrorCode.RongRTCCodeParameterError);
return;
}
ReportUtil.libError(ReportUtil.TAG.GET_CDN_URI, "roomId|desc", str2, jSONObject.has("message") ? jSONObject.optString("message") : "");
iRCRTCResultDataCallback.onFailed(RTCErrorCode.valueOf(optInt));
} catch (JSONException e) {
e.printStackTrace();
ReportUtil.libError(ReportUtil.TAG.GET_CDN_URI, "roomId|desc", str2, e.getMessage());
iRCRTCResultDataCallback.onFailed(RTCErrorCode.RongRTCCodeParameterError);
}
}
@Override
public void onFailure(int i4) {
ReportUtil.libError(ReportUtil.TAG.GET_CDN_URI, "roomId|code", str2, Integer.valueOf(i4));
iRCRTCResultDataCallback.onFailed(RTCErrorCode.valueOf(i4));
}
});
}
}