| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 using webrtc::PeerConnectionInterface; | 100 using webrtc::PeerConnectionInterface; |
| 101 using webrtc::PeerConnectionObserver; | 101 using webrtc::PeerConnectionObserver; |
| 102 using webrtc::RtpReceiverInterface; | 102 using webrtc::RtpReceiverInterface; |
| 103 using webrtc::RtpSenderInterface; | 103 using webrtc::RtpSenderInterface; |
| 104 using webrtc::SessionDescriptionInterface; | 104 using webrtc::SessionDescriptionInterface; |
| 105 using webrtc::SetSessionDescriptionObserver; | 105 using webrtc::SetSessionDescriptionObserver; |
| 106 using webrtc::StatsObserver; | 106 using webrtc::StatsObserver; |
| 107 using webrtc::StatsReport; | 107 using webrtc::StatsReport; |
| 108 using webrtc::StatsReports; | 108 using webrtc::StatsReports; |
| 109 using webrtc::VideoRendererInterface; | 109 using webrtc::VideoRendererInterface; |
| 110 using webrtc::VideoSourceInterface; | 110 using webrtc::VideoTrackSourceInterface; |
| 111 using webrtc::VideoTrackInterface; | 111 using webrtc::VideoTrackInterface; |
| 112 using webrtc::VideoTrackVector; | 112 using webrtc::VideoTrackVector; |
| 113 using webrtc::kVideoCodecVP8; | 113 using webrtc::kVideoCodecVP8; |
| 114 | 114 |
| 115 namespace webrtc_jni { | 115 namespace webrtc_jni { |
| 116 | 116 |
| 117 // Field trials initialization string | 117 // Field trials initialization string |
| 118 static char *field_trials_init_string = NULL; | 118 static char *field_trials_init_string = NULL; |
| 119 | 119 |
| 120 // Set in PeerConnectionFactory_initializeAndroidGlobals(). | 120 // Set in PeerConnectionFactory_initializeAndroidGlobals(). |
| (...skipping 1097 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1218 jobject j_surface_texture_helper = jni->CallObjectMethod( | 1218 jobject j_surface_texture_helper = jni->CallObjectMethod( |
| 1219 j_video_capturer, | 1219 j_video_capturer, |
| 1220 GetMethodID(jni, FindClass(jni, "org/webrtc/VideoCapturer"), | 1220 GetMethodID(jni, FindClass(jni, "org/webrtc/VideoCapturer"), |
| 1221 "getSurfaceTextureHelper", | 1221 "getSurfaceTextureHelper", |
| 1222 "()Lorg/webrtc/SurfaceTextureHelper;")); | 1222 "()Lorg/webrtc/SurfaceTextureHelper;")); |
| 1223 rtc::scoped_refptr<webrtc::AndroidVideoCapturerDelegate> delegate = | 1223 rtc::scoped_refptr<webrtc::AndroidVideoCapturerDelegate> delegate = |
| 1224 new rtc::RefCountedObject<AndroidVideoCapturerJni>( | 1224 new rtc::RefCountedObject<AndroidVideoCapturerJni>( |
| 1225 jni, j_video_capturer, j_surface_texture_helper); | 1225 jni, j_video_capturer, j_surface_texture_helper); |
| 1226 rtc::scoped_ptr<cricket::VideoCapturer> capturer( | 1226 rtc::scoped_ptr<cricket::VideoCapturer> capturer( |
| 1227 new webrtc::AndroidVideoCapturer(delegate)); | 1227 new webrtc::AndroidVideoCapturer(delegate)); |
| 1228 // Create a webrtc::VideoSourceInterface from the cricket::VideoCapturer, | 1228 // Create a webrtc::VideoTrackSourceInterface from the cricket::VideoCapturer, |
| 1229 // native factory and constraints. | 1229 // native factory and constraints. |
| 1230 scoped_ptr<ConstraintsWrapper> constraints( | 1230 scoped_ptr<ConstraintsWrapper> constraints( |
| 1231 new ConstraintsWrapper(jni, j_constraints)); | 1231 new ConstraintsWrapper(jni, j_constraints)); |
| 1232 rtc::scoped_refptr<PeerConnectionFactoryInterface> factory( | 1232 rtc::scoped_refptr<PeerConnectionFactoryInterface> factory( |
| 1233 factoryFromJava(native_factory)); | 1233 factoryFromJava(native_factory)); |
| 1234 rtc::scoped_refptr<VideoSourceInterface> source( | 1234 rtc::scoped_refptr<VideoTrackSourceInterface> source( |
| 1235 factory->CreateVideoSource(capturer.release(), constraints.get())); | 1235 factory->CreateVideoSource(capturer.release(), constraints.get())); |
| 1236 return (jlong)source.release(); | 1236 return (jlong)source.release(); |
| 1237 } | 1237 } |
| 1238 | 1238 |
| 1239 JOW(jlong, PeerConnectionFactory_nativeCreateVideoTrack)( | 1239 JOW(jlong, PeerConnectionFactory_nativeCreateVideoTrack)( |
| 1240 JNIEnv* jni, jclass, jlong native_factory, jstring id, | 1240 JNIEnv* jni, jclass, jlong native_factory, jstring id, |
| 1241 jlong native_source) { | 1241 jlong native_source) { |
| 1242 rtc::scoped_refptr<PeerConnectionFactoryInterface> factory( | 1242 rtc::scoped_refptr<PeerConnectionFactoryInterface> factory( |
| 1243 factoryFromJava(native_factory)); | 1243 factoryFromJava(native_factory)); |
| 1244 rtc::scoped_refptr<VideoTrackInterface> track( | 1244 rtc::scoped_refptr<VideoTrackInterface> track(factory->CreateVideoTrack( |
| 1245 factory->CreateVideoTrack( | 1245 JavaToStdString(jni, id), |
| 1246 JavaToStdString(jni, id), | 1246 reinterpret_cast<VideoTrackSourceInterface*>(native_source))); |
| 1247 reinterpret_cast<VideoSourceInterface*>(native_source))); | |
| 1248 return (jlong)track.release(); | 1247 return (jlong)track.release(); |
| 1249 } | 1248 } |
| 1250 | 1249 |
| 1251 JOW(jlong, PeerConnectionFactory_nativeCreateAudioSource)( | 1250 JOW(jlong, PeerConnectionFactory_nativeCreateAudioSource)( |
| 1252 JNIEnv* jni, jclass, jlong native_factory, jobject j_constraints) { | 1251 JNIEnv* jni, jclass, jlong native_factory, jobject j_constraints) { |
| 1253 scoped_ptr<ConstraintsWrapper> constraints( | 1252 scoped_ptr<ConstraintsWrapper> constraints( |
| 1254 new ConstraintsWrapper(jni, j_constraints)); | 1253 new ConstraintsWrapper(jni, j_constraints)); |
| 1255 rtc::scoped_refptr<PeerConnectionFactoryInterface> factory( | 1254 rtc::scoped_refptr<PeerConnectionFactoryInterface> factory( |
| 1256 factoryFromJava(native_factory)); | 1255 factoryFromJava(native_factory)); |
| 1257 rtc::scoped_refptr<AudioSourceInterface> source( | 1256 rtc::scoped_refptr<AudioSourceInterface> source( |
| (...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1880 } else { | 1879 } else { |
| 1881 for (int i = 0; i < height; i++) { | 1880 for (int i = 0; i < height; i++) { |
| 1882 memcpy(dst, src, width); | 1881 memcpy(dst, src, width); |
| 1883 src += src_stride; | 1882 src += src_stride; |
| 1884 dst += dst_stride; | 1883 dst += dst_stride; |
| 1885 } | 1884 } |
| 1886 } | 1885 } |
| 1887 } | 1886 } |
| 1888 | 1887 |
| 1889 JOW(void, VideoSource_stop)(JNIEnv* jni, jclass, jlong j_p) { | 1888 JOW(void, VideoSource_stop)(JNIEnv* jni, jclass, jlong j_p) { |
| 1890 reinterpret_cast<VideoSourceInterface*>(j_p)->Stop(); | 1889 reinterpret_cast<VideoTrackSourceInterface*>(j_p)->Stop(); |
| 1891 } | 1890 } |
| 1892 | 1891 |
| 1893 JOW(void, VideoSource_restart)( | 1892 JOW(void, VideoSource_restart)( |
| 1894 JNIEnv* jni, jclass, jlong j_p_source, jlong j_p_format) { | 1893 JNIEnv* jni, jclass, jlong j_p_source, jlong j_p_format) { |
| 1895 reinterpret_cast<VideoSourceInterface*>(j_p_source)->Restart(); | 1894 reinterpret_cast<VideoTrackSourceInterface*>(j_p_source)->Restart(); |
| 1896 } | 1895 } |
| 1897 | 1896 |
| 1898 JOW(jstring, MediaStreamTrack_nativeId)(JNIEnv* jni, jclass, jlong j_p) { | 1897 JOW(jstring, MediaStreamTrack_nativeId)(JNIEnv* jni, jclass, jlong j_p) { |
| 1899 return JavaStringFromStdString( | 1898 return JavaStringFromStdString( |
| 1900 jni, reinterpret_cast<MediaStreamTrackInterface*>(j_p)->id()); | 1899 jni, reinterpret_cast<MediaStreamTrackInterface*>(j_p)->id()); |
| 1901 } | 1900 } |
| 1902 | 1901 |
| 1903 JOW(jstring, MediaStreamTrack_nativeKind)(JNIEnv* jni, jclass, jlong j_p) { | 1902 JOW(jstring, MediaStreamTrack_nativeKind)(JNIEnv* jni, jclass, jlong j_p) { |
| 1904 return JavaStringFromStdString( | 1903 return JavaStringFromStdString( |
| 1905 jni, reinterpret_cast<MediaStreamTrackInterface*>(j_p)->kind()); | 1904 jni, reinterpret_cast<MediaStreamTrackInterface*>(j_p)->kind()); |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2039 return JavaStringFromStdString( | 2038 return JavaStringFromStdString( |
| 2040 jni, | 2039 jni, |
| 2041 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->id()); | 2040 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->id()); |
| 2042 } | 2041 } |
| 2043 | 2042 |
| 2044 JOW(void, RtpReceiver_free)(JNIEnv* jni, jclass, jlong j_rtp_receiver_pointer) { | 2043 JOW(void, RtpReceiver_free)(JNIEnv* jni, jclass, jlong j_rtp_receiver_pointer) { |
| 2045 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->Release(); | 2044 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->Release(); |
| 2046 } | 2045 } |
| 2047 | 2046 |
| 2048 } // namespace webrtc_jni | 2047 } // namespace webrtc_jni |
| OLD | NEW |