Chromium Code Reviews| Index: chrome/renderer/media/cast_udp_transport.cc |
| diff --git a/chrome/renderer/media/cast_udp_transport.cc b/chrome/renderer/media/cast_udp_transport.cc |
| index de8148eac72cc9fe1b23f3ffe62122670b59a8a0..32ac46e854267d23578c05a3b129ea4ccda381a9 100644 |
| --- a/chrome/renderer/media/cast_udp_transport.cc |
| +++ b/chrome/renderer/media/cast_udp_transport.cc |
| @@ -6,6 +6,22 @@ |
| #include "base/logging.h" |
| #include "chrome/renderer/media/cast_session.h" |
| +#include "content/public/renderer/p2p_socket_client.h" |
| +#include "net/base/host_port_pair.h" |
| +#include "net/base/net_util.h" |
| + |
| +class CastUDPSocketFactory : public CastSession::SocketFactory { |
|
Alpha Left Google
2013/11/09 00:30:18
nit: CastUdpSocketFactory to be consistent with Ca
hubbe
2013/11/26 20:24:29
Done.
|
| + public: |
| + virtual content::P2PSocketClient* create() OVERRIDE { |
| + content::P2PSocketClient *socket = content::CreateP2PSocket(); |
|
Alpha Left Google
2013/11/09 00:30:18
This should be scoped_ptr<content::P2PSocketClient
hubbe
2013/11/26 20:24:29
scoped_refptr actually
|
| + net::IPEndPoint unspecified_end_point; |
| + socket->Init(content::P2P_SOCKET_UDP, |
| + unspecified_end_point, |
| + unspecified_end_point, |
| + NULL); |
| + return socket; |
|
Alpha Left Google
2013/11/09 00:30:18
return socket.Pass() if socket is a scoped_ptr.
hubbe
2013/11/26 20:24:29
using scoped_refptr, no need for Pass
|
| + } |
| +}; |
| CastUdpTransport::CastUdpTransport() |
| : cast_session_(new CastSession()) { |
| @@ -15,7 +31,15 @@ CastUdpTransport::~CastUdpTransport() { |
| } |
| void CastUdpTransport::Start(const net::HostPortPair& remote_address) { |
|
Alpha Left Google
2013/11/09 00:30:18
Might as well just change the type to net::IPAddre
hubbe
2013/11/26 20:24:29
Done.
|
| - NOTIMPLEMENTED(); |
| + net::IPAddressNumber ip; |
| + if (!net::ParseIPLiteralToNumber(remote_address.host(), &ip)) { |
| + // TODO(Hubbe): Report back to caller |
| + return; |
| + } |
| + net::IPEndPoint endpoint(ip, remote_address.port()); |
| + cast_session_->SetSocketFactory( |
| + new CastUDPSocketFactory(), |
| + endpoint); |
| } |
| void CastUdpTransport::Stop() { |