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

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

Issue 1684403002: Android: Remove VideoCapturer (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Nuke VideoCapturer 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
917 JOW(void, VideoRenderer_freeWrappedVideoRenderer)(JNIEnv*, jclass, jlong j_p) { 913 JOW(void, VideoRenderer_freeWrappedVideoRenderer)(JNIEnv*, jclass, jlong j_p) {
918 delete reinterpret_cast<JavaVideoRendererWrapper*>(j_p); 914 delete reinterpret_cast<JavaVideoRendererWrapper*>(j_p);
919 } 915 }
920 916
921 JOW(void, VideoRenderer_releaseNativeFrame)( 917 JOW(void, VideoRenderer_releaseNativeFrame)(
922 JNIEnv* jni, jclass, jlong j_frame_ptr) { 918 JNIEnv* jni, jclass, jlong j_frame_ptr) {
923 delete reinterpret_cast<const cricket::VideoFrame*>(j_frame_ptr); 919 delete reinterpret_cast<const cricket::VideoFrame*>(j_frame_ptr);
924 } 920 }
925 921
926 JOW(void, MediaStreamTrack_free)(JNIEnv*, jclass, jlong j_p) { 922 JOW(void, MediaStreamTrack_free)(JNIEnv*, jclass, jlong j_p) {
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
1209 JOW(jlong, PeerConnectionFactory_nativeCreateLocalMediaStream)( 1205 JOW(jlong, PeerConnectionFactory_nativeCreateLocalMediaStream)(
1210 JNIEnv* jni, jclass, jlong native_factory, jstring label) { 1206 JNIEnv* jni, jclass, jlong native_factory, jstring label) {
1211 rtc::scoped_refptr<PeerConnectionFactoryInterface> factory( 1207 rtc::scoped_refptr<PeerConnectionFactoryInterface> factory(
1212 factoryFromJava(native_factory)); 1208 factoryFromJava(native_factory));
1213 rtc::scoped_refptr<MediaStreamInterface> stream( 1209 rtc::scoped_refptr<MediaStreamInterface> stream(
1214 factory->CreateLocalMediaStream(JavaToStdString(jni, label))); 1210 factory->CreateLocalMediaStream(JavaToStdString(jni, label)));
1215 return (jlong)stream.release(); 1211 return (jlong)stream.release();
1216 } 1212 }
1217 1213
1218 JOW(jlong, PeerConnectionFactory_nativeCreateVideoSource)( 1214 JOW(jlong, PeerConnectionFactory_nativeCreateVideoSource)(
1219 JNIEnv* jni, jclass, jlong native_factory, jlong native_capturer, 1215 JNIEnv* jni, jclass, jlong native_factory, jobject j_video_capturer,
1220 jobject j_constraints) { 1216 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.
1221 scoped_ptr<ConstraintsWrapper> constraints( 1229 scoped_ptr<ConstraintsWrapper> constraints(
1222 new ConstraintsWrapper(jni, j_constraints)); 1230 new ConstraintsWrapper(jni, j_constraints));
1223 rtc::scoped_refptr<PeerConnectionFactoryInterface> factory( 1231 rtc::scoped_refptr<PeerConnectionFactoryInterface> factory(
1224 factoryFromJava(native_factory)); 1232 factoryFromJava(native_factory));
1225 rtc::scoped_refptr<VideoSourceInterface> source( 1233 rtc::scoped_refptr<VideoSourceInterface> source(
1226 factory->CreateVideoSource( 1234 factory->CreateVideoSource(capturer.release(), constraints.get()));
1227 reinterpret_cast<cricket::VideoCapturer*>(native_capturer),
1228 constraints.get()));
1229 return (jlong)source.release(); 1235 return (jlong)source.release();
1230 } 1236 }
1231 1237
1232 JOW(jlong, PeerConnectionFactory_nativeCreateVideoTrack)( 1238 JOW(jlong, PeerConnectionFactory_nativeCreateVideoTrack)(
1233 JNIEnv* jni, jclass, jlong native_factory, jstring id, 1239 JNIEnv* jni, jclass, jlong native_factory, jstring id,
1234 jlong native_source) { 1240 jlong native_source) {
1235 rtc::scoped_refptr<PeerConnectionFactoryInterface> factory( 1241 rtc::scoped_refptr<PeerConnectionFactoryInterface> factory(
1236 factoryFromJava(native_factory)); 1242 factoryFromJava(native_factory));
1237 rtc::scoped_refptr<VideoTrackInterface> track( 1243 rtc::scoped_refptr<VideoTrackInterface> track(
1238 factory->CreateVideoTrack( 1244 factory->CreateVideoTrack(
(...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after
2032 return JavaStringFromStdString( 2038 return JavaStringFromStdString(
2033 jni, 2039 jni,
2034 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->id()); 2040 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->id());
2035 } 2041 }
2036 2042
2037 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) {
2038 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->Release(); 2044 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->Release();
2039 } 2045 }
2040 2046
2041 } // namespace webrtc_jni 2047 } // 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