@@ -91,7 +91,7 @@ - (void)initWithConfig:(EaseCallConfig*)aConfig delegate:(id<EaseCallDelegate>)a
9191 self.agoraKit = [AgoraRtcEngineKit sharedEngineWithAppId: self .config.agoraAppId delegate: self ];
9292 [self .agoraKit setChannelProfile: AgoraChannelProfileLiveBroadcasting];
9393 [self .agoraKit setClientRole: AgoraClientRoleBroadcaster];
94- [self .agoraKit enableAudioVolumeIndication: 1000 smooth: 5 report_vad :NO ];
94+ [self .agoraKit enableAudioVolumeIndication: 1000 smooth: 5 reportVad :NO ];
9595 }
9696
9797 self.modal .curUserAccount = [[EMClient sharedClient ] currentUsername ];
@@ -240,7 +240,6 @@ - (BOOL)isBusy
240240
241241- (void )clearRes
242242{
243- NSLog (@" cleraRes" );
244243 if (self.modal .currentCall )
245244 {
246245 if (self.modal .currentCall .callType != EaseCallType1v1Audio)
@@ -252,8 +251,7 @@ - (void)clearRes
252251 dispatch_async (self.workQueue , ^{
253252 self.modal .hasJoinedChannel = NO ;
254253 [self .agoraKit leaveChannel: ^(AgoraChannelStats * _Nonnull stat) {
255- NSLog (@" leaveChannel" );
256- // [[EMClient sharedClient] log:@"leaveChannel"];
254+ [[EMClient sharedClient ] log: @" leaveChannel" ];
257255 }];
258256 });
259257
@@ -402,6 +400,7 @@ - (void)setupVideo {
402400
403401 // Set up the configuration such as dimension, frame rate, bit rate and orientation
404402 [self .agoraKit setVideoEncoderConfiguration: self .config.encoderConfiguration];
403+
405404}
406405
407406- (EaseCallSingleViewController*)getSingleVC
@@ -444,7 +443,7 @@ - (void)callStateWillChangeTo:(EaseCallState)newState from:(EaseCallState)preSta
444443- (void )messagesDidReceive : (NSArray *)aMessages
445444{
446445 __weak typeof (self) weakself = self;
447- dispatch_async (weakself. workQueue , ^{
446+ dispatch_async (dispatch_get_main_queue () , ^{
448447 for (EMChatMessage *msg in aMessages) {
449448 [weakself _parseMsg: msg];
450449 }
@@ -454,7 +453,7 @@ - (void)messagesDidReceive:(NSArray *)aMessages
454453- (void )cmdMessagesDidReceive : (NSArray *)aCmdMessages
455454{
456455 __weak typeof (self) weakself = self;
457- dispatch_async (weakself. workQueue , ^{
456+ dispatch_async (dispatch_get_main_queue () , ^{
458457 for (EMChatMessage *msg in aCmdMessages) {
459458 [weakself _parseMsg: msg];
460459 }
@@ -685,10 +684,8 @@ - (void)_parseMsg:(EMChatMessage*)aMsg
685684 // [[EMClient sharedClient] log:[NSString stringWithFormat:@"parseAnswerMsgExt currentCallId:%@,state:%ld",weakself.modal.currentCall.callId,weakself.modal.state]];
686685 if (weakself.modal .currentCall && [weakself.modal.currentCall.callId isEqualToString: callId] && [weakself.modal.curDevId isEqualToString: callerDevId]) {
687686 if (weakself.modal .currentCall .callType == EaseCallTypeMulti) {
688- dispatch_async (dispatch_get_main_queue (), ^{
689- if (![result isEqualToString: kAcceptResult ])
690- [[weakself getMultiVC ] removePlaceHolderForMember: from];
691- });
687+ if (![result isEqualToString: kAcceptResult ])
688+ [[weakself getMultiVC ] removePlaceHolderForMember: from];
692689
693690 NSTimer * timer = [self .callTimerDic objectForKey: from];
694691 if (timer) {
@@ -702,9 +699,7 @@ - (void)_parseMsg:(EMChatMessage*)aMsg
702699 if ([result isEqualToString: kAcceptResult ]) {
703700
704701 if (isVideoToVoice && isVideoToVoice.boolValue ) {
705- dispatch_async (dispatch_get_main_queue (), ^{
706702 [weakself switchToVoice ];
707- });
708703 }
709704 weakself.modal .state = EaseCallState_Answering;
710705 }else
@@ -753,12 +748,9 @@ - (void)_parseMsg:(EMChatMessage*)aMsg
753748 // 仲裁为自己
754749 if ([result isEqualToString: kAcceptResult ]) {
755750 weakself.modal .state = EaseCallState_Answering;
756- dispatch_async (dispatch_get_main_queue (), ^{
757-
758- if (weakself.modal .currentCall .callType != EaseCallType1v1Audio)
759- [weakself setupLocalVideo ];
760- [weakself fetchToken ];
761- });
751+ if (weakself.modal .currentCall .callType != EaseCallType1v1Audio)
752+ [weakself setupLocalVideo ];
753+ [weakself fetchToken ];
762754 }
763755 }else {
764756 // 已在其他端处理
@@ -775,10 +767,7 @@ - (void)_parseMsg:(EMChatMessage*)aMsg
775767 };
776768 void (^parseVideoToVoiceMsg)(NSDictionary *) = ^void (NSDictionary * ext){
777769 if (weakself.modal .currentCall && [weakself.modal.currentCall.callId isEqualToString: callId]) {
778- dispatch_async (dispatch_get_main_queue (), ^{
779- [weakself switchToVoice ];
780- });
781-
770+ [weakself switchToVoice ];
782771 }
783772 };
784773 if ([msgType isEqualToString: kMsgTypeValue ]) {
@@ -1113,10 +1102,10 @@ - (void)rtcEngine:(AgoraRtcEngineKit *)engine firstRemoteAudioFrameOfUid:(NSUInt
11131102 NSLog (@" firstRemoteAudioFrameOfUid:%lu " ,(unsigned long )uid);
11141103}
11151104
1116- - (void )rtcEngine : (AgoraRtcEngineKit *)engine remoteVideoStateChangedOfUid : (NSUInteger )uid state : (AgoraVideoRemoteState)state reason : (AgoraVideoRemoteStateReason)reason elapsed : (NSInteger )elapsed
1105+ - (void )rtcEngine : (AgoraRtcEngineKit * _Nonnull)engine
1106+ remoteVideoStateChangedOfUid : (NSUInteger )uid state : (AgoraVideoRemoteState)state reason : (AgoraVideoRemoteReason)reason elapsed : (NSInteger )elapsed
11171107{
1118- NSLog (@" staate:%d ,reason:%d " ,state,reason);
1119- if (reason == AgoraVideoRemoteStateReasonRemoteMuted && self.modal .currentCall .callType == EaseCallType1v1Video) {
1108+ if (reason == AgoraVideoRemoteReasonRemoteMuted && self.modal .currentCall .callType == EaseCallType1v1Video) {
11201109 __weak typeof (self) weakself = self;
11211110 dispatch_async (dispatch_get_main_queue (), ^{
11221111 [weakself switchToVoice ];
@@ -1335,7 +1324,7 @@ - (void)joinChannel
13351324 if (weakself.modal .hasJoinedChannel )
13361325 [weakself.agoraKit leaveChannel: nil ];
13371326 [weakself.agoraKit joinChannelByToken: weakself.modal.agoraRTCToken channelId: weakself.modal.currentCall.channelName info: @" " uid: self .modal.agoraUid joinSuccess: ^(NSString * _Nonnull channel, NSUInteger uid, NSInteger elapsed) {
1338- NSLog ( @" join success" ) ;
1327+ [EMClient.sharedClient log: [ NSString stringWithFormat: @" joinChannel: %@ success" ,channel]] ;
13391328 if ([self .delegate respondsToSelector: @selector (callDidJoinChannel:uid: )]) {
13401329 [self .delegate callDidJoinChannel: channel uid: uid];
13411330 }
0 commit comments