Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Side by Side Diff: webrtc/api/java/jni/peerconnection_jni.cc

Issue 1690073002: Revert of Android: Remove VideoCapturer (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 892 matching lines...) Expand 10 before | Expand all | Expand 10 after
903 903
904 JOW(void, PeerConnection_freeObserver)(JNIEnv*, jclass, jlong j_p) { 904 JOW(void, PeerConnection_freeObserver)(JNIEnv*, jclass, jlong j_p) {
905 PCOJava* p = reinterpret_cast<PCOJava*>(j_p); 905 PCOJava* p = reinterpret_cast<PCOJava*>(j_p);
906 delete p; 906 delete p;
907 } 907 }
908 908
909 JOW(void, MediaSource_free)(JNIEnv*, jclass, jlong j_p) { 909 JOW(void, MediaSource_free)(JNIEnv*, jclass, jlong j_p) {
910 CHECK_RELEASE(reinterpret_cast<MediaSourceInterface*>(j_p)); 910 CHECK_RELEASE(reinterpret_cast<MediaSourceInterface*>(j_p));
911 } 911 }
912 912
913 JOW(void, VideoCapturer_free)(JNIEnv*, jclass, jlong j_p) {
914 delete reinterpret_cast<cricket::VideoCapturer*>(j_p);
915 }
916
913 JOW(void, VideoRenderer_freeWrappedVideoRenderer)(JNIEnv*, jclass, jlong j_p) { 917 JOW(void, VideoRenderer_freeWrappedVideoRenderer)(JNIEnv*, jclass, jlong j_p) {
914 delete reinterpret_cast<JavaVideoRendererWrapper*>(j_p); 918 delete reinterpret_cast<JavaVideoRendererWrapper*>(j_p);
915 } 919 }
916 920
917 JOW(void, VideoRenderer_releaseNativeFrame)( 921 JOW(void, VideoRenderer_releaseNativeFrame)(
918 JNIEnv* jni, jclass, jlong j_frame_ptr) { 922 JNIEnv* jni, jclass, jlong j_frame_ptr) {
919 delete reinterpret_cast<const cricket::VideoFrame*>(j_frame_ptr); 923 delete reinterpret_cast<const cricket::VideoFrame*>(j_frame_ptr);
920 } 924 }
921 925
922 JOW(void, MediaStreamTrack_free)(JNIEnv*, jclass, jlong j_p) { 926 JOW(void, MediaStreamTrack_free)(JNIEnv*, jclass, jlong j_p) {
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
1205 JOW(jlong, PeerConnectionFactory_nativeCreateLocalMediaStream)( 1209 JOW(jlong, PeerConnectionFactory_nativeCreateLocalMediaStream)(
1206 JNIEnv* jni, jclass, jlong native_factory, jstring label) { 1210 JNIEnv* jni, jclass, jlong native_factory, jstring label) {
1207 rtc::scoped_refptr<PeerConnectionFactoryInterface> factory( 1211 rtc::scoped_refptr<PeerConnectionFactoryInterface> factory(
1208 factoryFromJava(native_factory)); 1212 factoryFromJava(native_factory));
1209 rtc::scoped_refptr<MediaStreamInterface> stream( 1213 rtc::scoped_refptr<MediaStreamInterface> stream(
1210 factory->CreateLocalMediaStream(JavaToStdString(jni, label))); 1214 factory->CreateLocalMediaStream(JavaToStdString(jni, label)));
1211 return (jlong)stream.release(); 1215 return (jlong)stream.release();
1212 } 1216 }
1213 1217
1214 JOW(jlong, PeerConnectionFactory_nativeCreateVideoSource)( 1218 JOW(jlong, PeerConnectionFactory_nativeCreateVideoSource)(
1215 JNIEnv* jni, jclass, jlong native_factory, jobject j_video_capturer, 1219 JNIEnv* jni, jclass, jlong native_factory, jlong native_capturer,
1216 jobject j_constraints) { 1220 jobject j_constraints) {
1217 // Create a cricket::VideoCapturer from |j_video_capturer|.
1218 jobject j_surface_texture_helper = GetObjectField(
1219 jni, j_video_capturer,
1220 GetFieldID(jni, FindClass(jni, "org/webrtc/VideoCapturerAndroid"),
1221 "surfaceHelper", "Lorg/webrtc/SurfaceTextureHelper;"));
1222 rtc::scoped_refptr<webrtc::AndroidVideoCapturerDelegate> delegate =
1223 new rtc::RefCountedObject<AndroidVideoCapturerJni>(
1224 jni, j_video_capturer, j_surface_texture_helper);
1225 rtc::scoped_ptr<cricket::VideoCapturer> capturer(
1226 new webrtc::AndroidVideoCapturer(delegate));
1227 // Create a webrtc::VideoSourceInterface from the cricket::VideoCapturer,
1228 // native factory and constraints.
1229 scoped_ptr<ConstraintsWrapper> constraints( 1221 scoped_ptr<ConstraintsWrapper> constraints(
1230 new ConstraintsWrapper(jni, j_constraints)); 1222 new ConstraintsWrapper(jni, j_constraints));
1231 rtc::scoped_refptr<PeerConnectionFactoryInterface> factory( 1223 rtc::scoped_refptr<PeerConnectionFactoryInterface> factory(
1232 factoryFromJava(native_factory)); 1224 factoryFromJava(native_factory));
1233 rtc::scoped_refptr<VideoSourceInterface> source( 1225 rtc::scoped_refptr<VideoSourceInterface> source(
1234 factory->CreateVideoSource(capturer.release(), constraints.get())); 1226 factory->CreateVideoSource(
1227 reinterpret_cast<cricket::VideoCapturer*>(native_capturer),
1228 constraints.get()));
1235 return (jlong)source.release(); 1229 return (jlong)source.release();
1236 } 1230 }
1237 1231
1238 JOW(jlong, PeerConnectionFactory_nativeCreateVideoTrack)( 1232 JOW(jlong, PeerConnectionFactory_nativeCreateVideoTrack)(
1239 JNIEnv* jni, jclass, jlong native_factory, jstring id, 1233 JNIEnv* jni, jclass, jlong native_factory, jstring id,
1240 jlong native_source) { 1234 jlong native_source) {
1241 rtc::scoped_refptr<PeerConnectionFactoryInterface> factory( 1235 rtc::scoped_refptr<PeerConnectionFactoryInterface> factory(
1242 factoryFromJava(native_factory)); 1236 factoryFromJava(native_factory));
1243 rtc::scoped_refptr<VideoTrackInterface> track( 1237 rtc::scoped_refptr<VideoTrackInterface> track(
1244 factory->CreateVideoTrack( 1238 factory->CreateVideoTrack(
(...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after
2038 return JavaStringFromStdString( 2032 return JavaStringFromStdString(
2039 jni, 2033 jni,
2040 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->id()); 2034 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->id());
2041 } 2035 }
2042 2036
2043 JOW(void, RtpReceiver_free)(JNIEnv* jni, jclass, jlong j_rtp_receiver_pointer) { 2037 JOW(void, RtpReceiver_free)(JNIEnv* jni, jclass, jlong j_rtp_receiver_pointer) {
2044 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->Release(); 2038 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->Release();
2045 } 2039 }
2046 2040
2047 } // namespace webrtc_jni 2041 } // namespace webrtc_jni
OLDNEW
« no previous file with comments | « webrtc/api/java/jni/androidvideocapturer_jni.cc ('k') | webrtc/api/java/src/org/webrtc/PeerConnectionFactory.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698