Ранее я использовал WebRTC 1.0.22672
, теперь я перешел на последнюю версию 1.0.26885
. Ранее я использовал этот код для создания PeerConnectionFactory и VideoSource Object, и он работал нормально:
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)
Как я могу решить эти ошибки?
а может кто-нибудь сказать мой ПОЧЕМУ нет документации или журнала изменений для андроида родного WebRTC?!
Как я могу решить эти ошибки?
Есть много API, которые устарели или удалены из последней версии WebRTC. Пожалуйста, сделайте следующие шаги для устранения этих ошибок.
Шаг 1: Измените свой код с
peerConnectionFactory = new PeerConnectionFactory(options, defaultVideoEncoderFactory, defaultVideoDecoderFactory);
в
peerConnectionFactory = PeerConnectionFactory.builder()
.setOptions(options)
.setVideoEncoderFactory(defaultVideoEncoderFactory)
.setVideoDecoderFactory(defaultVideoDecoderFactory)
.createPeerConnectionFactory();
Шаг 2: Измените свой код с
//Create a VideoSource instance
if (videoCapturerAndroid != null) {
videoSource = peerConnectionFactory.createVideoSource(videoCapturerAndroid);
}
в
//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());
}
Может кто-нибудь сказать мой ПОЧЕМУ нет документации или журнала изменений для Android родного WebRTC?
Журнал изменений находится на
https://webrtc.googlesource.com/src/+log
Примечание: о ваших проблемах, вы можете перейти по ссылке ниже для более подробной информации.
https://groups.google.com/forum/#!topic/discuss-webrtc/gwJP5Sf0cdE
Код, использующий новые библиотеки, можно найти по адресу https://cs.chromium.org/chromium/src/third_party/webrtc/examples/androidapp/src/org/appspot/apprtc/PeerConnectionClient.java?l=910.