| 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 "base/debug/trace_event.h" | 5 #include "base/debug/trace_event.h" |
| 6 #include "base/metrics/histogram.h" | 6 #include "base/metrics/histogram.h" |
| 7 #include "media/cast/logging/logging_impl.h" | 7 #include "media/cast/logging/logging_impl.h" |
| 8 #include "net/base/big_endian.h" | 8 #include "net/base/big_endian.h" |
| 9 | 9 |
| 10 namespace media { | 10 namespace media { |
| 11 namespace cast { | 11 namespace cast { |
| 12 | 12 |
| 13 LoggingImpl::LoggingImpl(scoped_refptr<base::TaskRunner> main_thread_proxy, | 13 LoggingImpl::LoggingImpl(scoped_refptr<base::TaskRunner> main_thread_proxy, |
| 14 const CastLoggingConfig& config) | 14 const CastLoggingConfig& config) |
| 15 : main_thread_proxy_(main_thread_proxy), | 15 : main_thread_proxy_(main_thread_proxy), |
| 16 config_(config), | 16 config_(config), |
| 17 raw_(), | 17 raw_(config.is_sender), |
| 18 stats_() {} | 18 stats_() {} |
| 19 | 19 |
| 20 LoggingImpl::~LoggingImpl() {} | 20 LoggingImpl::~LoggingImpl() {} |
| 21 | 21 |
| 22 void LoggingImpl::InsertFrameEvent(const base::TimeTicks& time_of_event, | 22 void LoggingImpl::InsertFrameEvent(const base::TimeTicks& time_of_event, |
| 23 CastLoggingEvent event, | 23 CastLoggingEvent event, |
| 24 uint32 rtp_timestamp, | 24 uint32 rtp_timestamp, |
| 25 uint32 frame_id) { | 25 uint32 frame_id) { |
| 26 DCHECK(main_thread_proxy_->RunsTasksOnCurrentThread()); | 26 DCHECK(main_thread_proxy_->RunsTasksOnCurrentThread()); |
| 27 if (config_.enable_raw_data_collection) { | 27 if (config_.enable_raw_data_collection) { |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 PacketRawMap LoggingImpl::GetPacketRawData() { | 191 PacketRawMap LoggingImpl::GetPacketRawData() { |
| 192 DCHECK(main_thread_proxy_->RunsTasksOnCurrentThread()); | 192 DCHECK(main_thread_proxy_->RunsTasksOnCurrentThread()); |
| 193 return raw_.GetPacketData(); | 193 return raw_.GetPacketData(); |
| 194 } | 194 } |
| 195 | 195 |
| 196 GenericRawMap LoggingImpl::GetGenericRawData() { | 196 GenericRawMap LoggingImpl::GetGenericRawData() { |
| 197 DCHECK(main_thread_proxy_->RunsTasksOnCurrentThread()); | 197 DCHECK(main_thread_proxy_->RunsTasksOnCurrentThread()); |
| 198 return raw_.GetGenericData(); | 198 return raw_.GetGenericData(); |
| 199 } | 199 } |
| 200 | 200 |
| 201 AudioRtcpRawMap LoggingImpl::GetAudioRtcpRawData() { |
| 202 DCHECK(main_thread_proxy_->RunsTasksOnCurrentThread()); |
| 203 return raw_.GetAndResetAudioRtcpData(); |
| 204 } |
| 205 |
| 206 VideoRtcpRawMap LoggingImpl::GetVideoRtcpRawData() { |
| 207 DCHECK(main_thread_proxy_->RunsTasksOnCurrentThread()); |
| 208 return raw_.GetAndResetVideoRtcpData(); |
| 209 } |
| 210 |
| 201 const FrameStatsMap* LoggingImpl::GetFrameStatsData( | 211 const FrameStatsMap* LoggingImpl::GetFrameStatsData( |
| 202 const base::TimeTicks& now) { | 212 const base::TimeTicks& now) { |
| 203 DCHECK(main_thread_proxy_->RunsTasksOnCurrentThread()); | 213 DCHECK(main_thread_proxy_->RunsTasksOnCurrentThread()); |
| 204 // Get stats data. | 214 // Get stats data. |
| 205 const FrameStatsMap* stats = stats_.GetFrameStatsData(now); | 215 const FrameStatsMap* stats = stats_.GetFrameStatsData(now); |
| 206 if (config_.enable_uma_stats) { | 216 if (config_.enable_uma_stats) { |
| 207 FrameStatsMap::const_iterator it; | 217 FrameStatsMap::const_iterator it; |
| 208 for (it = stats->begin(); it != stats->end(); ++it) { | 218 for (it = stats->begin(); it != stats->end(); ++it) { |
| 209 // Check for an active event. | 219 // Check for an active event. |
| 210 // The default frame event implies frame rate. | 220 // The default frame event implies frame rate. |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 raw_.Reset(); | 333 raw_.Reset(); |
| 324 } | 334 } |
| 325 | 335 |
| 326 void LoggingImpl::ResetStats() { | 336 void LoggingImpl::ResetStats() { |
| 327 DCHECK(main_thread_proxy_->RunsTasksOnCurrentThread()); | 337 DCHECK(main_thread_proxy_->RunsTasksOnCurrentThread()); |
| 328 stats_.Reset(); | 338 stats_.Reset(); |
| 329 } | 339 } |
| 330 | 340 |
| 331 } // namespace cast | 341 } // namespace cast |
| 332 } // namespace media | 342 } // namespace media |
| OLD | NEW |