| 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 "media/cast/logging/stats_event_subscriber.h" | 5 #include "media/cast/logging/stats_event_subscriber.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 | 9 |
| 10 #include "base/format_macros.h" | 10 #include "base/format_macros.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 buckets_[i]); | 85 buckets_[i]); |
| 86 histo->Append(bucket.release()); | 86 histo->Append(bucket.release()); |
| 87 } | 87 } |
| 88 | 88 |
| 89 if (buckets_.back()) { | 89 if (buckets_.back()) { |
| 90 bucket.reset(new base::DictionaryValue); | 90 bucket.reset(new base::DictionaryValue); |
| 91 bucket->SetInteger(base::StringPrintf(">=%" PRId64, max_), | 91 bucket->SetInteger(base::StringPrintf(">=%" PRId64, max_), |
| 92 buckets_.back()); | 92 buckets_.back()); |
| 93 histo->Append(bucket.release()); | 93 histo->Append(bucket.release()); |
| 94 } | 94 } |
| 95 return histo.Pass(); | 95 return histo; |
| 96 } | 96 } |
| 97 | 97 |
| 98 StatsEventSubscriber::StatsEventSubscriber( | 98 StatsEventSubscriber::StatsEventSubscriber( |
| 99 EventMediaType event_media_type, | 99 EventMediaType event_media_type, |
| 100 base::TickClock* clock, | 100 base::TickClock* clock, |
| 101 ReceiverTimeOffsetEstimator* offset_estimator) | 101 ReceiverTimeOffsetEstimator* offset_estimator) |
| 102 : event_media_type_(event_media_type), | 102 : event_media_type_(event_media_type), |
| 103 clock_(clock), | 103 clock_(clock), |
| 104 offset_estimator_(offset_estimator), | 104 offset_estimator_(offset_estimator), |
| 105 capture_latency_datapoints_(0), | 105 capture_latency_datapoints_(0), |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 for (HistogramMap::const_iterator it = histograms_.begin(); | 240 for (HistogramMap::const_iterator it = histograms_.begin(); |
| 241 it != histograms_.end(); | 241 it != histograms_.end(); |
| 242 ++it) { | 242 ++it) { |
| 243 stats->Set(CastStatToString(it->first), | 243 stats->Set(CastStatToString(it->first), |
| 244 it->second->GetHistogram().release()); | 244 it->second->GetHistogram().release()); |
| 245 } | 245 } |
| 246 | 246 |
| 247 ret->Set(event_media_type_ == AUDIO_EVENT ? "audio" : "video", | 247 ret->Set(event_media_type_ == AUDIO_EVENT ? "audio" : "video", |
| 248 stats.release()); | 248 stats.release()); |
| 249 | 249 |
| 250 return ret.Pass(); | 250 return ret; |
| 251 } | 251 } |
| 252 | 252 |
| 253 void StatsEventSubscriber::Reset() { | 253 void StatsEventSubscriber::Reset() { |
| 254 DCHECK(thread_checker_.CalledOnValidThread()); | 254 DCHECK(thread_checker_.CalledOnValidThread()); |
| 255 | 255 |
| 256 frame_stats_.clear(); | 256 frame_stats_.clear(); |
| 257 packet_stats_.clear(); | 257 packet_stats_.clear(); |
| 258 total_capture_latency_ = base::TimeDelta(); | 258 total_capture_latency_ = base::TimeDelta(); |
| 259 capture_latency_datapoints_ = 0; | 259 capture_latency_datapoints_ = 0; |
| 260 total_encode_time_ = base::TimeDelta(); | 260 total_encode_time_ = base::TimeDelta(); |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 747 : event_counter(0), sum_size(0) {} | 747 : event_counter(0), sum_size(0) {} |
| 748 StatsEventSubscriber::PacketLogStats::~PacketLogStats() {} | 748 StatsEventSubscriber::PacketLogStats::~PacketLogStats() {} |
| 749 | 749 |
| 750 StatsEventSubscriber::FrameInfo::FrameInfo() : encoded(false) { | 750 StatsEventSubscriber::FrameInfo::FrameInfo() : encoded(false) { |
| 751 } | 751 } |
| 752 StatsEventSubscriber::FrameInfo::~FrameInfo() { | 752 StatsEventSubscriber::FrameInfo::~FrameInfo() { |
| 753 } | 753 } |
| 754 | 754 |
| 755 } // namespace cast | 755 } // namespace cast |
| 756 } // namespace media | 756 } // namespace media |
| OLD | NEW |