Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(44)

Side by Side Diff: media/cast/logging/stats_event_subscriber.h

Issue 1534273002: Switch to standard integer types in media/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #ifndef MEDIA_CAST_LOGGING_STATS_EVENT_SUBSCRIBER_H_ 5 #ifndef MEDIA_CAST_LOGGING_STATS_EVENT_SUBSCRIBER_H_
6 #define MEDIA_CAST_LOGGING_STATS_EVENT_SUBSCRIBER_H_ 6 #define MEDIA_CAST_LOGGING_STATS_EVENT_SUBSCRIBER_H_
7 7
8 #include "base/gtest_prod_util.h" 8 #include "base/gtest_prod_util.h"
9 #include "base/memory/linked_ptr.h" 9 #include "base/memory/linked_ptr.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 public: 83 public:
84 // This will create N+2 buckets where N = (max - min) / width: 84 // This will create N+2 buckets where N = (max - min) / width:
85 // Underflow bucket: < min 85 // Underflow bucket: < min
86 // Bucket 0: [min, min + width - 1] 86 // Bucket 0: [min, min + width - 1]
87 // Bucket 1: [min + width, min + 2 * width - 1] 87 // Bucket 1: [min + width, min + 2 * width - 1]
88 // ... 88 // ...
89 // Bucket N-1: [max - width, max - 1] 89 // Bucket N-1: [max - width, max - 1]
90 // Overflow bucket: >= max 90 // Overflow bucket: >= max
91 // |min| must be less than |max|. 91 // |min| must be less than |max|.
92 // |width| must divide |max - min| evenly. 92 // |width| must divide |max - min| evenly.
93 SimpleHistogram(int64 min, int64 max, int64 width); 93 SimpleHistogram(int64_t min, int64_t max, int64_t width);
94 94
95 ~SimpleHistogram(); 95 ~SimpleHistogram();
96 96
97 void Add(int64 sample); 97 void Add(int64_t sample);
98 98
99 void Reset(); 99 void Reset();
100 100
101 scoped_ptr<base::ListValue> GetHistogram() const; 101 scoped_ptr<base::ListValue> GetHistogram() const;
102 102
103 private: 103 private:
104 int64 min_; 104 int64_t min_;
105 int64 max_; 105 int64_t max_;
106 int64 width_; 106 int64_t width_;
107 std::vector<int> buckets_; 107 std::vector<int> buckets_;
108 }; 108 };
109 109
110 enum CastStat { 110 enum CastStat {
111 // Capture frame rate. 111 // Capture frame rate.
112 CAPTURE_FPS, 112 CAPTURE_FPS,
113 // Encode frame rate. 113 // Encode frame rate.
114 ENCODE_FPS, 114 ENCODE_FPS,
115 // Decode frame rate. 115 // Decode frame rate.
116 DECODE_FPS, 116 DECODE_FPS,
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 176
177 base::TimeTicks capture_time; 177 base::TimeTicks capture_time;
178 base::TimeTicks capture_end_time; 178 base::TimeTicks capture_end_time;
179 base::TimeTicks encode_end_time; 179 base::TimeTicks encode_end_time;
180 bool encoded; 180 bool encoded;
181 }; 181 };
182 182
183 typedef std::map<CastStat, double> StatsMap; 183 typedef std::map<CastStat, double> StatsMap;
184 typedef std::map<CastStat, linked_ptr<SimpleHistogram> > HistogramMap; 184 typedef std::map<CastStat, linked_ptr<SimpleHistogram> > HistogramMap;
185 typedef std::map<RtpTimestamp, FrameInfo> FrameInfoMap; 185 typedef std::map<RtpTimestamp, FrameInfo> FrameInfoMap;
186 typedef std::map< 186 typedef std::map<std::pair<RtpTimestamp, uint16_t>,
187 std::pair<RtpTimestamp, uint16>, 187 std::pair<base::TimeTicks, CastLoggingEvent>>
188 std::pair<base::TimeTicks, CastLoggingEvent> >
189 PacketEventTimeMap; 188 PacketEventTimeMap;
190 typedef std::map<CastLoggingEvent, FrameLogStats> FrameStatsMap; 189 typedef std::map<CastLoggingEvent, FrameLogStats> FrameStatsMap;
191 typedef std::map<CastLoggingEvent, PacketLogStats> PacketStatsMap; 190 typedef std::map<CastLoggingEvent, PacketLogStats> PacketStatsMap;
192 191
193 static const char* CastStatToString(CastStat stat); 192 static const char* CastStatToString(CastStat stat);
194 193
195 void InitHistograms(); 194 void InitHistograms();
196 195
197 // Assigns |stats_map| with stats data. Used for testing. 196 // Assigns |stats_map| with stats data. Used for testing.
198 void GetStatsInternal(StatsMap* stats_map) const; 197 void GetStatsInternal(StatsMap* stats_map) const;
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 HistogramMap histograms_; 275 HistogramMap histograms_;
277 276
278 base::ThreadChecker thread_checker_; 277 base::ThreadChecker thread_checker_;
279 DISALLOW_COPY_AND_ASSIGN(StatsEventSubscriber); 278 DISALLOW_COPY_AND_ASSIGN(StatsEventSubscriber);
280 }; 279 };
281 280
282 } // namespace cast 281 } // namespace cast
283 } // namespace media 282 } // namespace media
284 283
285 #endif // MEDIA_CAST_LOGGING_STATS_EVENT_SUBSCRIBER_H_ 284 #endif // MEDIA_CAST_LOGGING_STATS_EVENT_SUBSCRIBER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698