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 |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 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 a421c7a..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,8 +143,6 @@
                 super.callConnected();
                 // 瑙嗛閫氳瘽榛樿鍏嶆彁锛岃闊抽�氳瘽榛樿闈炲厤鎻�
                 toggleSpeaker(true);
-                // 鎵�鏈夐�氳瘽榛樿闈為潤闊�
-                toggleMicro(false);
             }
 
             @Override
@@ -381,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) {
@@ -415,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();
@@ -430,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();
@@ -557,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