OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2013 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 PeerConnection.RTCConfiguration rtcConfig = | 104 PeerConnection.RTCConfiguration rtcConfig = |
105 new PeerConnection.RTCConfiguration(iceServers); | 105 new PeerConnection.RTCConfiguration(iceServers); |
106 return createPeerConnection(rtcConfig, constraints, observer); | 106 return createPeerConnection(rtcConfig, constraints, observer); |
107 } | 107 } |
108 | 108 |
109 public MediaStream createLocalMediaStream(String label) { | 109 public MediaStream createLocalMediaStream(String label) { |
110 return new MediaStream( | 110 return new MediaStream( |
111 nativeCreateLocalMediaStream(nativeFactory, label)); | 111 nativeCreateLocalMediaStream(nativeFactory, label)); |
112 } | 112 } |
113 | 113 |
| 114 // The VideoSource takes ownership of |capturer|, so capturer.dispose() should
not be called |
| 115 // manually after this. Video capturer is automatically started so there is no
need to call |
| 116 // startCapture after this method. |
| 117 public VideoSource createVideoSource( |
| 118 VideoCapturer capturer, MediaConstraints constraints) { |
| 119 final EglBase.Context eglContext = |
| 120 localEglbase == null ? null : localEglbase.getEglBaseContext(); |
| 121 return new VideoSource(nativeCreateVideoSource(nativeFactory, |
| 122 eglContext, capturer, constraints)); |
| 123 } |
| 124 |
114 public VideoSource createVideoSource(VideoCapturer capturer) { | 125 public VideoSource createVideoSource(VideoCapturer capturer) { |
115 final EglBase.Context eglContext = | 126 final EglBase.Context eglContext = |
116 localEglbase == null ? null : localEglbase.getEglBaseContext(); | 127 localEglbase == null ? null : localEglbase.getEglBaseContext(); |
117 long nativeAndroidVideoTrackSource = nativeCreateVideoSource(nativeFactory,
eglContext); | 128 long nativeAndroidVideoTrackSource = nativeCreateVideoSource2(nativeFactory,
eglContext); |
118 VideoCapturer.CapturerObserver capturerObserver | 129 VideoCapturer.CapturerObserver capturerObserver |
119 = new VideoCapturer.AndroidVideoTrackSourceObserver(nativeAndroidVideoTr
ackSource); | 130 = new VideoCapturer.AndroidVideoTrackSourceObserver(nativeAndroidVideoTr
ackSource); |
120 nativeInitializeVideoCapturer(nativeFactory, capturer, nativeAndroidVideoTra
ckSource, | 131 nativeInitializeVideoCapturer(nativeFactory, capturer, nativeAndroidVideoTra
ckSource, |
121 capturerObserver); | 132 capturerObserver); |
122 return new VideoSource(nativeAndroidVideoTrackSource); | 133 return new VideoSource(nativeAndroidVideoTrackSource); |
123 } | 134 } |
124 | 135 |
125 public VideoTrack createVideoTrack(String id, VideoSource source) { | 136 public VideoTrack createVideoTrack(String id, VideoSource source) { |
126 return new VideoTrack(nativeCreateVideoTrack( | 137 return new VideoTrack(nativeCreateVideoTrack( |
127 nativeFactory, id, source.nativeSource)); | 138 nativeFactory, id, source.nativeSource)); |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 PeerConnection.Observer observer); | 241 PeerConnection.Observer observer); |
231 | 242 |
232 private static native long nativeCreatePeerConnection( | 243 private static native long nativeCreatePeerConnection( |
233 long nativeFactory, PeerConnection.RTCConfiguration rtcConfig, | 244 long nativeFactory, PeerConnection.RTCConfiguration rtcConfig, |
234 MediaConstraints constraints, long nativeObserver); | 245 MediaConstraints constraints, long nativeObserver); |
235 | 246 |
236 private static native long nativeCreateLocalMediaStream( | 247 private static native long nativeCreateLocalMediaStream( |
237 long nativeFactory, String label); | 248 long nativeFactory, String label); |
238 | 249 |
239 private static native long nativeCreateVideoSource( | 250 private static native long nativeCreateVideoSource( |
| 251 long nativeFactory, EglBase.Context eglContext, VideoCapturer videoCapture
r, |
| 252 MediaConstraints constraints); |
| 253 |
| 254 private static native long nativeCreateVideoSource2( |
240 long nativeFactory, EglBase.Context eglContext); | 255 long nativeFactory, EglBase.Context eglContext); |
241 | 256 |
242 private static native void nativeInitializeVideoCapturer( | 257 private static native void nativeInitializeVideoCapturer( |
243 long native_factory, VideoCapturer j_video_capturer, long native_source, | 258 long native_factory, VideoCapturer j_video_capturer, long native_source, |
244 VideoCapturer.CapturerObserver j_frame_observer); | 259 VideoCapturer.CapturerObserver j_frame_observer); |
245 | 260 |
246 private static native long nativeCreateVideoTrack( | 261 private static native long nativeCreateVideoTrack( |
247 long nativeFactory, String id, long nativeVideoSource); | 262 long nativeFactory, String id, long nativeVideoSource); |
248 | 263 |
249 private static native long nativeCreateAudioSource( | 264 private static native long nativeCreateAudioSource( |
(...skipping 10 matching lines...) Expand all Loading... |
260 @Deprecated | 275 @Deprecated |
261 public native void nativeSetOptions(long nativeFactory, Options options); | 276 public native void nativeSetOptions(long nativeFactory, Options options); |
262 | 277 |
263 private static native void nativeSetVideoHwAccelerationOptions( | 278 private static native void nativeSetVideoHwAccelerationOptions( |
264 long nativeFactory, Object localEGLContext, Object remoteEGLContext); | 279 long nativeFactory, Object localEGLContext, Object remoteEGLContext); |
265 | 280 |
266 private static native void nativeThreadsCallbacks(long nativeFactory); | 281 private static native void nativeThreadsCallbacks(long nativeFactory); |
267 | 282 |
268 private static native void nativeFreeFactory(long nativeFactory); | 283 private static native void nativeFreeFactory(long nativeFactory); |
269 } | 284 } |
OLD | NEW |