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 1250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1261 return (jlong)stream.release(); | 1261 return (jlong)stream.release(); |
1262 } | 1262 } |
1263 | 1263 |
1264 JOW(jlong, PeerConnectionFactory_nativeCreateVideoSource)( | 1264 JOW(jlong, PeerConnectionFactory_nativeCreateVideoSource)( |
1265 JNIEnv* jni, jclass, jlong native_factory, jobject j_egl_context, | 1265 JNIEnv* jni, jclass, jlong native_factory, jobject j_egl_context, |
1266 jobject j_video_capturer, jobject j_constraints) { | 1266 jobject j_video_capturer, jobject j_constraints) { |
1267 // Create a cricket::VideoCapturer from |j_video_capturer|. | 1267 // Create a cricket::VideoCapturer from |j_video_capturer|. |
1268 rtc::scoped_refptr<webrtc::AndroidVideoCapturerDelegate> delegate = | 1268 rtc::scoped_refptr<webrtc::AndroidVideoCapturerDelegate> delegate = |
1269 new rtc::RefCountedObject<AndroidVideoCapturerJni>( | 1269 new rtc::RefCountedObject<AndroidVideoCapturerJni>( |
1270 jni, j_video_capturer, j_egl_context); | 1270 jni, j_video_capturer, j_egl_context); |
1271 | |
1272 jboolean is_screencast = jni->CallBooleanMethod(j_video_capturer, | |
1273 GetMethodID(jni, FindClass(jni, "org/webrtc/VideoCapturer"), | |
1274 "isScreencast", "()Z")); | |
1275 CHECK_EXCEPTION(jni) << "error during creating native video source."; | |
1276 | |
1271 std::unique_ptr<cricket::VideoCapturer> capturer( | 1277 std::unique_ptr<cricket::VideoCapturer> capturer( |
1272 new webrtc::AndroidVideoCapturer(delegate)); | 1278 new webrtc::AndroidVideoCapturer(delegate, is_screencast)); |
1273 // Create a webrtc::VideoTrackSourceInterface from the cricket::VideoCapturer, | 1279 // Create a webrtc::VideoTrackSourceInterface from the cricket::VideoCapturer, |
1274 // native factory and constraints. | 1280 // native factory and constraints. |
1275 std::unique_ptr<ConstraintsWrapper> constraints( | 1281 std::unique_ptr<ConstraintsWrapper> constraints( |
1276 new ConstraintsWrapper(jni, j_constraints)); | 1282 new ConstraintsWrapper(jni, j_constraints)); |
1277 rtc::scoped_refptr<PeerConnectionFactoryInterface> factory( | 1283 rtc::scoped_refptr<PeerConnectionFactoryInterface> factory( |
1278 factoryFromJava(native_factory)); | 1284 factoryFromJava(native_factory)); |
1279 rtc::scoped_refptr<VideoTrackSourceInterface> source( | 1285 rtc::scoped_refptr<VideoTrackSourceInterface> source( |
1280 factory->CreateVideoSource(capturer.release(), constraints.get())); | 1286 factory->CreateVideoSource(capturer.release(), constraints.get())); |
1281 return (jlong)source.release(); | 1287 return (jlong)source.release(); |
1282 } | 1288 } |
1283 | 1289 |
1284 JOW(jlong, PeerConnectionFactory_nativeCreateVideoSource2) | 1290 JOW(jlong, PeerConnectionFactory_nativeCreateVideoSource2) |
1285 (JNIEnv* jni, jclass, jlong native_factory, jobject j_egl_context) { | 1291 (JNIEnv* jni, jclass, jlong native_factory, jobject j_egl_context) { |
1286 OwnedFactoryAndThreads* factory = | 1292 OwnedFactoryAndThreads* factory = |
1287 reinterpret_cast<OwnedFactoryAndThreads*>(native_factory); | 1293 reinterpret_cast<OwnedFactoryAndThreads*>(native_factory); |
1288 | 1294 |
1289 rtc::scoped_refptr<webrtc::AndroidVideoTrackSource> source( | 1295 rtc::scoped_refptr<webrtc::AndroidVideoTrackSource> source( |
magjed_webrtc
2016/08/24 12:19:22
Can you update this create function as well? It sh
arsany
2016/08/26 02:07:36
Done.
| |
1290 new rtc::RefCountedObject<webrtc::AndroidVideoTrackSource>( | 1296 new rtc::RefCountedObject<webrtc::AndroidVideoTrackSource>( |
1291 factory->signaling_thread(), jni, j_egl_context)); | 1297 factory->signaling_thread(), jni, j_egl_context)); |
1292 rtc::scoped_refptr<webrtc::VideoTrackSourceProxy> proxy_source = | 1298 rtc::scoped_refptr<webrtc::VideoTrackSourceProxy> proxy_source = |
1293 webrtc::VideoTrackSourceProxy::Create(factory->signaling_thread(), | 1299 webrtc::VideoTrackSourceProxy::Create(factory->signaling_thread(), |
1294 factory->worker_thread(), source); | 1300 factory->worker_thread(), source); |
1295 | 1301 |
1296 return (jlong)proxy_source.release(); | 1302 return (jlong)proxy_source.release(); |
1297 } | 1303 } |
1298 | 1304 |
1299 JOW(void, PeerConnectionFactory_nativeInitializeVideoCapturer) | 1305 JOW(void, PeerConnectionFactory_nativeInitializeVideoCapturer) |
(...skipping 1048 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2348 return JavaStringFromStdString( | 2354 return JavaStringFromStdString( |
2349 jni, | 2355 jni, |
2350 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->id()); | 2356 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->id()); |
2351 } | 2357 } |
2352 | 2358 |
2353 JOW(void, RtpReceiver_free)(JNIEnv* jni, jclass, jlong j_rtp_receiver_pointer) { | 2359 JOW(void, RtpReceiver_free)(JNIEnv* jni, jclass, jlong j_rtp_receiver_pointer) { |
2354 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->Release(); | 2360 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->Release(); |
2355 } | 2361 } |
2356 | 2362 |
2357 } // namespace webrtc_jni | 2363 } // namespace webrtc_jni |
OLD | NEW |