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.release() should
not be called | 114 // The VideoSource takes ownership of |capturer|, so capturer.dispose() should
not be called |
115 // manually after this. | 115 // manually after this. Video capturer is automatically started so there is no
need to call |
| 116 // startCapture after this method. |
116 public VideoSource createVideoSource( | 117 public VideoSource createVideoSource( |
117 VideoCapturer capturer, MediaConstraints constraints) { | 118 VideoCapturer capturer, MediaConstraints constraints) { |
118 final EglBase.Context eglContext = | 119 final EglBase.Context eglContext = |
119 localEglbase == null ? null : localEglbase.getEglBaseContext(); | 120 localEglbase == null ? null : localEglbase.getEglBaseContext(); |
120 return new VideoSource(nativeCreateVideoSource(nativeFactory, | 121 return new VideoSource(nativeCreateVideoSource(nativeFactory, |
121 eglContext, capturer, constraints)); | 122 eglContext, capturer, constraints)); |
122 } | 123 } |
123 | 124 |
| 125 public VideoSource createVideoSource(VideoCapturer capturer) { |
| 126 final EglBase.Context eglContext = |
| 127 localEglbase == null ? null : localEglbase.getEglBaseContext(); |
| 128 long nativeAndroidVideoTrackSource = nativeCreateVideoSource2(nativeFactory,
eglContext); |
| 129 VideoCapturer.CapturerObserver capturerObserver |
| 130 = new VideoCapturer.AndroidVideoTrackSourceObserver(nativeAndroidVideoTr
ackSource); |
| 131 nativeInitializeVideoCapturer(nativeFactory, capturer, nativeAndroidVideoTra
ckSource, |
| 132 capturerObserver); |
| 133 return new VideoSource(nativeAndroidVideoTrackSource); |
| 134 } |
| 135 |
124 public VideoTrack createVideoTrack(String id, VideoSource source) { | 136 public VideoTrack createVideoTrack(String id, VideoSource source) { |
125 return new VideoTrack(nativeCreateVideoTrack( | 137 return new VideoTrack(nativeCreateVideoTrack( |
126 nativeFactory, id, source.nativeSource)); | 138 nativeFactory, id, source.nativeSource)); |
127 } | 139 } |
128 | 140 |
129 public AudioSource createAudioSource(MediaConstraints constraints) { | 141 public AudioSource createAudioSource(MediaConstraints constraints) { |
130 return new AudioSource(nativeCreateAudioSource(nativeFactory, constraints)); | 142 return new AudioSource(nativeCreateAudioSource(nativeFactory, constraints)); |
131 } | 143 } |
132 | 144 |
133 public AudioTrack createAudioTrack(String id, AudioSource source) { | 145 public AudioTrack createAudioTrack(String id, AudioSource source) { |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 long nativeFactory, PeerConnection.RTCConfiguration rtcConfig, | 244 long nativeFactory, PeerConnection.RTCConfiguration rtcConfig, |
233 MediaConstraints constraints, long nativeObserver); | 245 MediaConstraints constraints, long nativeObserver); |
234 | 246 |
235 private static native long nativeCreateLocalMediaStream( | 247 private static native long nativeCreateLocalMediaStream( |
236 long nativeFactory, String label); | 248 long nativeFactory, String label); |
237 | 249 |
238 private static native long nativeCreateVideoSource( | 250 private static native long nativeCreateVideoSource( |
239 long nativeFactory, EglBase.Context eglContext, VideoCapturer videoCapture
r, | 251 long nativeFactory, EglBase.Context eglContext, VideoCapturer videoCapture
r, |
240 MediaConstraints constraints); | 252 MediaConstraints constraints); |
241 | 253 |
| 254 private static native long nativeCreateVideoSource2( |
| 255 long nativeFactory, EglBase.Context eglContext); |
| 256 |
| 257 private static native void nativeInitializeVideoCapturer( |
| 258 long native_factory, VideoCapturer j_video_capturer, long native_source, |
| 259 VideoCapturer.CapturerObserver j_frame_observer); |
| 260 |
242 private static native long nativeCreateVideoTrack( | 261 private static native long nativeCreateVideoTrack( |
243 long nativeFactory, String id, long nativeVideoSource); | 262 long nativeFactory, String id, long nativeVideoSource); |
244 | 263 |
245 private static native long nativeCreateAudioSource( | 264 private static native long nativeCreateAudioSource( |
246 long nativeFactory, MediaConstraints constraints); | 265 long nativeFactory, MediaConstraints constraints); |
247 | 266 |
248 private static native long nativeCreateAudioTrack( | 267 private static native long nativeCreateAudioTrack( |
249 long nativeFactory, String id, long nativeSource); | 268 long nativeFactory, String id, long nativeSource); |
250 | 269 |
251 private static native boolean nativeStartAecDump( | 270 private static native boolean nativeStartAecDump( |
252 long nativeFactory, int file_descriptor, int filesize_limit_bytes); | 271 long nativeFactory, int file_descriptor, int filesize_limit_bytes); |
253 | 272 |
254 private static native void nativeStopAecDump(long nativeFactory); | 273 private static native void nativeStopAecDump(long nativeFactory); |
255 | 274 |
256 @Deprecated | 275 @Deprecated |
257 public native void nativeSetOptions(long nativeFactory, Options options); | 276 public native void nativeSetOptions(long nativeFactory, Options options); |
258 | 277 |
259 private static native void nativeSetVideoHwAccelerationOptions( | 278 private static native void nativeSetVideoHwAccelerationOptions( |
260 long nativeFactory, Object localEGLContext, Object remoteEGLContext); | 279 long nativeFactory, Object localEGLContext, Object remoteEGLContext); |
261 | 280 |
262 private static native void nativeThreadsCallbacks(long nativeFactory); | 281 private static native void nativeThreadsCallbacks(long nativeFactory); |
263 | 282 |
264 private static native void nativeFreeFactory(long nativeFactory); | 283 private static native void nativeFreeFactory(long nativeFactory); |
265 } | 284 } |
OLD | NEW |