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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
46 #include "webrtc/api/androidvideocapturer.h" | 46 #include "webrtc/api/androidvideocapturer.h" |
47 #include "webrtc/api/dtlsidentitystore.h" | 47 #include "webrtc/api/dtlsidentitystore.h" |
48 #include "webrtc/api/java/jni/androidmediadecoder_jni.h" | 48 #include "webrtc/api/java/jni/androidmediadecoder_jni.h" |
49 #include "webrtc/api/java/jni/androidmediaencoder_jni.h" | 49 #include "webrtc/api/java/jni/androidmediaencoder_jni.h" |
50 #include "webrtc/api/java/jni/androidnetworkmonitor_jni.h" | 50 #include "webrtc/api/java/jni/androidnetworkmonitor_jni.h" |
51 #include "webrtc/api/java/jni/androidvideocapturer_jni.h" | 51 #include "webrtc/api/java/jni/androidvideocapturer_jni.h" |
52 #include "webrtc/api/java/jni/classreferenceholder.h" | 52 #include "webrtc/api/java/jni/classreferenceholder.h" |
53 #include "webrtc/api/java/jni/jni_helpers.h" | 53 #include "webrtc/api/java/jni/jni_helpers.h" |
54 #include "webrtc/api/java/jni/native_handle_impl.h" | 54 #include "webrtc/api/java/jni/native_handle_impl.h" |
| 55 #include "webrtc/api/java/jni/surfacetexturehelper_jni.h" |
55 #include "webrtc/api/mediaconstraintsinterface.h" | 56 #include "webrtc/api/mediaconstraintsinterface.h" |
56 #include "webrtc/api/peerconnectioninterface.h" | 57 #include "webrtc/api/peerconnectioninterface.h" |
57 #include "webrtc/api/rtpreceiverinterface.h" | 58 #include "webrtc/api/rtpreceiverinterface.h" |
58 #include "webrtc/api/rtpsenderinterface.h" | 59 #include "webrtc/api/rtpsenderinterface.h" |
59 #include "webrtc/api/webrtcsdp.h" | 60 #include "webrtc/api/webrtcsdp.h" |
60 #include "webrtc/base/bind.h" | 61 #include "webrtc/base/bind.h" |
61 #include "webrtc/base/checks.h" | 62 #include "webrtc/base/checks.h" |
62 #include "webrtc/base/event_tracer.h" | 63 #include "webrtc/base/event_tracer.h" |
63 #include "webrtc/base/logging.h" | 64 #include "webrtc/base/logging.h" |
64 #include "webrtc/base/logsinks.h" | 65 #include "webrtc/base/logsinks.h" |
(...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
788 frame->width(), frame->height(), | 789 frame->width(), frame->height(), |
789 static_cast<int>(frame->rotation()), | 790 static_cast<int>(frame->rotation()), |
790 strides, planes, javaShallowCopy(frame)); | 791 strides, planes, javaShallowCopy(frame)); |
791 } | 792 } |
792 | 793 |
793 // Return a VideoRenderer.I420Frame referring texture object in |frame|. | 794 // Return a VideoRenderer.I420Frame referring texture object in |frame|. |
794 jobject CricketToJavaTextureFrame(const cricket::VideoFrame* frame) { | 795 jobject CricketToJavaTextureFrame(const cricket::VideoFrame* frame) { |
795 NativeHandleImpl* handle = | 796 NativeHandleImpl* handle = |
796 reinterpret_cast<NativeHandleImpl*>(frame->GetNativeHandle()); | 797 reinterpret_cast<NativeHandleImpl*>(frame->GetNativeHandle()); |
797 jfloatArray sampling_matrix = jni()->NewFloatArray(16); | 798 jfloatArray sampling_matrix = jni()->NewFloatArray(16); |
798 jni()->SetFloatArrayRegion(sampling_matrix, 0, 16, handle->sampling_matrix); | 799 jni()->SetFloatArrayRegion(sampling_matrix, 0, 16, |
| 800 handle->sampling_matrix.elem); |
799 return jni()->NewObject( | 801 return jni()->NewObject( |
800 *j_frame_class_, j_texture_frame_ctor_id_, | 802 *j_frame_class_, j_texture_frame_ctor_id_, |
801 frame->width(), frame->height(), | 803 frame->width(), frame->height(), |
802 static_cast<int>(frame->rotation()), | 804 static_cast<int>(frame->rotation()), |
803 handle->oes_texture_id, sampling_matrix, javaShallowCopy(frame)); | 805 handle->oes_texture_id, sampling_matrix, javaShallowCopy(frame)); |
804 } | 806 } |
805 | 807 |
806 JNIEnv* jni() { | 808 JNIEnv* jni() { |
807 return AttachCurrentThreadIfNeeded(); | 809 return AttachCurrentThreadIfNeeded(); |
808 } | 810 } |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1217 rtc::scoped_refptr<PeerConnectionFactoryInterface> factory( | 1219 rtc::scoped_refptr<PeerConnectionFactoryInterface> factory( |
1218 factoryFromJava(native_factory)); | 1220 factoryFromJava(native_factory)); |
1219 rtc::scoped_refptr<MediaStreamInterface> stream( | 1221 rtc::scoped_refptr<MediaStreamInterface> stream( |
1220 factory->CreateLocalMediaStream(JavaToStdString(jni, label))); | 1222 factory->CreateLocalMediaStream(JavaToStdString(jni, label))); |
1221 return (jlong)stream.release(); | 1223 return (jlong)stream.release(); |
1222 } | 1224 } |
1223 | 1225 |
1224 JOW(jlong, PeerConnectionFactory_nativeCreateVideoSource)( | 1226 JOW(jlong, PeerConnectionFactory_nativeCreateVideoSource)( |
1225 JNIEnv* jni, jclass, jlong native_factory, jobject j_egl_context, | 1227 JNIEnv* jni, jclass, jlong native_factory, jobject j_egl_context, |
1226 jobject j_video_capturer, jobject j_constraints) { | 1228 jobject j_video_capturer, jobject j_constraints) { |
| 1229 rtc::scoped_refptr<SurfaceTextureHelper> surface_texture_helper = |
| 1230 SurfaceTextureHelper::create( |
| 1231 jni, "Camera SurfaceTextureHelper", j_egl_context); |
1227 // Create a cricket::VideoCapturer from |j_video_capturer|. | 1232 // Create a cricket::VideoCapturer from |j_video_capturer|. |
1228 rtc::scoped_refptr<webrtc::AndroidVideoCapturerDelegate> delegate = | 1233 rtc::scoped_refptr<webrtc::AndroidVideoCapturerDelegate> delegate = |
1229 new rtc::RefCountedObject<AndroidVideoCapturerJni>( | 1234 new rtc::RefCountedObject<AndroidVideoCapturerJni>( |
1230 jni, j_video_capturer, j_egl_context); | 1235 jni, j_video_capturer, surface_texture_helper); |
1231 std::unique_ptr<cricket::VideoCapturer> capturer( | 1236 std::unique_ptr<cricket::VideoCapturer> capturer( |
1232 new webrtc::AndroidVideoCapturer(delegate)); | 1237 new webrtc::AndroidVideoCapturer(delegate, surface_texture_helper)); |
1233 // Create a webrtc::VideoTrackSourceInterface from the cricket::VideoCapturer, | 1238 // Create a webrtc::VideoTrackSourceInterface from the cricket::VideoCapturer, |
1234 // native factory and constraints. | 1239 // native factory and constraints. |
1235 std::unique_ptr<ConstraintsWrapper> constraints( | 1240 std::unique_ptr<ConstraintsWrapper> constraints( |
1236 new ConstraintsWrapper(jni, j_constraints)); | 1241 new ConstraintsWrapper(jni, j_constraints)); |
1237 rtc::scoped_refptr<PeerConnectionFactoryInterface> factory( | 1242 rtc::scoped_refptr<PeerConnectionFactoryInterface> factory( |
1238 factoryFromJava(native_factory)); | 1243 factoryFromJava(native_factory)); |
1239 rtc::scoped_refptr<VideoTrackSourceInterface> source( | 1244 rtc::scoped_refptr<VideoTrackSourceInterface> source( |
1240 factory->CreateVideoSource(capturer.release(), constraints.get())); | 1245 factory->CreateVideoSource(capturer.release(), constraints.get())); |
1241 return (jlong)source.release(); | 1246 return (jlong)source.release(); |
1242 } | 1247 } |
(...skipping 968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2211 return JavaStringFromStdString( | 2216 return JavaStringFromStdString( |
2212 jni, | 2217 jni, |
2213 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->id()); | 2218 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->id()); |
2214 } | 2219 } |
2215 | 2220 |
2216 JOW(void, RtpReceiver_free)(JNIEnv* jni, jclass, jlong j_rtp_receiver_pointer) { | 2221 JOW(void, RtpReceiver_free)(JNIEnv* jni, jclass, jlong j_rtp_receiver_pointer) { |
2217 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->Release(); | 2222 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->Release(); |
2218 } | 2223 } |
2219 | 2224 |
2220 } // namespace webrtc_jni | 2225 } // namespace webrtc_jni |
OLD | NEW |