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_session.h" | 5 #include "chrome/renderer/media/cast_session.h" |
6 | 6 |
7 #include "base/message_loop/message_loop_proxy.h" | 7 #include "base/message_loop/message_loop_proxy.h" |
8 #include "chrome/renderer/media/cast_session_delegate.h" | 8 #include "chrome/renderer/media/cast_session_delegate.h" |
9 #include "content/public/renderer/render_thread.h" | 9 #include "content/public/renderer/render_thread.h" |
10 #include "media/cast/cast_config.h" | 10 #include "media/cast/cast_config.h" |
11 | 11 |
12 CastSession::CastSession() | 12 CastSession::CastSession() |
13 : delegate_(new CastSessionDelegate()), | 13 : delegate_(new CastSessionDelegate()), |
14 io_message_loop_proxy_( | 14 io_message_loop_proxy_( |
15 content::RenderThread::Get()->GetIOMessageLoopProxy()) { | 15 content::RenderThread::Get()->GetIOMessageLoopProxy()) { |
16 } | 16 } |
17 | 17 |
18 CastSession::~CastSession() { | 18 CastSession::~CastSession() { |
19 // We should always be able to delete the object on the IO thread. | 19 // We should always be able to delete the object on the IO thread. |
20 CHECK(io_message_loop_proxy_->DeleteSoon(FROM_HERE, delegate_.release())); | 20 CHECK(io_message_loop_proxy_->DeleteSoon(FROM_HERE, delegate_.release())); |
21 } | 21 } |
22 | 22 |
| 23 CastSession::P2PSocketFactory::~P2PSocketFactory() { |
| 24 } |
| 25 |
23 void CastSession::StartAudio(const media::cast::AudioSenderConfig& config) { | 26 void CastSession::StartAudio(const media::cast::AudioSenderConfig& config) { |
24 io_message_loop_proxy_->PostTask(FROM_HERE, | 27 io_message_loop_proxy_->PostTask(FROM_HERE, |
25 base::Bind(&CastSessionDelegate::StartAudio, | 28 base::Bind(&CastSessionDelegate::StartAudio, |
26 base::Unretained(delegate_.get()), | 29 base::Unretained(delegate_.get()), |
27 config)); | 30 config)); |
28 } | 31 } |
29 | 32 |
30 void CastSession::StartVideo(const media::cast::VideoSenderConfig& config) { | 33 void CastSession::StartVideo(const media::cast::VideoSenderConfig& config) { |
31 io_message_loop_proxy_->PostTask(FROM_HERE, | 34 io_message_loop_proxy_->PostTask(FROM_HERE, |
32 base::Bind(&CastSessionDelegate::StartVideo, | 35 base::Bind(&CastSessionDelegate::StartVideo, |
33 base::Unretained(delegate_.get()), | 36 base::Unretained(delegate_.get()), |
34 config)); | 37 config)); |
35 } | 38 } |
| 39 |
| 40 void CastSession::SetSocketFactory(scoped_ptr<P2PSocketFactory> socket_factory, |
| 41 const net::IPEndPoint& remote_address) { |
| 42 io_message_loop_proxy_->PostTask( |
| 43 FROM_HERE, |
| 44 base::Bind(&CastSessionDelegate::SetSocketFactory, |
| 45 base::Unretained(delegate_.get()), |
| 46 base::Passed(socket_factory.Pass()), |
| 47 remote_address)); |
| 48 } |
OLD | NEW |