Index: content/browser/renderer_host/p2p/socket_host.h |
diff --git a/content/browser/renderer_host/p2p/socket_host.h b/content/browser/renderer_host/p2p/socket_host.h |
index a4c82f3ecf79de557a9466361bb24276189362d5..bfcbbd229f1b0cff0f1810e15501554899956ff0 100644 |
--- a/content/browser/renderer_host/p2p/socket_host.h |
+++ b/content/browser/renderer_host/p2p/socket_host.h |
@@ -5,8 +5,10 @@ |
#ifndef CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_H_ |
#define CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_H_ |
+#include "base/memory/weak_ptr.h" |
#include "content/common/content_export.h" |
#include "content/common/p2p_socket_type.h" |
+#include "content/public/browser/render_process_host.h" |
#include "net/base/ip_endpoint.h" |
#include "net/udp/datagram_socket.h" |
@@ -37,7 +39,8 @@ CONTENT_EXPORT bool ApplyPacketOptions(char* data, int length, |
// Helper method which finds RTP ofset and length if the packet is encapsulated |
// in a TURN Channel Message or TURN Send Indication message. |
-CONTENT_EXPORT bool GetRtpPacketStartPositionAndLength(char* data, int length, |
+CONTENT_EXPORT bool GetRtpPacketStartPositionAndLength(const char* data, |
+ int length, |
int* rtp_start_pos, |
int* rtp_packet_length); |
// Helper method which updates absoulute send time extension if present. |
@@ -53,7 +56,8 @@ class CONTENT_EXPORT P2PSocketHost { |
static const int kStunHeaderSize = 20; |
// Creates P2PSocketHost of the specific type. |
static P2PSocketHost* Create(IPC::Sender* message_sender, |
- int id, P2PSocketType type, |
+ int socket_id, |
+ P2PSocketType type, |
net::URLRequestContextGetter* url_context, |
P2PMessageThrottler* throttler); |
@@ -74,6 +78,12 @@ class CONTENT_EXPORT P2PSocketHost { |
virtual bool SetOption(P2PSocketOption option, int value) = 0; |
+ void StartRtpDump( |
+ bool incoming, |
+ bool outgoing, |
+ const RenderProcessHost::WebRtcRtpPacketCallback& packet_callback); |
+ void StopRtpDump(bool incoming, bool outgoing); |
+ |
protected: |
friend class P2PSocketHostTcpTestBase; |
@@ -111,7 +121,7 @@ class CONTENT_EXPORT P2PSocketHost { |
STATE_ERROR, |
}; |
- P2PSocketHost(IPC::Sender* message_sender, int id); |
+ P2PSocketHost(IPC::Sender* message_sender, int socket_id); |
// Verifies that the packet |data| has a valid STUN header. In case |
// of success stores type of the message in |type|. |
@@ -119,9 +129,23 @@ class CONTENT_EXPORT P2PSocketHost { |
StunMessageType* type); |
static bool IsRequestOrResponse(StunMessageType type); |
+ // Calls |packet_dump_callback_| to record the RTP header. |
+ void DumpRtpPacket(const char* packet, size_t length, bool incoming); |
+ |
+ // A helper to dump the packet on the IO thread. |
+ void DumpRtpPacketOnIOThread(scoped_ptr<uint8[]> packet_header, |
+ size_t header_length, |
+ size_t packet_length, |
+ bool incoming); |
+ |
IPC::Sender* message_sender_; |
int id_; |
State state_; |
+ bool dump_incoming_rtp_packet_; |
+ bool dump_outgoing_rtp_packet_; |
+ RenderProcessHost::WebRtcRtpPacketCallback packet_dump_callback_; |
+ |
+ base::WeakPtrFactory<P2PSocketHost> weak_ptr_factory_; |
DISALLOW_COPY_AND_ASSIGN(P2PSocketHost); |
}; |