| 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_data_collection) { | 27 if (config_.enable_data_collection) { |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 PacketRawMap LoggingImpl::GetPacketRawData() { | 152 PacketRawMap LoggingImpl::GetPacketRawData() { |
| 153 DCHECK(main_thread_proxy_->RunsTasksOnCurrentThread()); | 153 DCHECK(main_thread_proxy_->RunsTasksOnCurrentThread()); |
| 154 return raw_.GetPacketData(); | 154 return raw_.GetPacketData(); |
| 155 } | 155 } |
| 156 | 156 |
| 157 GenericRawMap LoggingImpl::GetGenericRawData() { | 157 GenericRawMap LoggingImpl::GetGenericRawData() { |
| 158 DCHECK(main_thread_proxy_->RunsTasksOnCurrentThread()); | 158 DCHECK(main_thread_proxy_->RunsTasksOnCurrentThread()); |
| 159 return raw_.GetGenericData(); | 159 return raw_.GetGenericData(); |
| 160 } | 160 } |
| 161 | 161 |
| 162 AudioRtcpRawMap LoggingImpl::GetAudioRtcpRawData() { |
| 163 DCHECK(main_thread_proxy_->RunsTasksOnCurrentThread()); |
| 164 return raw_.GetAndResetAudioRtcpData(); |
| 165 } |
| 166 |
| 167 VideoRtcpRawMap LoggingImpl::GetVideoRtcpRawData() { |
| 168 DCHECK(main_thread_proxy_->RunsTasksOnCurrentThread()); |
| 169 return raw_.GetAndResetVideoRtcpData(); |
| 170 } |
| 171 |
| 162 const FrameStatsMap* LoggingImpl::GetFrameStatsData( | 172 const FrameStatsMap* LoggingImpl::GetFrameStatsData( |
| 163 const base::TimeTicks& now) { | 173 const base::TimeTicks& now) { |
| 164 DCHECK(main_thread_proxy_->RunsTasksOnCurrentThread()); | 174 DCHECK(main_thread_proxy_->RunsTasksOnCurrentThread()); |
| 165 // Get stats data. | 175 // Get stats data. |
| 166 const FrameStatsMap* stats = stats_.GetFrameStatsData(now); | 176 const FrameStatsMap* stats = stats_.GetFrameStatsData(now); |
| 167 if (config_.enable_uma_stats) { | 177 if (config_.enable_uma_stats) { |
| 168 FrameStatsMap::const_iterator it; | 178 FrameStatsMap::const_iterator it; |
| 169 for (it = stats->begin(); it != stats->end(); ++it) { | 179 for (it = stats->begin(); it != stats->end(); ++it) { |
| 170 // Check for an active event. | 180 // Check for an active event. |
| 171 if (it->second->framerate_fps > 0) { | 181 if (it->second->framerate_fps > 0) { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 } | 238 } |
| 229 | 239 |
| 230 void LoggingImpl::Reset() { | 240 void LoggingImpl::Reset() { |
| 231 DCHECK(main_thread_proxy_->RunsTasksOnCurrentThread()); | 241 DCHECK(main_thread_proxy_->RunsTasksOnCurrentThread()); |
| 232 raw_.Reset(); | 242 raw_.Reset(); |
| 233 stats_.Reset(); | 243 stats_.Reset(); |
| 234 } | 244 } |
| 235 | 245 |
| 236 } // namespace cast | 246 } // namespace cast |
| 237 } // namespace media | 247 } // namespace media |
| OLD | NEW |