WebRTC-创建PeerConnectionFactory对象

时间:2019-03-10 08:12:06

标签: android webrtc

我以前使用过WebRTC 1.0.22672,现在我切换到了最新版本1.0.26885。 以前,我使用此代码创建PeerConnectionFactory和VideoSource对象,并且效果很好:

PeerConnectionFactory.InitializationOptions initializationOptions =
            PeerConnectionFactory.InitializationOptions.builder(this)
                    .createInitializationOptions();
    PeerConnectionFactory.initialize(initializationOptions);

    //Create a new PeerConnectionFactory instance - using Hardware encoder and decoder.
    PeerConnectionFactory.Options options = new PeerConnectionFactory.Options();
    DefaultVideoEncoderFactory defaultVideoEncoderFactory = new DefaultVideoEncoderFactory(
            rootEglBase.getEglBaseContext(),  /* enableIntelVp8Encoder */true,  /* enableH264HighProfile */true);
    DefaultVideoDecoderFactory defaultVideoDecoderFactory = new DefaultVideoDecoderFactory(rootEglBase.getEglBaseContext());
    peerConnectionFactory = new PeerConnectionFactory(options, defaultVideoEncoderFactory, defaultVideoDecoderFactory);


    //Now create a VideoCapturer instance.
    VideoCapturer videoCapturerAndroid;
    videoCapturerAndroid = createCameraCapturer(new Camera1Enumerator(false));


    //Create MediaConstraints - Will be useful for specifying video and audio constraints.
    audioConstraints = new MediaConstraints();
    videoConstraints = new MediaConstraints();

    //Create a VideoSource instance
    if (videoCapturerAndroid != null) {
        videoSource = peerConnectionFactory.createVideoSource(videoCapturerAndroid);
    }

但是在最新版本中,我在new PeerConnectionFactory...上遇到两个错误 那说:

  

'PeerConnectionFactory(long)'在'org.webrtc.PeerConnectionFactory'中不公开。无法从外部软件包访问

peerConnectionFactory.createVideoSource...

那没错:

  

createVideoSource   (布尔值)   在PeerConnectionFactory中无法应用   至   (org.webrtc.VideoCapturer)   

我该如何解决这些错误?

并且有人可以告诉我为什么没有针对Android本机WebRTC的文档或更改日志吗?!

0 个答案:

没有答案