Index: content/browser/renderer_host/p2p/socket_dispatcher_host.cc |
diff --git a/content/browser/renderer_host/p2p/socket_dispatcher_host.cc b/content/browser/renderer_host/p2p/socket_dispatcher_host.cc |
index be63c0217bb4cd277713dac1d04d688d5404be26..9d7f61aa50127edd5cef0fa15f4663b64be0a069 100644 |
--- a/content/browser/renderer_host/p2p/socket_dispatcher_host.cc |
+++ b/content/browser/renderer_host/p2p/socket_dispatcher_host.cc |
@@ -95,11 +95,15 @@ class P2PSocketDispatcherHost::DnsRequest { |
P2PSocketDispatcherHost::P2PSocketDispatcherHost( |
content::ResourceContext* resource_context, |
- net::URLRequestContextGetter* url_context) |
+ net::URLRequestContextGetter* url_context, |
+ int render_process_host_id) |
: BrowserMessageFilter(P2PMsgStart), |
resource_context_(resource_context), |
url_context_(url_context), |
- monitoring_networks_(false) { |
+ render_process_host_id_(render_process_host_id), |
+ monitoring_networks_(false), |
+ dump_incoming_rtp_packet_(false), |
+ dump_outgoing_rtp_packet_(false) { |
} |
void P2PSocketDispatcherHost::OnChannelClosing() { |
@@ -147,6 +151,28 @@ void P2PSocketDispatcherHost::OnIPAddressChanged() { |
&P2PSocketDispatcherHost::DoGetNetworkList, this)); |
} |
+void P2PSocketDispatcherHost::StartRtpDump(bool incoming, bool outgoing) { |
+ if (dump_incoming_rtp_packet_ != incoming || |
Mallinath (Gone from Chromium)
2014/05/14 00:57:01
Do we really need if condition here? Let socket de
jiayl
2014/05/14 15:54:51
The check is to avoid unnecessary work if no chang
|
+ dump_outgoing_rtp_packet_ != outgoing) { |
+ dump_incoming_rtp_packet_ = incoming; |
+ dump_outgoing_rtp_packet_ = outgoing; |
+ |
+ for (SocketsMap::iterator it = sockets_.begin(); it != sockets_.end(); ++it) |
+ it->second->StartRtpDump(incoming, outgoing); |
+ } |
+} |
+ |
+void P2PSocketDispatcherHost::StopRtpDump(bool incoming, bool outgoing) { |
+ if (dump_incoming_rtp_packet_ == incoming || |
Mallinath (Gone from Chromium)
2014/05/14 00:57:01
same as above.
|
+ dump_outgoing_rtp_packet_ == outgoing) { |
+ dump_incoming_rtp_packet_ = !incoming; |
+ dump_outgoing_rtp_packet_ = !outgoing; |
+ |
+ for (SocketsMap::iterator it = sockets_.begin(); it != sockets_.end(); ++it) |
+ it->second->StopRtpDump(incoming, outgoing); |
+ } |
+} |
+ |
P2PSocketDispatcherHost::~P2PSocketDispatcherHost() { |
DCHECK(sockets_.empty()); |
DCHECK(dns_requests_.empty()); |
@@ -200,8 +226,13 @@ void P2PSocketDispatcherHost::OnCreateSocket( |
return; |
} |
- scoped_ptr<P2PSocketHost> socket(P2PSocketHost::Create( |
- this, socket_id, type, url_context_.get(), &throttler_)); |
+ scoped_ptr<P2PSocketHost> socket( |
+ P2PSocketHost::Create(this, |
+ socket_id, |
+ render_process_host_id_, |
+ type, |
+ url_context_.get(), |
+ &throttler_)); |
if (!socket) { |
Send(new P2PMsg_OnError(socket_id)); |
@@ -210,6 +241,11 @@ void P2PSocketDispatcherHost::OnCreateSocket( |
if (socket->Init(local_address, remote_address)) { |
sockets_[socket_id] = socket.release(); |
+ |
+ if (dump_incoming_rtp_packet_ || dump_outgoing_rtp_packet_) { |
+ sockets_[socket_id]->StartRtpDump(dump_incoming_rtp_packet_, |
+ dump_outgoing_rtp_packet_); |
+ } |
} |
} |