OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/renderer/media/cast_udp_transport.h" | 5 #include "chrome/renderer/media/cast_udp_transport.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "chrome/renderer/media/cast_session.h" | 8 #include "chrome/renderer/media/cast_session.h" |
| 9 #include "content/public/renderer/p2p_socket_client.h" |
| 10 #include "net/base/host_port_pair.h" |
| 11 #include "net/base/net_util.h" |
| 12 |
| 13 class CastUdpSocketFactory : public CastSession::SocketFactory { |
| 14 public: |
| 15 virtual scoped_refptr<content::P2PSocketClient> create() OVERRIDE { |
| 16 net::IPEndPoint unspecified_end_point; |
| 17 scoped_refptr<content::P2PSocketClient> socket = |
| 18 content::P2PSocketClient::Create( |
| 19 content::P2P_SOCKET_UDP, |
| 20 unspecified_end_point, |
| 21 unspecified_end_point, |
| 22 NULL); |
| 23 return socket; |
| 24 } |
| 25 }; |
9 | 26 |
10 CastUdpTransport::CastUdpTransport() | 27 CastUdpTransport::CastUdpTransport() |
11 : cast_session_(new CastSession()) { | 28 : cast_session_(new CastSession()) { |
12 } | 29 } |
13 | 30 |
14 CastUdpTransport::~CastUdpTransport() { | 31 CastUdpTransport::~CastUdpTransport() { |
15 } | 32 } |
16 | 33 |
17 void CastUdpTransport::Start(const net::HostPortPair& remote_address) { | 34 void CastUdpTransport::Start(const net::IPEndPoint& remote_address) { |
18 NOTIMPLEMENTED(); | 35 cast_session_->SetSocketFactory( |
| 36 scoped_ptr<CastSession::SocketFactory>(new CastUdpSocketFactory()).Pass(), |
| 37 remote_address); |
19 } | 38 } |
OLD | NEW |