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

Unified Diff: content/renderer/media/webrtc/peer_connection_dependency_factory.cc

Issue 1413393003: Change WebRTC IP handling policy from multiple booleans to an enum. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update GYP file with right order. Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/public/common/webrtc_ip_handling_policy.cc ('k') | content/shell/browser/shell.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/webrtc/peer_connection_dependency_factory.cc
diff --git a/content/renderer/media/webrtc/peer_connection_dependency_factory.cc b/content/renderer/media/webrtc/peer_connection_dependency_factory.cc
index 34a949b750d9181e6f154e2032cf1fef8db721cb..72a72a0609850ea31bb5a22f917728a56ae5ba89 100644
--- a/content/renderer/media/webrtc/peer_connection_dependency_factory.cc
+++ b/content/renderer/media/webrtc/peer_connection_dependency_factory.cc
@@ -17,6 +17,7 @@
#include "content/public/common/content_client.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/renderer_preferences.h"
+#include "content/public/common/webrtc_ip_handling_policy.h"
#include "content/public/renderer/content_renderer_client.h"
#include "content/renderer/media/media_stream.h"
#include "content/renderer/media/media_stream_audio_processor.h"
@@ -64,6 +65,28 @@
namespace content {
+namespace {
+
+enum WebRTCIPHandlingPolicy {
+ DEFAULT,
+ DEFAULT_PUBLIC_AND_PRIVATE_INTERFACES,
+ DEFAULT_PUBLIC_INTERFACE_ONLY,
+ DISABLE_NON_PROXIED_UDP,
+};
+
+WebRTCIPHandlingPolicy GetWebRTCIPHandlingPolicy(
+ const std::string& preference) {
+ if (preference == kWebRTCIPHandlingDefaultPublicAndPrivateInterfaces)
+ return DEFAULT_PUBLIC_AND_PRIVATE_INTERFACES;
+ if (preference == kWebRTCIPHandlingDefaultPublicInterfaceOnly)
+ return DEFAULT_PUBLIC_INTERFACE_ONLY;
+ if (preference == kWebRTCIPHandlingDisableNonProxiedUdp)
+ return DISABLE_NON_PROXIED_UDP;
+ return DEFAULT;
+}
+
+} // namespace
+
// Map of corresponding media constraints and platform effects.
struct {
const char* constraint;
@@ -455,14 +478,32 @@ PeerConnectionDependencyFactory::CreatePeerConnection(
// |request_multiple_routes|. Whether local IP addresses could be
// collected depends on if mic/camera permission is granted for this
// origin.
- port_config.enable_multiple_routes =
- renderer_view_impl->renderer_preferences()
- .enable_webrtc_multiple_routes;
- port_config.enable_nonproxied_udp =
- renderer_view_impl->renderer_preferences()
- .enable_webrtc_nonproxied_udp;
- VLOG(3) << "WebRTC routing preferences: multiple_routes: "
- << port_config.enable_multiple_routes
+ std::string mode = renderer_view_impl->renderer_preferences()
+ .webrtc_ip_handling_policy;
+ switch (GetWebRTCIPHandlingPolicy(mode)) {
+ // 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;
+ break;
+ case DISABLE_NON_PROXIED_UDP:
+ port_config.enable_multiple_routes = false;
+ port_config.enable_nonproxied_udp = false;
+ break;
+ case DEFAULT:
+ port_config.enable_multiple_routes = true;
+ port_config.enable_nonproxied_udp = true;
+ break;
+ default:
+ NOTREACHED();
+ break;
+ }
+
+ VLOG(3) << "WebRTC routing preferences: "
+ << "policy: " << mode
+ << ", multiple_routes: " << port_config.enable_multiple_routes
<< ", nonproxied_udp: " << port_config.enable_nonproxied_udp;
}
}
« no previous file with comments | « content/public/common/webrtc_ip_handling_policy.cc ('k') | content/shell/browser/shell.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698