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

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

Issue 1309543004: Create a new preference which disables UDP protocol for WebRTC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/public/common/renderer_preferences.cc ('k') | content/renderer/p2p/port_allocator.h » ('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 81d34b9161bd0af27e0c52143fa5bd272b3ae795..9974e767271bf8aac3d5088108e06e49de591851 100644
--- a/content/renderer/media/webrtc/peer_connection_dependency_factory.cc
+++ b/content/renderer/media/webrtc/peer_connection_dependency_factory.cc
@@ -112,17 +112,17 @@ class P2PPortAllocatorFactory : public webrtc::PortAllocatorFactoryInterface {
rtc::NetworkManager* network_manager,
rtc::PacketSocketFactory* socket_factory,
const GURL& origin,
- bool enable_multiple_routes)
+ const P2PPortAllocator::Config& config)
: socket_dispatcher_(socket_dispatcher),
network_manager_(network_manager),
socket_factory_(socket_factory),
origin_(origin),
- enable_multiple_routes_(enable_multiple_routes) {}
+ config_(config) {}
cricket::PortAllocator* CreatePortAllocator(
const std::vector<StunConfiguration>& stun_servers,
const std::vector<TurnConfiguration>& turn_configurations) override {
- P2PPortAllocator::Config config;
+ P2PPortAllocator::Config config = config_;
for (size_t i = 0; i < stun_servers.size(); ++i) {
config.stun_servers.insert(rtc::SocketAddress(
stun_servers[i].server.hostname(),
@@ -138,7 +138,6 @@ class P2PPortAllocatorFactory : public webrtc::PortAllocatorFactoryInterface {
relay_config.secure = turn_configurations[i].secure;
config.relays.push_back(relay_config);
}
- config.enable_multiple_routes = enable_multiple_routes_;
return new P2PPortAllocator(
socket_dispatcher_.get(), network_manager_,
@@ -157,9 +156,11 @@ class P2PPortAllocatorFactory : public webrtc::PortAllocatorFactoryInterface {
// The origin URL of the WebFrame that created the
// P2PPortAllocatorFactory.
GURL origin_;
- // When false, only 'any' address (all 0s) will be bound for address
- // discovery.
- bool enable_multiple_routes_;
+
+ // Keep track of configuration common to all PortAllocators created by this
+ // factory; additional, per-allocator configuration is passed into
+ // CreatePortAllocator.
+ P2PPortAllocator::Config config_;
};
PeerConnectionDependencyFactory::PeerConnectionDependencyFactory(
@@ -396,27 +397,30 @@ PeerConnectionDependencyFactory::CreatePeerConnection(
if (!GetPcFactory().get())
return NULL;
- // Copy the flag from Preference associated with this WebFrame.
- bool enable_multiple_routes = true;
rtc::scoped_ptr<PeerConnectionIdentityStore> identity_store(
new PeerConnectionIdentityStore(
GURL(web_frame->document().url()),
GURL(web_frame->document().firstPartyForCookies())));
+ // Copy the flag from Preference associated with this WebFrame.
+ P2PPortAllocator::Config pref_config;
if (web_frame && web_frame->view()) {
RenderViewImpl* renderer_view_impl =
RenderViewImpl::FromWebView(web_frame->view());
if (renderer_view_impl) {
- enable_multiple_routes = renderer_view_impl->renderer_preferences()
- .enable_webrtc_multiple_routes;
+ pref_config.enable_multiple_routes =
+ renderer_view_impl->renderer_preferences()
+ .enable_webrtc_multiple_routes;
+ pref_config.enable_nonproxied_udp_transport =
+ renderer_view_impl->renderer_preferences()
+ .enable_webrtc_nonproxied_udp_transport;
}
}
scoped_refptr<P2PPortAllocatorFactory> pa_factory =
new rtc::RefCountedObject<P2PPortAllocatorFactory>(
p2p_socket_dispatcher_.get(), network_manager_, socket_factory_.get(),
- GURL(web_frame->document().url().spec()).GetOrigin(),
- enable_multiple_routes);
+ GURL(web_frame->document().url().spec()).GetOrigin(), pref_config);
return GetPcFactory()->CreatePeerConnection(config,
constraints,
« no previous file with comments | « content/public/common/renderer_preferences.cc ('k') | content/renderer/p2p/port_allocator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698