HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/HDLLinphoneKit.java
@@ -381,8 +381,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 +417,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 +433,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(); HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/core/service/HDLLinphoneService.java
@@ -315,34 +315,37 @@ mCore.setUserCertificatesPath(userCerts); //2.设置UserAgent setUserAgent(); //3.设置播放铃声 // mCore.setNativeRingingEnabled(true); // mCore.setRemoteRingbackTone(mRingSoundFile); // mCore.setTone(ToneID.CallWaiting, mRingSoundFile); // mCore.setRing(mRingSoundFile); // mCore.setPlayFile(mPauseSoundFile); //4.禁用手机摄像头视频采集 // mCore.enableVideoCapture(false);//禁用手机摄像头视频采集 mCore.setNetworkReachable(true); //3.回声消除 // mCore.setNetworkReachable(true); //5.回声消除 mCore.enableEchoCancellation(true); mCore.enableEchoLimiter(true); //4.自适应码率控制 mCore.enableMic(true);//启用麦克风 //6.自适应码率控制 mCore.enableAdaptiveRateControl(true); //5.audio 码率设置 mCore.getConfig().setInt("audio", "codec_bitrate_limit", 36); //6.视频尺寸偏好设置 默认qvga //7.audio 码率设置 // mCore.getConfig().setInt("audio", "codec_bitrate_limit", 36); //8.视频相关设置 mCore.setVideoPreset("custom");//视频预设为custom mCore.setPreferredFramerate(5);//FPS优先设置为5 VideoDefinition preferredVideoDefinition = Factory.instance().createVideoDefinitionFromName("qvga"); mCore.setPreferredVideoDefinition(preferredVideoDefinition); //7.设置带宽限制,带宽单位为kbits/s, 0表示无限 mCore.setUploadBandwidth(1536); mCore.setDownloadBandwidth(1536); //8.设置启用H264编码 mCore.getConfig().setBool("app", "open_h264_download_enabled", true); //9.设置视频的默认策略 mCore.setPreferredVideoDefinition(preferredVideoDefinition);//视频尺寸偏好默认qvga //9.设置带宽限制,带宽单位为kbits/s, 0表示无限 // mCore.setUploadBandwidth(1536); // mCore.setDownloadBandwidth(1536); //10.设置视频的默认策略 VideoActivationPolicy vap = mCore.getVideoActivationPolicy(); vap.setAutomaticallyInitiate(true); mCore.setVideoActivationPolicy(vap); //10.设置编码格式 //11.设置编码格式 setCodecMime(); } @@ -350,21 +353,21 @@ * 设置编码格式 */ private void setCodecMime() { //1.启用PCMA PCMU 8000Hz PayloadType[] ptList = mCore.getAudioPayloadTypes(); for (PayloadType pt : ptList) { org.linphone.mediastream.Log.d("payloadaudio", pt.getMimeType()); if (pt.getMimeType().equals("PCMA") && pt.getClockRate() == 8000) { // HDLLog.i("payloadaudio", pt.getMimeType()); if ((pt.getMimeType().equals("PCMA") || pt.getMimeType().equals("PCMU")) && pt.getClockRate() == 8000) { pt.enable(true); } else { pt.enable(false); } } mCore.setAudioPayloadTypes(ptList); //2.设置VP8、H264、H265 等启用 PayloadType[] ptVideoList = mCore.getVideoPayloadTypes(); for (PayloadType pt : ptVideoList) { // HDLLog.i("VideoPayload", pt.getMimeType()); pt.enable(true); } mCore.setVideoPayloadTypes(ptVideoList); HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/raw/linphonerc_default
@@ -1,5 +1,5 @@ [sip] contact="Linphone Android" <sip:linphone.android@unknown-host> contact="HDL Android" <sip:hdlsdk.android@unknown-host> use_info=0 use_ipv6=1 keepalive_period=30000 HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/res/raw/linphonerc_factory
@@ -31,4 +31,3 @@ prefer_basic_chat_room=1 [assistant] xmlrpc_url=https://subscribe.linphone.org:444/wizard.php HDLLinphoneSDKDemoNew/app/libs/HDLLinphoneSDK-V1.0.1.aarBinary files differ
HDLLinphoneSDKDemoNew/app/src/main/AndroidManifest.xml
@@ -17,6 +17,7 @@ </intent-filter> </activity> </application> </manifest> HDLLinphoneSDKDemoNew/app/src/main/java/com/example/hdllinphonesdkdemo/MainActivity.java
@@ -4,22 +4,17 @@ import android.content.Intent; import android.graphics.Bitmap; import android.os.Bundle; import android.text.TextUtils; import android.util.Log; import android.view.View; import android.widget.TextView; import android.widget.Toast; import com.hdl.hdllinphonesdk.HDLLinphoneKit; import com.hdl.hdllinphonesdk.activity.HDLLinphoneIntercomActivity; import com.hdl.hdllinphonesdk.activity.HDLLinphoneMonitorActivity; import com.hdl.hdllinphonesdk.callback.OnHDLLinphoneCallListener; //import com.hdl.hdllinphonesdk.core.EasyLinphone; import com.hdl.hdllinphonesdk.core.service.HDLLinphoneService; import com.hdl.hdllinphonesdk.utils.HDLLog; import org.linphone.core.Address; import org.linphone.core.Call; import org.linphone.core.CallParams; import org.linphone.core.Core; import org.linphone.core.ProxyConfig; @@ -53,8 +48,12 @@ // HDLLinphoneKit.getInstance().setAccountAndLogin("5555", "85521566", "test-gz.hdlcontrol.com:5060"); // HDLLinphoneKit.getInstance().setAccountAndLogin("6666", "85521566", "test-gz.hdlcontrol.com:5060"); HDLLinphoneKit.getInstance().setAccountAndLogin("7777", "85521566", "test-gz.hdlcontrol.com:5060"); // HDLLinphoneKit.getInstance().setAccountAndLogin("7777", "85521566", "test-gz.hdlcontrol.com:35060"); // // HDLLinphoneKit.getInstance().setAccountAndLogin("8888", "85521566", "test-gz.hdlcontrol.com:5060"); // // HDLLinphoneKit.getInstance().setAccountAndLogin("4444", "85521566", "test-gz.hdlcontrol.com:5060"); @@ -67,7 +66,7 @@ @Override public void onClick(View v) { clearProxyConfig(); HDLLinphoneKit.getInstance().setAccountAndLogin("5555", "85521566", "test-gz.hdlcontrol.com:5060"); HDLLinphoneKit.getInstance().setAccountAndLogin("5555", "85521566", "test-gz.hdlcontrol.com:35060"); } }); @@ -89,7 +88,20 @@ mTextView3.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { logout(); HDLLinphoneKit.getInstance().getCore().enableVideoCapture(false);//禁用手机摄像头视频采集 // //1.启用PCMA 8000 // PayloadType[] ptList = HDLLinphoneKit.getInstance().getCore().getAudioPayloadTypes(); // for (PayloadType pt : ptList) { //// HDLLog.i("payloadaudio", pt.getMimeType()); // if ((pt.getMimeType().equals("PCMA") || pt.getMimeType().equals("PCMU")) && pt.getClockRate() == 8000) { //// pt.enable(true); // HDLLog.i("payloadaudio true", pt.getMimeType() + ": "+ pt.getClockRate()+"HZ " + pt.enabled()); // } else { //// pt.enable(false); // HDLLog.i("payloadaudio false", pt.getMimeType() + ": "+ pt.getClockRate()+"HZ "+ pt.enabled()); // } // } // logout(); } }); @@ -170,14 +182,17 @@ @Override public void onUnlockAction() { // HDLLinphoneKit.getInstance().getCore().enableVideoCapture(true);//禁用手机摄像头视频采集 // showToast("开锁"); // EasyLinphone.callTo("61723164995779",true); openSuccess = !openSuccess; if(openSuccess){ HDLLinphoneKit.getInstance().onOpenSuccess(); }else{ HDLLinphoneKit.getInstance().onOpenError("设备不在线"); } // openSuccess = !openSuccess; // if(openSuccess){ // HDLLinphoneKit.getInstance().onOpenSuccess(); // }else{ // HDLLinphoneKit.getInstance().onOpenError("设备不在线"); // } } Shared.Droid.HDLLinphone/Shared.Droid.HDLLinphone/Jars/HDLLinphoneSDK-V1.0.1.aarBinary files differ