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, |
| 1292 jboolean is_screencast) { |
1286 OwnedFactoryAndThreads* factory = | 1293 OwnedFactoryAndThreads* factory = |
1287 reinterpret_cast<OwnedFactoryAndThreads*>(native_factory); | 1294 reinterpret_cast<OwnedFactoryAndThreads*>(native_factory); |
1288 | 1295 |
1289 rtc::scoped_refptr<webrtc::AndroidVideoTrackSource> source( | 1296 rtc::scoped_refptr<webrtc::AndroidVideoTrackSource> source( |
1290 new rtc::RefCountedObject<webrtc::AndroidVideoTrackSource>( | 1297 new rtc::RefCountedObject<webrtc::AndroidVideoTrackSource>( |
1291 factory->signaling_thread(), jni, j_egl_context)); | 1298 factory->signaling_thread(), jni, j_egl_context, is_screencast)); |
1292 rtc::scoped_refptr<webrtc::VideoTrackSourceProxy> proxy_source = | 1299 rtc::scoped_refptr<webrtc::VideoTrackSourceProxy> proxy_source = |
1293 webrtc::VideoTrackSourceProxy::Create(factory->signaling_thread(), | 1300 webrtc::VideoTrackSourceProxy::Create(factory->signaling_thread(), |
1294 factory->worker_thread(), source); | 1301 factory->worker_thread(), source); |
1295 | 1302 |
1296 return (jlong)proxy_source.release(); | 1303 return (jlong)proxy_source.release(); |
1297 } | 1304 } |
1298 | 1305 |
1299 JOW(void, PeerConnectionFactory_nativeInitializeVideoCapturer) | 1306 JOW(void, PeerConnectionFactory_nativeInitializeVideoCapturer) |
1300 (JNIEnv* jni, | 1307 (JNIEnv* jni, |
1301 jclass, | 1308 jclass, |
(...skipping 1046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2348 return JavaStringFromStdString( | 2355 return JavaStringFromStdString( |
2349 jni, | 2356 jni, |
2350 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->id()); | 2357 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->id()); |
2351 } | 2358 } |
2352 | 2359 |
2353 JOW(void, RtpReceiver_free)(JNIEnv* jni, jclass, jlong j_rtp_receiver_pointer) { | 2360 JOW(void, RtpReceiver_free)(JNIEnv* jni, jclass, jlong j_rtp_receiver_pointer) { |
2354 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->Release(); | 2361 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->Release(); |
2355 } | 2362 } |
2356 | 2363 |
2357 } // namespace webrtc_jni | 2364 } // namespace webrtc_jni |
OLD | NEW |