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

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

Issue 2291583002: Revert of Remove the old AndroidVideoCapturer stack code. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 3 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
« no previous file with comments | « webrtc/api/android/jni/classreferenceholder.cc ('k') | webrtc/api/androidvideocapturer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 25 matching lines...) Expand all
36 // impossible to tell which JNI call broke). 36 // impossible to tell which JNI call broke).
37 37
38 #include <jni.h> 38 #include <jni.h>
39 #undef JNIEXPORT 39 #undef JNIEXPORT
40 #define JNIEXPORT __attribute__((visibility("default"))) 40 #define JNIEXPORT __attribute__((visibility("default")))
41 41
42 #include <limits> 42 #include <limits>
43 #include <memory> 43 #include <memory>
44 #include <utility> 44 #include <utility>
45 45
46 #include "webrtc/api/androidvideocapturer.h"
46 #include "webrtc/api/androidvideotracksource.h" 47 #include "webrtc/api/androidvideotracksource.h"
47 #include "webrtc/api/android/jni/androidmediadecoder_jni.h" 48 #include "webrtc/api/android/jni/androidmediadecoder_jni.h"
48 #include "webrtc/api/android/jni/androidmediaencoder_jni.h" 49 #include "webrtc/api/android/jni/androidmediaencoder_jni.h"
49 #include "webrtc/api/android/jni/androidnetworkmonitor_jni.h" 50 #include "webrtc/api/android/jni/androidnetworkmonitor_jni.h"
51 #include "webrtc/api/android/jni/androidvideocapturer_jni.h"
50 #include "webrtc/api/android/jni/classreferenceholder.h" 52 #include "webrtc/api/android/jni/classreferenceholder.h"
51 #include "webrtc/api/android/jni/jni_helpers.h" 53 #include "webrtc/api/android/jni/jni_helpers.h"
52 #include "webrtc/api/android/jni/native_handle_impl.h" 54 #include "webrtc/api/android/jni/native_handle_impl.h"
53 #include "webrtc/api/mediaconstraintsinterface.h" 55 #include "webrtc/api/mediaconstraintsinterface.h"
54 #include "webrtc/api/peerconnectioninterface.h" 56 #include "webrtc/api/peerconnectioninterface.h"
55 #include "webrtc/api/rtpreceiverinterface.h" 57 #include "webrtc/api/rtpreceiverinterface.h"
56 #include "webrtc/api/rtpsenderinterface.h" 58 #include "webrtc/api/rtpsenderinterface.h"
57 #include "webrtc/api/videosourceproxy.h" 59 #include "webrtc/api/videosourceproxy.h"
58 #include "webrtc/api/webrtcsdp.h" 60 #include "webrtc/api/webrtcsdp.h"
59 #include "webrtc/base/bind.h" 61 #include "webrtc/base/bind.h"
(...skipping 933 matching lines...) Expand 10 before | Expand all | Expand 10 after
993 jboolean initialize_audio, 995 jboolean initialize_audio,
994 jboolean initialize_video, 996 jboolean initialize_video,
995 jboolean video_hw_acceleration) { 997 jboolean video_hw_acceleration) {
996 bool failure = false; 998 bool failure = false;
997 video_hw_acceleration_enabled = video_hw_acceleration; 999 video_hw_acceleration_enabled = video_hw_acceleration;
998 AndroidNetworkMonitor::SetAndroidContext(jni, context); 1000 AndroidNetworkMonitor::SetAndroidContext(jni, context);
999 if (!factory_static_initialized) { 1001 if (!factory_static_initialized) {
1000 RTC_DCHECK(j_application_context == nullptr); 1002 RTC_DCHECK(j_application_context == nullptr);
1001 j_application_context = NewGlobalRef(jni, context); 1003 j_application_context = NewGlobalRef(jni, context);
1002 1004
1005 if (initialize_video) {
1006 failure |= AndroidVideoCapturerJni::SetAndroidObjects(jni, context);
1007 }
1003 if (initialize_audio) 1008 if (initialize_audio)
1004 failure |= webrtc::VoiceEngine::SetAndroidObjects(GetJVM(), context); 1009 failure |= webrtc::VoiceEngine::SetAndroidObjects(GetJVM(), context);
1005 factory_static_initialized = true; 1010 factory_static_initialized = true;
1006 } 1011 }
1007 return !failure; 1012 return !failure;
1008 } 1013 }
1009 1014
1010 JOW(void, PeerConnectionFactory_initializeFieldTrials)( 1015 JOW(void, PeerConnectionFactory_initializeFieldTrials)(
1011 JNIEnv* jni, jclass, jstring j_trials_init_string) { 1016 JNIEnv* jni, jclass, jstring j_trials_init_string) {
1012 field_trials_init_string = NULL; 1017 field_trials_init_string = NULL;
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
1249 1254
1250 JOW(jlong, PeerConnectionFactory_nativeCreateLocalMediaStream)( 1255 JOW(jlong, PeerConnectionFactory_nativeCreateLocalMediaStream)(
1251 JNIEnv* jni, jclass, jlong native_factory, jstring label) { 1256 JNIEnv* jni, jclass, jlong native_factory, jstring label) {
1252 rtc::scoped_refptr<PeerConnectionFactoryInterface> factory( 1257 rtc::scoped_refptr<PeerConnectionFactoryInterface> factory(
1253 factoryFromJava(native_factory)); 1258 factoryFromJava(native_factory));
1254 rtc::scoped_refptr<MediaStreamInterface> stream( 1259 rtc::scoped_refptr<MediaStreamInterface> stream(
1255 factory->CreateLocalMediaStream(JavaToStdString(jni, label))); 1260 factory->CreateLocalMediaStream(JavaToStdString(jni, label)));
1256 return (jlong)stream.release(); 1261 return (jlong)stream.release();
1257 } 1262 }
1258 1263
1259 JOW(jlong, PeerConnectionFactory_nativeCreateVideoSource) 1264 JOW(jlong, PeerConnectionFactory_nativeCreateVideoSource)(
1265 JNIEnv* jni, jclass, jlong native_factory, jobject j_egl_context,
1266 jobject j_video_capturer, jobject j_constraints) {
1267 // Create a cricket::VideoCapturer from |j_video_capturer|.
1268 rtc::scoped_refptr<webrtc::AndroidVideoCapturerDelegate> delegate =
1269 new rtc::RefCountedObject<AndroidVideoCapturerJni>(
1270 jni, j_video_capturer, j_egl_context);
1271 std::unique_ptr<cricket::VideoCapturer> capturer(
1272 new webrtc::AndroidVideoCapturer(delegate));
1273 // Create a webrtc::VideoTrackSourceInterface from the cricket::VideoCapturer,
1274 // native factory and constraints.
1275 std::unique_ptr<ConstraintsWrapper> constraints(
1276 new ConstraintsWrapper(jni, j_constraints));
1277 rtc::scoped_refptr<PeerConnectionFactoryInterface> factory(
1278 factoryFromJava(native_factory));
1279 rtc::scoped_refptr<VideoTrackSourceInterface> source(
1280 factory->CreateVideoSource(capturer.release(), constraints.get()));
1281 return (jlong)source.release();
1282 }
1283
1284 JOW(jlong, PeerConnectionFactory_nativeCreateVideoSource2)
1260 (JNIEnv* jni, jclass, jlong native_factory, jobject j_egl_context) { 1285 (JNIEnv* jni, jclass, jlong native_factory, jobject j_egl_context) {
1261 OwnedFactoryAndThreads* factory = 1286 OwnedFactoryAndThreads* factory =
1262 reinterpret_cast<OwnedFactoryAndThreads*>(native_factory); 1287 reinterpret_cast<OwnedFactoryAndThreads*>(native_factory);
1263 1288
1264 rtc::scoped_refptr<webrtc::AndroidVideoTrackSource> source( 1289 rtc::scoped_refptr<webrtc::AndroidVideoTrackSource> source(
1265 new rtc::RefCountedObject<webrtc::AndroidVideoTrackSource>( 1290 new rtc::RefCountedObject<webrtc::AndroidVideoTrackSource>(
1266 factory->signaling_thread(), jni, j_egl_context)); 1291 factory->signaling_thread(), jni, j_egl_context));
1267 rtc::scoped_refptr<webrtc::VideoTrackSourceProxy> proxy_source = 1292 rtc::scoped_refptr<webrtc::VideoTrackSourceProxy> proxy_source =
1268 webrtc::VideoTrackSourceProxy::Create(factory->signaling_thread(), 1293 webrtc::VideoTrackSourceProxy::Create(factory->signaling_thread(),
1269 factory->worker_thread(), source); 1294 factory->worker_thread(), source);
(...skipping 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after
2323 return JavaStringFromStdString( 2348 return JavaStringFromStdString(
2324 jni, 2349 jni,
2325 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->id()); 2350 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->id());
2326 } 2351 }
2327 2352
2328 JOW(void, RtpReceiver_free)(JNIEnv* jni, jclass, jlong j_rtp_receiver_pointer) { 2353 JOW(void, RtpReceiver_free)(JNIEnv* jni, jclass, jlong j_rtp_receiver_pointer) {
2329 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->Release(); 2354 reinterpret_cast<RtpReceiverInterface*>(j_rtp_receiver_pointer)->Release();
2330 } 2355 }
2331 2356
2332 } // namespace webrtc_jni 2357 } // namespace webrtc_jni
OLDNEW
« no previous file with comments | « webrtc/api/android/jni/classreferenceholder.cc ('k') | webrtc/api/androidvideocapturer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698