JLChen
2021-08-24 e3541a31b314573a80400dd9b7ef8a9bc88f610b
HDLLinphoneSDKDemoNew/HDLLinphoneSDK/src/main/java/com/hdl/hdllinphonesdk/core/service/HDLLinphoneService.java
@@ -202,6 +202,7 @@
     * 初始化Linphone
     */
    private void initLinphone() {
        currentCallState = Call.State.Idle;
        String basePath = getFilesDir().getAbsolutePath();
        Factory.instance().setLogCollectionPath(basePath);
        Factory.instance().enableLogCollection(LogCollectionState.Enabled);
@@ -309,42 +310,39 @@
                HDLLog.E(userCerts + " can't be created.");
            }
        }
        //设置UserAgent
        setUserAgent();
        //1.设置存储用户x509证书的目录的路径
        mCore.setUserCertificatesPath(userCerts);
        //2.设置UserAgent
        setUserAgent();
//        mCore.setNativeRingingEnabled(true);
//        mCore.setRemoteRingbackTone(mRingSoundFile);
//        mCore.setTone(ToneID.CallWaiting, mRingSoundFile);
        mCore.setRing(mRingSoundFile);
//        mCore.setRing(mRingSoundFile);
//        mCore.setPlayFile(mPauseSoundFile);
//        mCore.enableVideoCapture(false);//禁用手机摄像头视频采集
        mCore.setNetworkReachable(true);
        //回声消除
//        boolean isEchoCancellation = (boolean) SPUtils.get(mServiceContext, "echo_cancellation", true);
        //回声消除
        //3.回声消除
        mCore.enableEchoCancellation(true);
        mCore.enableEchoLimiter(true);
        //自适应码率控制
        //4.自适应码率控制
        mCore.enableAdaptiveRateControl(true);
        //audio 码率设置
        //5.audio 码率设置
        mCore.getConfig().setInt("audio", "codec_bitrate_limit", 36);
        //6.视频尺寸偏好设置 默认qvga
        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.设置视频的默认策略
        VideoActivationPolicy vap = mCore.getVideoActivationPolicy();
        vap.setAutomaticallyInitiate(true);
        mCore.setVideoActivationPolicy(vap);
        // 设置编码格式
        //10.设置编码格式
        setCodecMime();
    }
@@ -448,10 +446,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);