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..53ea1911939b40ba85caff9cf574033edd0bc869 100644 |
--- a/content/browser/renderer_host/p2p/socket_dispatcher_host.cc |
+++ b/content/browser/renderer_host/p2p/socket_dispatcher_host.cc |
@@ -99,7 +99,9 @@ P2PSocketDispatcherHost::P2PSocketDispatcherHost( |
: BrowserMessageFilter(P2PMsgStart), |
resource_context_(resource_context), |
url_context_(url_context), |
- monitoring_networks_(false) { |
+ monitoring_networks_(false), |
+ dump_incoming_rtp_packet_(false), |
+ dump_outgoing_rtp_packet_(false) { |
} |
void P2PSocketDispatcherHost::OnChannelClosing() { |
@@ -147,6 +149,40 @@ void P2PSocketDispatcherHost::OnIPAddressChanged() { |
&P2PSocketDispatcherHost::DoGetNetworkList, this)); |
} |
+void P2PSocketDispatcherHost::StartRtpDump( |
+ RtpDumpType type, |
+ const RenderProcessHost::WebRtcRtpPacketCallback& packet_callback) { |
+ bool incoming = (type == RTP_DUMP_INCOMING || type == RTP_DUMP_BOTH); |
+ bool outgoing = (type == RTP_DUMP_OUTGOING || type == RTP_DUMP_BOTH); |
+ |
+ if (dump_incoming_rtp_packet_ != incoming || |
+ dump_outgoing_rtp_packet_ != outgoing) { |
+ dump_incoming_rtp_packet_ = incoming; |
+ dump_outgoing_rtp_packet_ = outgoing; |
+ |
+ packet_callback_ = packet_callback; |
+ for (SocketsMap::iterator it = sockets_.begin(); it != sockets_.end(); ++it) |
+ it->second->StartRtpDump(type, packet_callback); |
+ } |
+} |
+ |
+void P2PSocketDispatcherHost::StopRtpDump(RtpDumpType type) { |
+ bool incoming = (type == RTP_DUMP_INCOMING || type == RTP_DUMP_BOTH); |
+ bool outgoing = (type == RTP_DUMP_OUTGOING || type == RTP_DUMP_BOTH); |
+ |
+ if (dump_incoming_rtp_packet_ == incoming || |
+ dump_outgoing_rtp_packet_ == outgoing) { |
+ dump_incoming_rtp_packet_ = !incoming; |
+ dump_outgoing_rtp_packet_ = !outgoing; |
+ |
+ if (!dump_incoming_rtp_packet_ && !dump_outgoing_rtp_packet_) |
+ packet_callback_.Reset(); |
+ |
+ for (SocketsMap::iterator it = sockets_.begin(); it != sockets_.end(); ++it) |
+ it->second->StopRtpDump(type); |
+ } |
+} |
+ |
P2PSocketDispatcherHost::~P2PSocketDispatcherHost() { |
DCHECK(sockets_.empty()); |
DCHECK(dns_requests_.empty()); |
@@ -210,6 +246,16 @@ void P2PSocketDispatcherHost::OnCreateSocket( |
if (socket->Init(local_address, remote_address)) { |
sockets_[socket_id] = socket.release(); |
+ |
+ if (dump_incoming_rtp_packet_ || dump_outgoing_rtp_packet_) { |
+ RtpDumpType type = |
+ (dump_incoming_rtp_packet_ && dump_outgoing_rtp_packet_) |
+ ? RTP_DUMP_BOTH |
+ : (dump_incoming_rtp_packet_ ? RTP_DUMP_INCOMING |
+ : RTP_DUMP_OUTGOING); |
+ |
+ sockets_[socket_id]->StartRtpDump(type, packet_callback_); |
+ } |
} |
} |