| 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..92f2bafe73031989e0bd1122d5f2e20618ab36fe 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,38 @@ void P2PSocketDispatcherHost::OnIPAddressChanged() {
|
| &P2PSocketDispatcherHost::DoGetNetworkList, this));
|
| }
|
|
|
| +void P2PSocketDispatcherHost::StartRtpDump(
|
| + bool incoming,
|
| + bool outgoing,
|
| + const RenderProcessHost::WebRtcRtpPacketCallback& packet_callback) {
|
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
| +
|
| + if ((!dump_incoming_rtp_packet_ && incoming) ||
|
| + (!dump_outgoing_rtp_packet_ && outgoing)) {
|
| + if (incoming)
|
| + dump_incoming_rtp_packet_ = true;
|
| +
|
| + if (outgoing)
|
| + dump_outgoing_rtp_packet_ = true;
|
| +
|
| + packet_callback_ = packet_callback;
|
| + for (SocketsMap::iterator it = sockets_.begin(); it != sockets_.end(); ++it)
|
| + it->second->StartRtpDump(incoming, outgoing, packet_callback);
|
| + }
|
| +}
|
| +
|
| +void P2PSocketDispatcherHost::StopRtpDumpOnUIThread(bool incoming,
|
| + bool outgoing) {
|
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| + BrowserThread::PostTask(
|
| + BrowserThread::IO,
|
| + FROM_HERE,
|
| + base::Bind(&P2PSocketDispatcherHost::StopRtpDumpOnIOThread,
|
| + this,
|
| + incoming,
|
| + outgoing));
|
| +}
|
| +
|
| P2PSocketDispatcherHost::~P2PSocketDispatcherHost() {
|
| DCHECK(sockets_.empty());
|
| DCHECK(dns_requests_.empty());
|
| @@ -210,6 +244,12 @@ 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_,
|
| + packet_callback_);
|
| + }
|
| }
|
| }
|
|
|
| @@ -297,4 +337,22 @@ void P2PSocketDispatcherHost::OnAddressResolved(
|
| delete request;
|
| }
|
|
|
| +void P2PSocketDispatcherHost::StopRtpDumpOnIOThread(bool incoming,
|
| + bool outgoing) {
|
| + if ((dump_incoming_rtp_packet_ && incoming) ||
|
| + (dump_outgoing_rtp_packet_ && outgoing)) {
|
| + if (incoming)
|
| + dump_incoming_rtp_packet_ = false;
|
| +
|
| + if (outgoing)
|
| + dump_outgoing_rtp_packet_ = false;
|
| +
|
| + 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(incoming, outgoing);
|
| + }
|
| +}
|
| +
|
| } // namespace content
|
|
|