From 27e9f729fa9532ebc22afea84aa80434b8765fa5 Mon Sep 17 00:00:00 2001 From: JLChen <551775569@qq.com> Date: 星期六, 28 八月 2021 11:37:33 +0800 Subject: [PATCH] 2021-08-28 1.更新SDK --- HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/core/service/HDLLinphoneService.java | 61 +++++++++++++++--------------- 1 files changed, 31 insertions(+), 30 deletions(-) diff --git a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/core/service/HDLLinphoneService.java b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/core/service/HDLLinphoneService.java index 8772ac9..54d633a 100644 --- a/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/core/service/HDLLinphoneService.java +++ b/HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/core/service/HDLLinphoneService.java @@ -202,6 +202,7 @@ * 鍒濆鍖朙inphone */ private void initLinphone() { + currentCallState = Call.State.Idle; String basePath = getFilesDir().getAbsolutePath(); Factory.instance().setLogCollectionPath(basePath); Factory.instance().enableLogCollection(LogCollectionState.Enabled); @@ -309,42 +310,42 @@ HDLLog.E(userCerts + " can't be created."); } } - //璁剧疆UserAgent - setUserAgent(); + //1.璁剧疆瀛樺偍鐢ㄦ埛x509璇佷功鐨勭洰褰曠殑璺緞 mCore.setUserCertificatesPath(userCerts); + //2.璁剧疆UserAgent + setUserAgent(); + //3.璁剧疆鎾斁閾冨0 // mCore.setNativeRingingEnabled(true); // mCore.setRemoteRingbackTone(mRingSoundFile); // mCore.setTone(ToneID.CallWaiting, mRingSoundFile); - mCore.setRing(mRingSoundFile); +// mCore.setRing(mRingSoundFile); // mCore.setPlayFile(mPauseSoundFile); + //4.绂佺敤鎵嬫満鎽勫儚澶磋棰戦噰闆� // mCore.enableVideoCapture(false);//绂佺敤鎵嬫満鎽勫儚澶磋棰戦噰闆� - - mCore.setNetworkReachable(true); - //鍥炲0娑堥櫎 -// boolean isEchoCancellation = (boolean) SPUtils.get(mServiceContext, "echo_cancellation", true); - //鍥炲0娑堥櫎 +// mCore.setNetworkReachable(true); + //5.鍥炲0娑堥櫎 mCore.enableEchoCancellation(true); mCore.enableEchoLimiter(true); - - //鑷�傚簲鐮佺巼鎺у埗 + mCore.enableMic(true);//鍚敤楹﹀厠椋� + //6.鑷�傚簲鐮佺巼鎺у埗 mCore.enableAdaptiveRateControl(true); - //audio 鐮佺巼璁剧疆 - mCore.getConfig().setInt("audio", "codec_bitrate_limit", 36); - + //7.audio 鐮佺巼璁剧疆 +// mCore.getConfig().setInt("audio", "codec_bitrate_limit", 36); + //8.瑙嗛鐩稿叧璁剧疆 + mCore.setVideoPreset("custom");//瑙嗛棰勮涓篶ustom + mCore.setPreferredFramerate(5);//FPS浼樺厛璁剧疆涓�5 VideoDefinition preferredVideoDefinition = Factory.instance().createVideoDefinitionFromName("qvga"); - mCore.setPreferredVideoDefinition(preferredVideoDefinition); - - mCore.setUploadBandwidth(1536); - mCore.setDownloadBandwidth(1536); - - mCore.getConfig().setBool("app", "open_h264_download_enabled", true); + 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); - - // 璁剧疆缂栫爜鏍煎紡 + //11.璁剧疆缂栫爜鏍煎紡 setCodecMime(); } @@ -352,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銆丠264銆丠265 绛夊惎鐢� PayloadType[] ptVideoList = mCore.getVideoPayloadTypes(); for (PayloadType pt : ptVideoList) { +// HDLLog.i("VideoPayload", pt.getMimeType()); pt.enable(true); } mCore.setVideoPayloadTypes(ptVideoList); @@ -448,10 +449,10 @@ // The factory config is used to override any other setting, let's copy it each time copyFromPackage(R.raw.linphonerc_factory, "linphonerc"); mRingSoundFile = basePath + "/oldphone_mono.wav"; - copyIfNotExist(R.raw.oldphone_mono, basePath + "/oldphone_mono.wav"); - copyIfNotExist(R.raw.ringback, basePath + "/ringback.wav"); - mPauseSoundFile = basePath + "/toy_mono.wav"; - copyIfNotExist(R.raw.toy_mono, basePath + "/toy_mono.wav"); + copyIfNotExist(R.raw.oldphone_mono, mRingSoundFile); +// copyIfNotExist(R.raw.ringback, basePath + "/ringback.wav"); +// mPauseSoundFile = basePath + "/toy_mono.wav"; +// copyIfNotExist(R.raw.toy_mono, basePath + "/toy_mono.wav"); } catch (IOException ioe) { Log.e(ioe); -- Gitblit v1.8.0