Chromium Code Reviews| 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 1335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1346 WebRtcVideoEncoderFactory* encoder_factory = nullptr; | 1346 WebRtcVideoEncoderFactory* encoder_factory = nullptr; |
| 1347 WebRtcVideoDecoderFactory* decoder_factory = nullptr; | 1347 WebRtcVideoDecoderFactory* decoder_factory = nullptr; |
| 1348 rtc::NetworkMonitorFactory* network_monitor_factory = nullptr; | 1348 rtc::NetworkMonitorFactory* network_monitor_factory = nullptr; |
| 1349 | 1349 |
| 1350 PeerConnectionFactoryInterface::Options options; | 1350 PeerConnectionFactoryInterface::Options options; |
| 1351 bool has_options = joptions != NULL; | 1351 bool has_options = joptions != NULL; |
| 1352 if (has_options) { | 1352 if (has_options) { |
| 1353 options = ParseOptionsFromJava(jni, joptions); | 1353 options = ParseOptionsFromJava(jni, joptions); |
| 1354 } | 1354 } |
| 1355 | 1355 |
| 1356 #ifdef HAVE_MEDIA | |
| 1356 if (video_hw_acceleration_enabled) { | 1357 if (video_hw_acceleration_enabled) { |
| 1357 encoder_factory = new MediaCodecVideoEncoderFactory(); | 1358 encoder_factory = new MediaCodecVideoEncoderFactory(); |
| 1358 decoder_factory = new MediaCodecVideoDecoderFactory(); | 1359 decoder_factory = new MediaCodecVideoDecoderFactory(); |
| 1359 } | 1360 } |
| 1361 #endif | |
| 1360 // Do not create network_monitor_factory only if the options are | 1362 // Do not create network_monitor_factory only if the options are |
| 1361 // provided and disable_network_monitor therein is set to true. | 1363 // provided and disable_network_monitor therein is set to true. |
| 1362 if (!(has_options && options.disable_network_monitor)) { | 1364 if (!(has_options && options.disable_network_monitor)) { |
| 1363 network_monitor_factory = new AndroidNetworkMonitorFactory(); | 1365 network_monitor_factory = new AndroidNetworkMonitorFactory(); |
| 1364 rtc::NetworkMonitorFactory::SetFactory(network_monitor_factory); | 1366 rtc::NetworkMonitorFactory::SetFactory(network_monitor_factory); |
| 1365 } | 1367 } |
| 1366 | 1368 |
| 1367 rtc::scoped_refptr<PeerConnectionFactoryInterface> factory( | 1369 rtc::scoped_refptr<PeerConnectionFactoryInterface> factory( |
| 1368 webrtc::CreatePeerConnectionFactory( | 1370 webrtc::CreatePeerConnectionFactory( |
| 1369 network_thread.get(), worker_thread.get(), signaling_thread.get(), | 1371 network_thread.get(), worker_thread.get(), signaling_thread.get(), |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1534 | 1536 |
| 1535 jclass j_eglbase14_context_class = | 1537 jclass j_eglbase14_context_class = |
| 1536 FindClass(jni, "org/webrtc/EglBase14$Context"); | 1538 FindClass(jni, "org/webrtc/EglBase14$Context"); |
| 1537 | 1539 |
| 1538 MediaCodecVideoEncoderFactory* encoder_factory = | 1540 MediaCodecVideoEncoderFactory* encoder_factory = |
| 1539 static_cast<MediaCodecVideoEncoderFactory*> | 1541 static_cast<MediaCodecVideoEncoderFactory*> |
| 1540 (owned_factory->encoder_factory()); | 1542 (owned_factory->encoder_factory()); |
| 1541 if (encoder_factory && | 1543 if (encoder_factory && |
| 1542 jni->IsInstanceOf(local_egl_context, j_eglbase14_context_class)) { | 1544 jni->IsInstanceOf(local_egl_context, j_eglbase14_context_class)) { |
| 1543 LOG(LS_INFO) << "Set EGL context for HW encoding."; | 1545 LOG(LS_INFO) << "Set EGL context for HW encoding."; |
| 1546 #ifdef HAVE_MEDIA | |
| 1544 encoder_factory->SetEGLContext(jni, local_egl_context); | 1547 encoder_factory->SetEGLContext(jni, local_egl_context); |
| 1548 #endif | |
|
pthatcher1
2017/05/03 18:05:53
Won't the encoder and decoder factories by null so
Zhi Huang
2017/05/04 01:08:03
The idea here is trying to avoid linking the metho
| |
| 1545 } | 1549 } |
| 1546 | 1550 |
| 1547 MediaCodecVideoDecoderFactory* decoder_factory = | 1551 MediaCodecVideoDecoderFactory* decoder_factory = |
| 1548 static_cast<MediaCodecVideoDecoderFactory*> | 1552 static_cast<MediaCodecVideoDecoderFactory*> |
| 1549 (owned_factory->decoder_factory()); | 1553 (owned_factory->decoder_factory()); |
| 1550 if (decoder_factory) { | 1554 if (decoder_factory) { |
| 1551 LOG(LS_INFO) << "Set EGL context for HW decoding."; | 1555 LOG(LS_INFO) << "Set EGL context for HW decoding."; |
| 1556 #ifdef HAVE_MEDIA | |
| 1552 decoder_factory->SetEGLContext(jni, remote_egl_context); | 1557 decoder_factory->SetEGLContext(jni, remote_egl_context); |
| 1558 #endif | |
| 1553 } | 1559 } |
| 1554 } | 1560 } |
| 1555 | 1561 |
| 1556 static PeerConnectionInterface::IceTransportsType | 1562 static PeerConnectionInterface::IceTransportsType |
| 1557 JavaIceTransportsTypeToNativeType(JNIEnv* jni, jobject j_ice_transports_type) { | 1563 JavaIceTransportsTypeToNativeType(JNIEnv* jni, jobject j_ice_transports_type) { |
| 1558 std::string enum_name = GetJavaEnumName( | 1564 std::string enum_name = GetJavaEnumName( |
| 1559 jni, "org/webrtc/PeerConnection$IceTransportsType", | 1565 jni, "org/webrtc/PeerConnection$IceTransportsType", |
| 1560 j_ice_transports_type); | 1566 j_ice_transports_type); |
| 1561 | 1567 |
| 1562 if (enum_name == "ALL") | 1568 if (enum_name == "ALL") |
| (...skipping 1178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2741 return reinterpret_cast<DtmfSenderInterface*>(j_dtmf_sender_pointer) | 2747 return reinterpret_cast<DtmfSenderInterface*>(j_dtmf_sender_pointer) |
| 2742 ->inter_tone_gap(); | 2748 ->inter_tone_gap(); |
| 2743 } | 2749 } |
| 2744 | 2750 |
| 2745 JOW(void, DtmfSender_free) | 2751 JOW(void, DtmfSender_free) |
| 2746 (JNIEnv* jni, jclass, jlong j_dtmf_sender_pointer) { | 2752 (JNIEnv* jni, jclass, jlong j_dtmf_sender_pointer) { |
| 2747 reinterpret_cast<DtmfSenderInterface*>(j_dtmf_sender_pointer)->Release(); | 2753 reinterpret_cast<DtmfSenderInterface*>(j_dtmf_sender_pointer)->Release(); |
| 2748 } | 2754 } |
| 2749 | 2755 |
| 2750 } // namespace webrtc_jni | 2756 } // namespace webrtc_jni |
| OLD | NEW |