OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/browser/media/cast_transport_host_filter.h" | 5 #include "chrome/browser/media/cast_transport_host_filter.h" |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "base/threading/thread_task_runner_handle.h" | 8 #include "base/threading/thread_task_runner_handle.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/common/cast_messages.h" | 10 #include "chrome/common/cast_messages.h" |
11 #include "components/net_log/chrome_net_log.h" | 11 #include "components/net_log/chrome_net_log.h" |
12 #include "content/public/browser/power_save_blocker_factory.h" | 12 #include "content/public/browser/browser_thread.h" |
| 13 #include "device/power_save_blocker/power_save_blocker.h" |
13 #include "media/cast/net/cast_transport.h" | 14 #include "media/cast/net/cast_transport.h" |
14 | 15 |
15 namespace { | 16 namespace { |
16 | 17 |
17 // How often to send raw events. | 18 // How often to send raw events. |
18 const int kSendRawEventsIntervalSecs = 1; | 19 const int kSendRawEventsIntervalSecs = 1; |
19 | 20 |
20 class TransportClient : public media::cast::CastTransport::Client { | 21 class TransportClient : public media::cast::CastTransport::Client { |
21 public: | 22 public: |
22 TransportClient(int32_t channel_id, | 23 TransportClient(int32_t channel_id, |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 return handled; | 142 return handled; |
142 } | 143 } |
143 | 144 |
144 void CastTransportHostFilter::OnNew(int32_t channel_id, | 145 void CastTransportHostFilter::OnNew(int32_t channel_id, |
145 const net::IPEndPoint& local_end_point, | 146 const net::IPEndPoint& local_end_point, |
146 const net::IPEndPoint& remote_end_point, | 147 const net::IPEndPoint& remote_end_point, |
147 const base::DictionaryValue& options) { | 148 const base::DictionaryValue& options) { |
148 if (!power_save_blocker_) { | 149 if (!power_save_blocker_) { |
149 DVLOG(1) << ("Preventing the application from being suspended while one or " | 150 DVLOG(1) << ("Preventing the application from being suspended while one or " |
150 "more transports are active for Cast Streaming."); | 151 "more transports are active for Cast Streaming."); |
151 power_save_blocker_ = content::CreatePowerSaveBlocker( | 152 power_save_blocker_ = device::PowerSaveBlocker::CreateWithTaskRunners( |
152 content::PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension, | 153 device::PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension, |
153 content::PowerSaveBlocker::kReasonOther, | 154 device::PowerSaveBlocker::kReasonOther, |
154 "Cast is streaming content to a remote receiver"); | 155 "Cast is streaming content to a remote receiver", |
| 156 content::BrowserThread::GetMessageLoopProxyForThread( |
| 157 content::BrowserThread::UI), |
| 158 content::BrowserThread::GetMessageLoopProxyForThread( |
| 159 content::BrowserThread::FILE)); |
155 } | 160 } |
156 | 161 |
157 if (id_map_.Lookup(channel_id)) { | 162 if (id_map_.Lookup(channel_id)) { |
158 id_map_.Remove(channel_id); | 163 id_map_.Remove(channel_id); |
159 } | 164 } |
160 | 165 |
161 std::unique_ptr<media::cast::UdpTransport> udp_transport( | 166 std::unique_ptr<media::cast::UdpTransport> udp_transport( |
162 new media::cast::UdpTransport( | 167 new media::cast::UdpTransport( |
163 g_browser_process->net_log(), base::ThreadTaskRunnerHandle::Get(), | 168 g_browser_process->net_log(), base::ThreadTaskRunnerHandle::Get(), |
164 local_end_point, remote_end_point, | 169 local_end_point, remote_end_point, |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 if (sender) { | 363 if (sender) { |
359 sender->SendRtcpFromRtpReceiver(); | 364 sender->SendRtcpFromRtpReceiver(); |
360 } else { | 365 } else { |
361 DVLOG(1) | 366 DVLOG(1) |
362 << "CastTransportHostFilter::OnSendRtcpFromRtpReceiver " | 367 << "CastTransportHostFilter::OnSendRtcpFromRtpReceiver " |
363 << "on non-existing channel"; | 368 << "on non-existing channel"; |
364 } | 369 } |
365 } | 370 } |
366 | 371 |
367 } // namespace cast | 372 } // namespace cast |
OLD | NEW |