i previously used WebRTC 1.0.22672, now i switched to last version 1.0.26885.
previously i used this code to create PeerConnectionFactory And VideoSource Object and it worked fine:
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);
}
Run Code Online (Sandbox Code Playgroud)
but in latest version i have two errors on new PeerConnectionFactory...
that says:
'PeerConnectionFactory(long)' is not public in 'org.webrtc.PeerConnectionFactory'. Cannot be accessed from outside package
and on peerConnectionFactory.createVideoSource...
that syas:
createVideoSource (boolean) in PeerConnectionFactory cannot be applied to (org.webrtc.VideoCapturer)
How can i solve these errors?
and can someone tell my WHY there is no documentation or change-log for android native WebRTC?!
我该如何解决这些错误?
WebRTC最新版本已弃用或删除了许多API。请执行以下步骤来解决这些错误。
第1步:从
peerConnectionFactory = new PeerConnectionFactory(options, defaultVideoEncoderFactory, defaultVideoDecoderFactory);
Run Code Online (Sandbox Code Playgroud)
至
peerConnectionFactory = PeerConnectionFactory.builder()
.setOptions(options)
.setVideoEncoderFactory(defaultVideoEncoderFactory)
.setVideoDecoderFactory(defaultVideoDecoderFactory)
.createPeerConnectionFactory();
Run Code Online (Sandbox Code Playgroud)
第2步:从更改代码
//Create a VideoSource instance
if (videoCapturerAndroid != null) {
videoSource = peerConnectionFactory.createVideoSource(videoCapturerAndroid);
}
Run Code Online (Sandbox Code Playgroud)
至
//Create a VideoSource instance
if (videoCapturerAndroid != null) {
SurfaceTextureHelper surfaceTextureHelper = SurfaceTextureHelper.create("CaptureThread", rootEglBase.getEglBaseContext());
videoSource = peerConnectionFactory.createVideoSource(videoCapturerAndroid.isScreencast());
videoCapturerAndroid.initialize(surfaceTextureHelper, getApplicationContext(), videoSource.getCapturerObserver());
}
Run Code Online (Sandbox Code Playgroud)
有人可以告诉我为什么没有针对Android本机WebRTC的文档或更改日志吗?
更改日志位于
https://webrtc.googlesource.com/src/+log
注意:关于您的问题,您可以点击以下链接获取更多详细信息。
https://groups.google.com/forum/#!topic/discuss-webrtc/gwJP5Sf0cdE
| 归档时间: |
|
| 查看次数: |
886 次 |
| 最近记录: |