diff options
-rw-r--r-- | content/renderer/media/webrtc/peer_connection_dependency_factory.cc | 14 | ||||
-rw-r--r-- | content/renderer/p2p/port_allocator.cc | 2 | ||||
-rw-r--r-- | content/renderer/p2p/port_allocator.h | 11 |
3 files changed, 19 insertions, 8 deletions
diff --git a/content/renderer/media/webrtc/peer_connection_dependency_factory.cc b/content/renderer/media/webrtc/peer_connection_dependency_factory.cc index 82a5d52..03abc35 100644 --- a/content/renderer/media/webrtc/peer_connection_dependency_factory.cc +++ b/content/renderer/media/webrtc/peer_connection_dependency_factory.cc @@ -479,15 +479,18 @@ PeerConnectionDependencyFactory::CreatePeerConnection( // |request_multiple_routes|. Whether local IP addresses could be // collected depends on if mic/camera permission is granted for this // origin. - std::string mode = renderer_view_impl->renderer_preferences() - .webrtc_ip_handling_policy; - switch (GetWebRTCIPHandlingPolicy(mode)) { + WebRTCIPHandlingPolicy policy = + GetWebRTCIPHandlingPolicy(renderer_view_impl->renderer_preferences() + .webrtc_ip_handling_policy); + switch (policy) { // TODO(guoweis): specify the flag of disabling local candidate // collection when webrtc is updated. case DEFAULT_PUBLIC_INTERFACE_ONLY: case DEFAULT_PUBLIC_AND_PRIVATE_INTERFACES: port_config.enable_multiple_routes = false; port_config.enable_nonproxied_udp = true; + port_config.enable_default_local_candidate = + (policy == DEFAULT_PUBLIC_AND_PRIVATE_INTERFACES); break; case DISABLE_NON_PROXIED_UDP: port_config.enable_multiple_routes = false; @@ -497,13 +500,10 @@ PeerConnectionDependencyFactory::CreatePeerConnection( port_config.enable_multiple_routes = true; port_config.enable_nonproxied_udp = true; break; - default: - NOTREACHED(); - break; } VLOG(3) << "WebRTC routing preferences: " - << "policy: " << mode + << "policy: " << policy << ", multiple_routes: " << port_config.enable_multiple_routes << ", nonproxied_udp: " << port_config.enable_nonproxied_udp; } diff --git a/content/renderer/p2p/port_allocator.cc b/content/renderer/p2p/port_allocator.cc index 56876ba..681e5cb 100644 --- a/content/renderer/p2p/port_allocator.cc +++ b/content/renderer/p2p/port_allocator.cc @@ -39,6 +39,8 @@ P2PPortAllocator::P2PPortAllocator( uint32 flags = 0; if (!config_.enable_multiple_routes) flags |= cricket::PORTALLOCATOR_DISABLE_ADAPTER_ENUMERATION; + if (!config_.enable_default_local_candidate) + flags |= cricket::PORTALLOCATOR_DISABLE_DEFAULT_LOCAL_CANDIDATE; if (!config_.enable_nonproxied_udp) { flags |= cricket::PORTALLOCATOR_DISABLE_UDP | cricket::PORTALLOCATOR_DISABLE_STUN | diff --git a/content/renderer/p2p/port_allocator.h b/content/renderer/p2p/port_allocator.h index 28502f0..28ebf94 100644 --- a/content/renderer/p2p/port_allocator.h +++ b/content/renderer/p2p/port_allocator.h @@ -42,8 +42,17 @@ class P2PPortAllocator : public cricket::BasicPortAllocator { // RETURN is available in the future. bool enable_nonproxied_udp = true; - // Disable binding to individual NICs when set to false. + // Request binding to individual NICs. Whether multiple routes is allowed is + // subject to the permission check on mic/camera. When specified as false or + // the permission request is denied, it still uses the default local address + // to generate a single local candidate. TODO(guoweis): Rename this to + // |request_multiple_routes|. bool enable_multiple_routes = true; + + // Enable exposing the default local address when set to true. This is + // only in effect when the |enable_multiple_routes| is false or the + // permission check of mic/camera is denied. + bool enable_default_local_candidate = true; }; P2PPortAllocator( |