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::P2PSocketFactory { |
| 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 const scoped_refptr<CastSession>& session) | 28 const scoped_refptr<CastSession>& session) |
12 : cast_session_(session) { | 29 : cast_session_(session) { |
13 } | 30 } |
14 | 31 |
15 CastUdpTransport::~CastUdpTransport() { | 32 CastUdpTransport::~CastUdpTransport() { |
16 } | 33 } |
17 | 34 |
18 void CastUdpTransport::Start(const net::HostPortPair& remote_address) { | 35 void CastUdpTransport::Start(const net::IPEndPoint& remote_address) { |
19 NOTIMPLEMENTED(); | 36 cast_session_->SetSocketFactory( |
| 37 scoped_ptr<CastSession::P2PSocketFactory>( |
| 38 new CastUdpSocketFactory()).Pass(), |
| 39 remote_address); |
20 } | 40 } |
OLD | NEW |