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

Side by Side Diff: webrtc/sdk/android/src/jni/peerconnection_jni.cc

Issue 2767643002: Enable the Java wrapper to load different .so library.
Patch Set: Add static method to the subclass to solve the linking error. Created 3 years, 7 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 using webrtc::VideoTrackSourceInterface; 116 using webrtc::VideoTrackSourceInterface;
117 using webrtc::VideoTrackInterface; 117 using webrtc::VideoTrackInterface;
118 using webrtc::VideoTrackVector; 118 using webrtc::VideoTrackVector;
119 using webrtc::kVideoCodecVP8; 119 using webrtc::kVideoCodecVP8;
120 120
121 namespace webrtc_jni { 121 namespace webrtc_jni {
122 122
123 // Field trials initialization string 123 // Field trials initialization string
124 static char *field_trials_init_string = NULL; 124 static char *field_trials_init_string = NULL;
125 125
126 // Set in PeerConnectionFactory_initializeAndroidGlobals(). 126 // Set in PeerConnectionFactoryBase_initializeAndroidGlobals().
127 static bool factory_static_initialized = false; 127 static bool factory_static_initialized = false;
128 static bool video_hw_acceleration_enabled = true; 128 static bool video_hw_acceleration_enabled = true;
129 static jobject j_application_context = nullptr; 129 static jobject j_application_context = nullptr;
130 130
131 // Return the (singleton) Java Enum object corresponding to |index|; 131 // Return the (singleton) Java Enum object corresponding to |index|;
132 // |state_class_fragment| is something like "MediaSource$State". 132 // |state_class_fragment| is something like "MediaSource$State".
133 static jobject JavaEnumFromIndex( 133 static jobject JavaEnumFromIndex(
134 JNIEnv* jni, const std::string& state_class_fragment, int index) { 134 JNIEnv* jni, const std::string& state_class_fragment, int index) {
135 const std::string state_class = "org/webrtc/" + state_class_fragment; 135 const std::string state_class = "org/webrtc/" + state_class_fragment;
136 return JavaEnumFromIndex(jni, FindClass(jni, state_class.c_str()), 136 return JavaEnumFromIndex(jni, FindClass(jni, state_class.c_str()),
(...skipping 987 matching lines...) Expand 10 before | Expand all | Expand 10 after
1124 1124
1125 JOW(jstring, MediaStream_nativeLabel)(JNIEnv* jni, jclass, jlong j_p) { 1125 JOW(jstring, MediaStream_nativeLabel)(JNIEnv* jni, jclass, jlong j_p) {
1126 return JavaStringFromStdString( 1126 return JavaStringFromStdString(
1127 jni, reinterpret_cast<MediaStreamInterface*>(j_p)->label()); 1127 jni, reinterpret_cast<MediaStreamInterface*>(j_p)->label());
1128 } 1128 }
1129 1129
1130 JOW(void, MediaStream_free)(JNIEnv*, jclass, jlong j_p) { 1130 JOW(void, MediaStream_free)(JNIEnv*, jclass, jlong j_p) {
1131 CHECK_RELEASE(reinterpret_cast<MediaStreamInterface*>(j_p)); 1131 CHECK_RELEASE(reinterpret_cast<MediaStreamInterface*>(j_p));
1132 } 1132 }
1133 1133
1134 JOW(jlong, PeerConnectionFactory_nativeCreateObserver)( 1134 JOW(jlong, PeerConnectionFactoryBase_nativeCreateObserver)
1135 JNIEnv * jni, jclass, jobject j_observer) { 1135 (JNIEnv* jni, jclass, jobject j_observer) {
1136 return (jlong)new PCOJava(jni, j_observer); 1136 return (jlong)new PCOJava(jni, j_observer);
1137 } 1137 }
1138 1138
1139 JOW(void, PeerConnectionFactory_initializeAndroidGlobals) 1139 JOW(void, PeerConnectionFactoryBase_initializeAndroidGlobals)
1140 (JNIEnv* jni, 1140 (JNIEnv* jni,
1141 jclass, 1141 jclass,
1142 jobject context, 1142 jobject context,
1143 jboolean video_hw_acceleration) { 1143 jboolean video_hw_acceleration) {
1144 video_hw_acceleration_enabled = video_hw_acceleration; 1144 video_hw_acceleration_enabled = video_hw_acceleration;
1145 AndroidNetworkMonitor::SetAndroidContext(jni, context); 1145 AndroidNetworkMonitor::SetAndroidContext(jni, context);
1146 if (!factory_static_initialized) { 1146 if (!factory_static_initialized) {
1147 RTC_DCHECK(j_application_context == nullptr); 1147 RTC_DCHECK(j_application_context == nullptr);
1148 j_application_context = NewGlobalRef(jni, context); 1148 j_application_context = NewGlobalRef(jni, context);
1149 webrtc::JVM::Initialize(GetJVM(), context); 1149 webrtc::JVM::Initialize(GetJVM(), context);
1150 factory_static_initialized = true; 1150 factory_static_initialized = true;
1151 } 1151 }
1152 } 1152 }
1153 1153
1154 JOW(void, PeerConnectionFactory_initializeFieldTrials)( 1154 JOW(void, PeerConnectionFactoryBase_initializeFieldTrials)
1155 JNIEnv* jni, jclass, jstring j_trials_init_string) { 1155 (JNIEnv* jni, jclass, jstring j_trials_init_string) {
1156 field_trials_init_string = NULL; 1156 field_trials_init_string = NULL;
1157 if (j_trials_init_string != NULL) { 1157 if (j_trials_init_string != NULL) {
1158 const char* init_string = 1158 const char* init_string =
1159 jni->GetStringUTFChars(j_trials_init_string, NULL); 1159 jni->GetStringUTFChars(j_trials_init_string, NULL);
1160 int init_string_length = jni->GetStringUTFLength(j_trials_init_string); 1160 int init_string_length = jni->GetStringUTFLength(j_trials_init_string);
1161 field_trials_init_string = new char[init_string_length + 1]; 1161 field_trials_init_string = new char[init_string_length + 1];
1162 rtc::strcpyn(field_trials_init_string, init_string_length + 1, init_string); 1162 rtc::strcpyn(field_trials_init_string, init_string_length + 1, init_string);
1163 jni->ReleaseStringUTFChars(j_trials_init_string, init_string); 1163 jni->ReleaseStringUTFChars(j_trials_init_string, init_string);
1164 LOG(LS_INFO) << "initializeFieldTrials: " << field_trials_init_string; 1164 LOG(LS_INFO) << "initializeFieldTrials: " << field_trials_init_string;
1165 } 1165 }
1166 webrtc::field_trial::InitFieldTrialsFromString(field_trials_init_string); 1166 webrtc::field_trial::InitFieldTrialsFromString(field_trials_init_string);
1167 } 1167 }
1168 1168
1169 JOW(void, PeerConnectionFactory_initializeInternalTracer)(JNIEnv* jni, jclass) { 1169 JOW(void, PeerConnectionFactoryBase_initializeInternalTracer)
1170 (JNIEnv* jni, jclass) {
1170 rtc::tracing::SetupInternalTracer(); 1171 rtc::tracing::SetupInternalTracer();
1171 } 1172 }
1172 1173
1173 JOW(jstring, PeerConnectionFactory_nativeFieldTrialsFindFullName) 1174 JOW(jstring, PeerConnectionFactoryBase_nativeFieldTrialsFindFullName)
1174 (JNIEnv* jni, jclass, jstring j_name) { 1175 (JNIEnv* jni, jclass, jstring j_name) {
1175 return JavaStringFromStdString( 1176 return JavaStringFromStdString(
1176 jni, webrtc::field_trial::FindFullName(JavaToStdString(jni, j_name))); 1177 jni, webrtc::field_trial::FindFullName(JavaToStdString(jni, j_name)));
1177 } 1178 }
1178 1179
1179 JOW(jboolean, PeerConnectionFactory_startInternalTracingCapture)( 1180 JOW(jboolean, PeerConnectionFactoryBase_startInternalTracingCapture)
1180 JNIEnv* jni, jclass, jstring j_event_tracing_filename) { 1181 (JNIEnv* jni, jclass, jstring j_event_tracing_filename) {
1181 if (!j_event_tracing_filename) 1182 if (!j_event_tracing_filename)
1182 return false; 1183 return false;
1183 1184
1184 const char* init_string = 1185 const char* init_string =
1185 jni->GetStringUTFChars(j_event_tracing_filename, NULL); 1186 jni->GetStringUTFChars(j_event_tracing_filename, NULL);
1186 LOG(LS_INFO) << "Starting internal tracing to: " << init_string; 1187 LOG(LS_INFO) << "Starting internal tracing to: " << init_string;
1187 bool ret = rtc::tracing::StartInternalCapture(init_string); 1188 bool ret = rtc::tracing::StartInternalCapture(init_string);
1188 jni->ReleaseStringUTFChars(j_event_tracing_filename, init_string); 1189 jni->ReleaseStringUTFChars(j_event_tracing_filename, init_string);
1189 return ret; 1190 return ret;
1190 } 1191 }
1191 1192
1192 JOW(void, PeerConnectionFactory_stopInternalTracingCapture)( 1193 JOW(void, PeerConnectionFactoryBase_stopInternalTracingCapture)
1193 JNIEnv* jni, jclass) { 1194 (JNIEnv* jni, jclass) {
1194 rtc::tracing::StopInternalCapture(); 1195 rtc::tracing::StopInternalCapture();
1195 } 1196 }
1196 1197
1197 JOW(void, PeerConnectionFactory_shutdownInternalTracer)(JNIEnv* jni, jclass) { 1198 JOW(void, PeerConnectionFactoryBase_shutdownInternalTracer)
1199 (JNIEnv* jni, jclass) {
1198 rtc::tracing::ShutdownInternalTracer(); 1200 rtc::tracing::ShutdownInternalTracer();
1199 } 1201 }
1200 1202
1201 JOW(void, AudioTrack_nativeSetVolume) 1203 JOW(void, AudioTrack_nativeSetVolume)
1202 (JNIEnv*, jclass, jlong j_p, jdouble volume) { 1204 (JNIEnv*, jclass, jlong j_p, jdouble volume) {
1203 rtc::scoped_refptr<AudioSourceInterface> source( 1205 rtc::scoped_refptr<AudioSourceInterface> source(
1204 reinterpret_cast<AudioTrackInterface*>(j_p)->GetSource()); 1206 reinterpret_cast<AudioTrackInterface*>(j_p)->GetSource());
1205 source->SetVolume(volume); 1207 source->SetVolume(volume);
1206 } 1208 }
1207 1209
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
1313 PeerConnectionFactoryInterface::Options native_options; 1315 PeerConnectionFactoryInterface::Options native_options;
1314 1316
1315 // This doesn't necessarily match the c++ version of this struct; feel free 1317 // This doesn't necessarily match the c++ version of this struct; feel free
1316 // to add more parameters as necessary. 1318 // to add more parameters as necessary.
1317 native_options.network_ignore_mask = network_ignore_mask; 1319 native_options.network_ignore_mask = network_ignore_mask;
1318 native_options.disable_encryption = disable_encryption; 1320 native_options.disable_encryption = disable_encryption;
1319 native_options.disable_network_monitor = disable_network_monitor; 1321 native_options.disable_network_monitor = disable_network_monitor;
1320 return native_options; 1322 return native_options;
1321 } 1323 }
1322 1324
1323 JOW(jlong, PeerConnectionFactory_nativeCreatePeerConnectionFactory)( 1325 JOW(jlong, PeerConnectionFactoryBase_nativeCreatePeerConnectionFactory)
1324 JNIEnv* jni, jclass, jobject joptions) { 1326 (JNIEnv* jni, jclass, jobject joptions) {
1325 // talk/ assumes pretty widely that the current Thread is ThreadManager'd, but 1327 // talk/ assumes pretty widely that the current Thread is ThreadManager'd, but
1326 // ThreadManager only WrapCurrentThread()s the thread where it is first 1328 // ThreadManager only WrapCurrentThread()s the thread where it is first
1327 // created. Since the semantics around when auto-wrapping happens in 1329 // created. Since the semantics around when auto-wrapping happens in
1328 // webrtc/base/ are convoluted, we simply wrap here to avoid having to think 1330 // webrtc/base/ are convoluted, we simply wrap here to avoid having to think
1329 // about ramifications of auto-wrapping there. 1331 // about ramifications of auto-wrapping there.
1330 rtc::ThreadManager::Instance()->WrapCurrentThread(); 1332 rtc::ThreadManager::Instance()->WrapCurrentThread();
1331 webrtc::Trace::CreateTrace(); 1333 webrtc::Trace::CreateTrace();
1332 1334
1333 std::unique_ptr<Thread> network_thread = 1335 std::unique_ptr<Thread> network_thread =
1334 rtc::Thread::CreateWithSocketServer(); 1336 rtc::Thread::CreateWithSocketServer();
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1376 factory->SetOptions(options); 1378 factory->SetOptions(options);
1377 } 1379 }
1378 OwnedFactoryAndThreads* owned_factory = new OwnedFactoryAndThreads( 1380 OwnedFactoryAndThreads* owned_factory = new OwnedFactoryAndThreads(
1379 std::move(network_thread), std::move(worker_thread), 1381 std::move(network_thread), std::move(worker_thread),
1380 std::move(signaling_thread), encoder_factory, decoder_factory, 1382 std::move(signaling_thread), encoder_factory, decoder_factory,
1381 network_monitor_factory, factory.release()); 1383 network_monitor_factory, factory.release());
1382 owned_factory->InvokeJavaCallbacksOnFactoryThreads(); 1384 owned_factory->InvokeJavaCallbacksOnFactoryThreads();
1383 return jlongFromPointer(owned_factory); 1385 return jlongFromPointer(owned_factory);
1384 } 1386 }
1385 1387
1386 JOW(void, PeerConnectionFactory_nativeFreeFactory)(JNIEnv*, jclass, jlong j_p) { 1388 JOW(void, PeerConnectionFactoryBase_nativeFreeFactory)
1389 (JNIEnv*, jclass, jlong j_p) {
1387 delete reinterpret_cast<OwnedFactoryAndThreads*>(j_p); 1390 delete reinterpret_cast<OwnedFactoryAndThreads*>(j_p);
1388 if (field_trials_init_string) { 1391 if (field_trials_init_string) {
1389 webrtc::field_trial::InitFieldTrialsFromString(NULL); 1392 webrtc::field_trial::InitFieldTrialsFromString(NULL);
1390 delete field_trials_init_string; 1393 delete field_trials_init_string;
1391 field_trials_init_string = NULL; 1394 field_trials_init_string = NULL;
1392 } 1395 }
1393 webrtc::Trace::ReturnTrace(); 1396 webrtc::Trace::ReturnTrace();
1394 } 1397 }
1395 1398
1396 static PeerConnectionFactoryInterface* factoryFromJava(jlong j_p) { 1399 static PeerConnectionFactoryInterface* factoryFromJava(jlong j_p) {
1397 return reinterpret_cast<OwnedFactoryAndThreads*>(j_p)->factory(); 1400 return reinterpret_cast<OwnedFactoryAndThreads*>(j_p)->factory();
1398 } 1401 }
1399 1402
1400 JOW(void, PeerConnectionFactory_nativeThreadsCallbacks)( 1403 JOW(void, PeerConnectionFactoryBase_nativeThreadsCallbacks)
1401 JNIEnv*, jclass, jlong j_p) { 1404 (JNIEnv*, jclass, jlong j_p) {
1402 OwnedFactoryAndThreads *factory = 1405 OwnedFactoryAndThreads *factory =
1403 reinterpret_cast<OwnedFactoryAndThreads*>(j_p); 1406 reinterpret_cast<OwnedFactoryAndThreads*>(j_p);
1404 factory->InvokeJavaCallbacksOnFactoryThreads(); 1407 factory->InvokeJavaCallbacksOnFactoryThreads();
1405 } 1408 }
1406 1409
1407 JOW(jlong, PeerConnectionFactory_nativeCreateLocalMediaStream)( 1410 JOW(jlong, PeerConnectionFactoryBase_nativeCreateLocalMediaStream)
1408 JNIEnv* jni, jclass, jlong native_factory, jstring label) { 1411 (JNIEnv* jni, jclass, jlong native_factory, jstring label) {
1409 rtc::scoped_refptr<PeerConnectionFactoryInterface> factory( 1412 rtc::scoped_refptr<PeerConnectionFactoryInterface> factory(
1410 factoryFromJava(native_factory)); 1413 factoryFromJava(native_factory));
1411 rtc::scoped_refptr<MediaStreamInterface> stream( 1414 rtc::scoped_refptr<MediaStreamInterface> stream(
1412 factory->CreateLocalMediaStream(JavaToStdString(jni, label))); 1415 factory->CreateLocalMediaStream(JavaToStdString(jni, label)));
1413 return (jlong)stream.release(); 1416 return (jlong)stream.release();
1414 } 1417 }
1415 1418
1416 JOW(jlong, PeerConnectionFactory_nativeCreateVideoSource) 1419 JOW(jlong, PeerConnectionFactoryBase_nativeCreateVideoSource)
1417 (JNIEnv* jni, jclass, jlong native_factory, jobject j_egl_context, 1420 (JNIEnv* jni, jclass, jlong native_factory, jobject j_egl_context,
1418 jboolean is_screencast) { 1421 jboolean is_screencast) {
1419 OwnedFactoryAndThreads* factory = 1422 OwnedFactoryAndThreads* factory =
1420 reinterpret_cast<OwnedFactoryAndThreads*>(native_factory); 1423 reinterpret_cast<OwnedFactoryAndThreads*>(native_factory);
1421 1424
1422 rtc::scoped_refptr<webrtc::AndroidVideoTrackSource> source( 1425 rtc::scoped_refptr<webrtc::AndroidVideoTrackSource> source(
1423 new rtc::RefCountedObject<webrtc::AndroidVideoTrackSource>( 1426 new rtc::RefCountedObject<webrtc::AndroidVideoTrackSource>(
1424 factory->signaling_thread(), jni, j_egl_context, is_screencast)); 1427 factory->signaling_thread(), jni, j_egl_context, is_screencast));
1425 rtc::scoped_refptr<webrtc::VideoTrackSourceProxy> proxy_source = 1428 rtc::scoped_refptr<webrtc::VideoTrackSourceProxy> proxy_source =
1426 webrtc::VideoTrackSourceProxy::Create(factory->signaling_thread(), 1429 webrtc::VideoTrackSourceProxy::Create(factory->signaling_thread(),
1427 factory->worker_thread(), source); 1430 factory->worker_thread(), source);
1428 1431
1429 return (jlong)proxy_source.release(); 1432 return (jlong)proxy_source.release();
1430 } 1433 }
1431 1434
1432 JOW(void, PeerConnectionFactory_nativeInitializeVideoCapturer) 1435 JOW(void, PeerConnectionFactoryBase_nativeInitializeVideoCapturer)
1433 (JNIEnv* jni, 1436 (JNIEnv* jni,
1434 jclass, 1437 jclass,
1435 jlong native_factory, 1438 jlong native_factory,
1436 jobject j_video_capturer, 1439 jobject j_video_capturer,
1437 jlong native_source, 1440 jlong native_source,
1438 jobject j_frame_observer) { 1441 jobject j_frame_observer) {
1439 LOG(LS_INFO) << "PeerConnectionFactory_nativeInitializeVideoCapturer"; 1442 LOG(LS_INFO) << "PeerConnectionFactoryBase_nativeInitializeVideoCapturer";
1440 rtc::scoped_refptr<PeerConnectionFactoryInterface> factory( 1443 rtc::scoped_refptr<PeerConnectionFactoryInterface> factory(
1441 factoryFromJava(native_factory)); 1444 factoryFromJava(native_factory));
1442 auto proxy_source = 1445 auto proxy_source =
1443 reinterpret_cast<webrtc::VideoTrackSourceProxy*>(native_source); 1446 reinterpret_cast<webrtc::VideoTrackSourceProxy*>(native_source);
1444 auto source = reinterpret_cast<webrtc::AndroidVideoTrackSource*>( 1447 auto source = reinterpret_cast<webrtc::AndroidVideoTrackSource*>(
1445 proxy_source->internal()); 1448 proxy_source->internal());
1446 rtc::scoped_refptr<SurfaceTextureHelper> surface_texture_helper = 1449 rtc::scoped_refptr<SurfaceTextureHelper> surface_texture_helper =
1447 source->surface_texture_helper(); 1450 source->surface_texture_helper();
1448 jni->CallVoidMethod( 1451 jni->CallVoidMethod(
1449 j_video_capturer, 1452 j_video_capturer,
1450 GetMethodID(jni, FindClass(jni, "org/webrtc/VideoCapturer"), "initialize", 1453 GetMethodID(jni, FindClass(jni, "org/webrtc/VideoCapturer"), "initialize",
1451 "(Lorg/webrtc/SurfaceTextureHelper;Landroid/content/" 1454 "(Lorg/webrtc/SurfaceTextureHelper;Landroid/content/"
1452 "Context;Lorg/webrtc/VideoCapturer$CapturerObserver;)V"), 1455 "Context;Lorg/webrtc/VideoCapturer$CapturerObserver;)V"),
1453 surface_texture_helper 1456 surface_texture_helper
1454 ? surface_texture_helper->GetJavaSurfaceTextureHelper() 1457 ? surface_texture_helper->GetJavaSurfaceTextureHelper()
1455 : nullptr, 1458 : nullptr,
1456 j_application_context, j_frame_observer); 1459 j_application_context, j_frame_observer);
1457 CHECK_EXCEPTION(jni) << "error during VideoCapturer.initialize()"; 1460 CHECK_EXCEPTION(jni) << "error during VideoCapturer.initialize()";
1458 } 1461 }
1459 1462
1460 JOW(jlong, PeerConnectionFactory_nativeCreateVideoTrack)( 1463 JOW(jlong, PeerConnectionFactoryBase_nativeCreateVideoTrack)
1461 JNIEnv* jni, jclass, jlong native_factory, jstring id, 1464 (JNIEnv* jni, jclass, jlong native_factory, jstring id, jlong native_source) {
1462 jlong native_source) {
1463 rtc::scoped_refptr<PeerConnectionFactoryInterface> factory( 1465 rtc::scoped_refptr<PeerConnectionFactoryInterface> factory(
1464 factoryFromJava(native_factory)); 1466 factoryFromJava(native_factory));
1465 rtc::scoped_refptr<VideoTrackInterface> track(factory->CreateVideoTrack( 1467 rtc::scoped_refptr<VideoTrackInterface> track(factory->CreateVideoTrack(
1466 JavaToStdString(jni, id), 1468 JavaToStdString(jni, id),
1467 reinterpret_cast<VideoTrackSourceInterface*>(native_source))); 1469 reinterpret_cast<VideoTrackSourceInterface*>(native_source)));
1468 return (jlong)track.release(); 1470 return (jlong)track.release();
1469 } 1471 }
1470 1472
1471 JOW(jlong, PeerConnectionFactory_nativeCreateAudioSource)( 1473 JOW(jlong, PeerConnectionFactoryBase_nativeCreateAudioSource)
1472 JNIEnv* jni, jclass, jlong native_factory, jobject j_constraints) { 1474 (JNIEnv* jni, jclass, jlong native_factory, jobject j_constraints) {
1473 std::unique_ptr<ConstraintsWrapper> constraints( 1475 std::unique_ptr<ConstraintsWrapper> constraints(
1474 new ConstraintsWrapper(jni, j_constraints)); 1476 new ConstraintsWrapper(jni, j_constraints));
1475 rtc::scoped_refptr<PeerConnectionFactoryInterface> factory( 1477 rtc::scoped_refptr<PeerConnectionFactoryInterface> factory(
1476 factoryFromJava(native_factory)); 1478 factoryFromJava(native_factory));
1477 cricket::AudioOptions options; 1479 cricket::AudioOptions options;
1478 CopyConstraintsIntoAudioOptions(constraints.get(), &options); 1480 CopyConstraintsIntoAudioOptions(constraints.get(), &options);
1479 rtc::scoped_refptr<AudioSourceInterface> source( 1481 rtc::scoped_refptr<AudioSourceInterface> source(
1480 factory->CreateAudioSource(options)); 1482 factory->CreateAudioSource(options));
1481 return (jlong)source.release(); 1483 return (jlong)source.release();
1482 } 1484 }
1483 1485
1484 JOW(jlong, PeerConnectionFactory_nativeCreateAudioTrack)( 1486 JOW(jlong, PeerConnectionFactoryBase_nativeCreateAudioTrack)
1485 JNIEnv* jni, jclass, jlong native_factory, jstring id, 1487 (JNIEnv* jni, jclass, jlong native_factory, jstring id, jlong native_source) {
1486 jlong native_source) {
1487 rtc::scoped_refptr<PeerConnectionFactoryInterface> factory( 1488 rtc::scoped_refptr<PeerConnectionFactoryInterface> factory(
1488 factoryFromJava(native_factory)); 1489 factoryFromJava(native_factory));
1489 rtc::scoped_refptr<AudioTrackInterface> track(factory->CreateAudioTrack( 1490 rtc::scoped_refptr<AudioTrackInterface> track(factory->CreateAudioTrack(
1490 JavaToStdString(jni, id), 1491 JavaToStdString(jni, id),
1491 reinterpret_cast<AudioSourceInterface*>(native_source))); 1492 reinterpret_cast<AudioSourceInterface*>(native_source)));
1492 return (jlong)track.release(); 1493 return (jlong)track.release();
1493 } 1494 }
1494 1495
1495 JOW(jboolean, PeerConnectionFactory_nativeStartAecDump)( 1496 JOW(jboolean, PeerConnectionFactoryBase_nativeStartAecDump)
1496 JNIEnv* jni, jclass, jlong native_factory, jint file, 1497 (JNIEnv* jni,
1497 jint filesize_limit_bytes) { 1498 jclass,
1499 jlong native_factory,
1500 jint file,
1501 jint filesize_limit_bytes) {
1498 rtc::scoped_refptr<PeerConnectionFactoryInterface> factory( 1502 rtc::scoped_refptr<PeerConnectionFactoryInterface> factory(
1499 factoryFromJava(native_factory)); 1503 factoryFromJava(native_factory));
1500 return factory->StartAecDump(file, filesize_limit_bytes); 1504 return factory->StartAecDump(file, filesize_limit_bytes);
1501 } 1505 }
1502 1506
1503 JOW(void, PeerConnectionFactory_nativeStopAecDump)( 1507 JOW(void, PeerConnectionFactoryBase_nativeStopAecDump)
1504 JNIEnv* jni, jclass, jlong native_factory) { 1508 (JNIEnv* jni, jclass, jlong native_factory) {
1505 rtc::scoped_refptr<PeerConnectionFactoryInterface> factory( 1509 rtc::scoped_refptr<PeerConnectionFactoryInterface> factory(
1506 factoryFromJava(native_factory)); 1510 factoryFromJava(native_factory));
1507 factory->StopAecDump(); 1511 factory->StopAecDump();
1508 } 1512 }
1509 1513
1510 JOW(void, PeerConnectionFactory_nativeSetOptions)( 1514 JOW(void, PeerConnectionFactoryBase_nativeSetOptions)
1511 JNIEnv* jni, jclass, jlong native_factory, jobject options) { 1515 (JNIEnv* jni, jclass, jlong native_factory, jobject options) {
1512 rtc::scoped_refptr<PeerConnectionFactoryInterface> factory( 1516 rtc::scoped_refptr<PeerConnectionFactoryInterface> factory(
1513 factoryFromJava(native_factory)); 1517 factoryFromJava(native_factory));
1514 PeerConnectionFactoryInterface::Options options_to_set = 1518 PeerConnectionFactoryInterface::Options options_to_set =
1515 ParseOptionsFromJava(jni, options); 1519 ParseOptionsFromJava(jni, options);
1516 factory->SetOptions(options_to_set); 1520 factory->SetOptions(options_to_set);
1517 1521
1518 if (options_to_set.disable_network_monitor) { 1522 if (options_to_set.disable_network_monitor) {
1519 OwnedFactoryAndThreads* owner = 1523 OwnedFactoryAndThreads* owner =
1520 reinterpret_cast<OwnedFactoryAndThreads*>(native_factory); 1524 reinterpret_cast<OwnedFactoryAndThreads*>(native_factory);
1521 if (owner->network_monitor_factory()) { 1525 if (owner->network_monitor_factory()) {
1522 rtc::NetworkMonitorFactory::ReleaseFactory( 1526 rtc::NetworkMonitorFactory::ReleaseFactory(
1523 owner->network_monitor_factory()); 1527 owner->network_monitor_factory());
1524 owner->clear_network_monitor_factory(); 1528 owner->clear_network_monitor_factory();
1525 } 1529 }
1526 } 1530 }
1527 } 1531 }
1528 1532
1529 JOW(void, PeerConnectionFactory_nativeSetVideoHwAccelerationOptions)( 1533 JOW(void, PeerConnectionFactoryBase_nativeSetVideoHwAccelerationOptions)
1530 JNIEnv* jni, jclass, jlong native_factory, jobject local_egl_context, 1534 (JNIEnv* jni,
1531 jobject remote_egl_context) { 1535 jclass,
1536 jlong native_factory,
1537 jobject local_egl_context,
1538 jobject remote_egl_context) {
1532 OwnedFactoryAndThreads* owned_factory = 1539 OwnedFactoryAndThreads* owned_factory =
1533 reinterpret_cast<OwnedFactoryAndThreads*>(native_factory); 1540 reinterpret_cast<OwnedFactoryAndThreads*>(native_factory);
1534 1541
1535 jclass j_eglbase14_context_class = 1542 jclass j_eglbase14_context_class =
1536 FindClass(jni, "org/webrtc/EglBase14$Context"); 1543 FindClass(jni, "org/webrtc/EglBase14$Context");
1537 1544
1538 MediaCodecVideoEncoderFactory* encoder_factory = 1545 MediaCodecVideoEncoderFactory* encoder_factory =
1539 static_cast<MediaCodecVideoEncoderFactory*> 1546 static_cast<MediaCodecVideoEncoderFactory*>
1540 (owned_factory->encoder_factory()); 1547 (owned_factory->encoder_factory());
1541 if (encoder_factory && 1548 if (encoder_factory &&
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
1831 if (!IsNull(jni, j_ice_check_min_interval)) { 1838 if (!IsNull(jni, j_ice_check_min_interval)) {
1832 int ice_check_min_interval_value = 1839 int ice_check_min_interval_value =
1833 jni->CallIntMethod(j_ice_check_min_interval, int_value_id); 1840 jni->CallIntMethod(j_ice_check_min_interval, int_value_id);
1834 rtc_config->ice_check_min_interval = 1841 rtc_config->ice_check_min_interval =
1835 rtc::Optional<int>(ice_check_min_interval_value); 1842 rtc::Optional<int>(ice_check_min_interval_value);
1836 } 1843 }
1837 rtc_config->disable_ipv6_on_wifi = 1844 rtc_config->disable_ipv6_on_wifi =
1838 GetBooleanField(jni, j_rtc_config, j_disable_ipv6_on_wifi_id); 1845 GetBooleanField(jni, j_rtc_config, j_disable_ipv6_on_wifi_id);
1839 } 1846 }
1840 1847
1841 JOW(jlong, PeerConnectionFactory_nativeCreatePeerConnection)( 1848 JOW(jlong, PeerConnectionFactoryBase_nativeCreatePeerConnection)
1842 JNIEnv *jni, jclass, jlong factory, jobject j_rtc_config, 1849 (JNIEnv* jni,
1843 jobject j_constraints, jlong observer_p) { 1850 jclass,
1851 jlong factory,
1852 jobject j_rtc_config,
1853 jobject j_constraints,
1854 jlong observer_p) {
1844 rtc::scoped_refptr<PeerConnectionFactoryInterface> f( 1855 rtc::scoped_refptr<PeerConnectionFactoryInterface> f(
1845 reinterpret_cast<PeerConnectionFactoryInterface*>( 1856 reinterpret_cast<PeerConnectionFactoryInterface*>(
1846 factoryFromJava(factory))); 1857 factoryFromJava(factory)));
1847 1858
1848 PeerConnectionInterface::RTCConfiguration rtc_config( 1859 PeerConnectionInterface::RTCConfiguration rtc_config(
1849 PeerConnectionInterface::RTCConfigurationType::kAggressive); 1860 PeerConnectionInterface::RTCConfigurationType::kAggressive);
1850 JavaRTCConfigurationToJsepRTCConfiguration(jni, j_rtc_config, &rtc_config); 1861 JavaRTCConfigurationToJsepRTCConfiguration(jni, j_rtc_config, &rtc_config);
1851 1862
1852 jclass j_rtc_config_class = GetObjectClass(jni, j_rtc_config); 1863 jclass j_rtc_config_class = GetObjectClass(jni, j_rtc_config);
1853 jfieldID j_key_type_id = GetFieldID(jni, j_rtc_config_class, "keyType", 1864 jfieldID j_key_type_id = GetFieldID(jni, j_rtc_config_class, "keyType",
(...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after
2741 return reinterpret_cast<DtmfSenderInterface*>(j_dtmf_sender_pointer) 2752 return reinterpret_cast<DtmfSenderInterface*>(j_dtmf_sender_pointer)
2742 ->inter_tone_gap(); 2753 ->inter_tone_gap();
2743 } 2754 }
2744 2755
2745 JOW(void, DtmfSender_free) 2756 JOW(void, DtmfSender_free)
2746 (JNIEnv* jni, jclass, jlong j_dtmf_sender_pointer) { 2757 (JNIEnv* jni, jclass, jlong j_dtmf_sender_pointer) {
2747 reinterpret_cast<DtmfSenderInterface*>(j_dtmf_sender_pointer)->Release(); 2758 reinterpret_cast<DtmfSenderInterface*>(j_dtmf_sender_pointer)->Release();
2748 } 2759 }
2749 2760
2750 } // namespace webrtc_jni 2761 } // namespace webrtc_jni
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698