From daca4f973aeda5b816f0160eb121c5f3c7a6e66c Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期三, 01 九月 2021 15:40:49 +0800
Subject: [PATCH] 2021-09-01 1.监视页面禁用麦克风

---
 HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/HDLLinphoneKit.java |   24 ++++++++++++++++--------
 1 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/HDLLinphoneKit.java b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/HDLLinphoneKit.java
index ce44248..7473487 100644
--- a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/HDLLinphoneKit.java
+++ b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/HDLLinphoneKit.java
@@ -143,14 +143,12 @@
                 super.callConnected();
                 // 瑙嗛閫氳瘽榛樿鍏嶆彁锛岃闊抽�氳瘽榛樿闈炲厤鎻�
                 toggleSpeaker(true);
-                // 鎵�鏈夐�氳瘽榛樿闈為潤闊�
-                toggleMicro(false);
             }
 
             @Override
             public void callEnd() {
                 super.callEnd();
-                context.sendBroadcast(new Intent(HDLLinphoneIntercomActivity.RECEIVE_FINISH_VIDEO_ACTIVITY));
+//                context.sendBroadcast(new Intent(HDLLinphoneIntercomActivity.RECEIVE_FINISH_VIDEO_ACTIVITY));
 
             }
         });
@@ -275,9 +273,6 @@
                         config.done();
                     }
                 }
-                core.clearAllAuthInfo();//娓呴櫎鎵�鏈夎璇佷俊鎭��
-
-//                core.clearProxyConfig();//浠庨厤缃腑鍒犻櫎鎵�鏈変唬鐞嗐�傛敞鎰忥細鐩墠涓嶈兘鐩存帴鍒犳墍鏈変唬鐞嗭紝鍥犱负鏈嶅姟鍣ㄤ笂杩樻槸鏍囪宸叉敞鍐�
             }
         } catch (Exception e) {
             e.printStackTrace();
@@ -290,6 +285,7 @@
     public void clearProxyConfig(){
         Core core = HDLLinphoneService.getCore();
         if (core != null) {
+            core.setDefaultProxyConfig(null);
             core.clearAllAuthInfo();//娓呴櫎鎵�鏈夎璇佷俊鎭��
             core.clearProxyConfig();//浠庨厤缃腑鍒犻櫎鎵�鏈変唬鐞嗐��
         }
@@ -383,8 +379,10 @@
             if (isVideoCall) {
                 params.enableVideo(true);
                 params.enableLowBandwidth(false);
+                params.setAudioBandwidthLimit(0); // disable limitation
             } else {
                 params.enableVideo(false);
+                params.setAudioBandwidthLimit(40); // disable limitation
             }
 
             if (addressToCall != null) {
@@ -417,6 +415,7 @@
             Call currentCall = HDLLinphoneService.getCore().getCurrentCall();
             CallParams params = HDLLinphoneService.getCore().createCallParams(currentCall);
             params.enableVideo(true);
+            params.setAudioBandwidthLimit(0); // disable limitation
             currentCall.acceptWithParams(params);
         } catch (Exception e) {
             e.printStackTrace();
@@ -432,6 +431,7 @@
             Call currentCall = HDLLinphoneService.getCore().getCurrentCall();
             CallParams params = HDLLinphoneService.getCore().createCallParams(currentCall);
             params.enableVideo(enableVideo);
+            params.setAudioBandwidthLimit(enableVideo ? 0 : 40);
             currentCall.acceptWithParams(params);
         } catch (Exception e) {
             e.printStackTrace();
@@ -559,14 +559,22 @@
      * 鑾峰彇褰撳墠閫氳瘽鐘舵��
      */
     public Call.State getCallState() {
-        return HDLLinphoneService.getInstance().getCurrentCallState();
+        if(HDLLinphoneService.getInstance() == null) {
+            return null;
+        }else {
+            return HDLLinphoneService.getInstance().getCurrentCallState();
+        }
     }
 
     /**
      * 鑾峰彇褰撳墠閫氳瘽鐘舵�佹槸鍚︿负鏉ョ數涓�
      */
     public boolean isIncomingReceivedCallState() {
-        return HDLLinphoneService.getInstance().getCurrentCallState() == Call.State.IncomingReceived;
+        if(HDLLinphoneService.getInstance() == null || HDLLinphoneService.getInstance().getCurrentCallState() == null){
+            return false;
+        }else{
+            return (HDLLinphoneService.getInstance().getCurrentCallState() == Call.State.IncomingReceived);
+        }
     }
 
     /**

--
Gitblit v1.8.0