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_delegate.h" | 5 #include "chrome/renderer/media/cast_session_delegate.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/callback_helpers.h" | 11 #include "base/callback_helpers.h" |
12 #include "base/lazy_instance.h" | 12 #include "base/lazy_instance.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/memory/ptr_util.h" | 14 #include "base/memory/ptr_util.h" |
15 #include "base/single_thread_task_runner.h" | 15 #include "base/single_thread_task_runner.h" |
16 #include "base/strings/stringprintf.h" | 16 #include "base/strings/stringprintf.h" |
17 #include "base/threading/thread_task_runner_handle.h" | 17 #include "base/threading/thread_task_runner_handle.h" |
| 18 #include "base/values.h" |
18 #include "build/build_config.h" | 19 #include "build/build_config.h" |
19 #include "chrome/renderer/media/cast_threads.h" | 20 #include "chrome/renderer/media/cast_threads.h" |
20 #include "chrome/renderer/media/cast_transport_ipc.h" | 21 #include "chrome/renderer/media/cast_transport_ipc.h" |
21 #include "components/version_info/version_info.h" | 22 #include "components/version_info/version_info.h" |
22 #include "content/public/renderer/render_thread.h" | 23 #include "content/public/renderer/render_thread.h" |
23 #include "media/cast/cast_config.h" | 24 #include "media/cast/cast_config.h" |
24 #include "media/cast/cast_environment.h" | 25 #include "media/cast/cast_environment.h" |
25 #include "media/cast/cast_sender.h" | 26 #include "media/cast/cast_sender.h" |
26 #include "media/cast/logging/log_serializer.h" | 27 #include "media/cast/logging/log_serializer.h" |
27 #include "media/cast/logging/logging_defines.h" | 28 #include "media/cast/logging/logging_defines.h" |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 &output_bytes); | 246 &output_bytes); |
246 | 247 |
247 if (!success) { | 248 if (!success) { |
248 DVLOG(2) << "Failed to serialize event log."; | 249 DVLOG(2) << "Failed to serialize event log."; |
249 callback.Run(base::MakeUnique<base::Value>(base::Value::Type::BINARY)); | 250 callback.Run(base::MakeUnique<base::Value>(base::Value::Type::BINARY)); |
250 return; | 251 return; |
251 } | 252 } |
252 | 253 |
253 DVLOG(2) << "Serialized log length: " << output_bytes; | 254 DVLOG(2) << "Serialized log length: " << output_bytes; |
254 | 255 |
255 auto blob = base::MakeUnique<base::BinaryValue>(std::vector<char>( | 256 auto blob = base::MakeUnique<base::Value>(std::vector<char>( |
256 serialized_log.get(), serialized_log.get() + output_bytes)); | 257 serialized_log.get(), serialized_log.get() + output_bytes)); |
257 callback.Run(std::move(blob)); | 258 callback.Run(std::move(blob)); |
258 } | 259 } |
259 | 260 |
260 void CastSessionDelegate::GetStatsAndReset(bool is_audio, | 261 void CastSessionDelegate::GetStatsAndReset(bool is_audio, |
261 const StatsCallback& callback) { | 262 const StatsCallback& callback) { |
262 DCHECK(io_task_runner_->BelongsToCurrentThread()); | 263 DCHECK(io_task_runner_->BelongsToCurrentThread()); |
263 | 264 |
264 if (!event_subscribers_.get()) { | 265 if (!event_subscribers_.get()) { |
265 callback.Run(base::MakeUnique<base::DictionaryValue>()); | 266 callback.Run(base::MakeUnique<base::DictionaryValue>()); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 error_callback.Run(base::StringPrintf("%s codec runtime error.", | 326 error_callback.Run(base::StringPrintf("%s codec runtime error.", |
326 is_for_audio ? "Audio" : "Video")); | 327 is_for_audio ? "Audio" : "Video")); |
327 break; | 328 break; |
328 } | 329 } |
329 } | 330 } |
330 | 331 |
331 void CastSessionDelegate::ReceivePacket( | 332 void CastSessionDelegate::ReceivePacket( |
332 std::unique_ptr<media::cast::Packet> packet) { | 333 std::unique_ptr<media::cast::Packet> packet) { |
333 // Do nothing (frees packet) | 334 // Do nothing (frees packet) |
334 } | 335 } |
OLD | NEW |