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 #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 <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
| 11 #include <memory> |
| 12 |
11 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
12 #include "base/macros.h" | 14 #include "base/macros.h" |
13 #include "base/memory/linked_ptr.h" | 15 #include "base/memory/linked_ptr.h" |
14 #include "base/memory/scoped_ptr.h" | |
15 #include "base/threading/thread_checker.h" | 16 #include "base/threading/thread_checker.h" |
16 #include "base/time/tick_clock.h" | 17 #include "base/time/tick_clock.h" |
17 #include "media/cast/logging/logging_defines.h" | 18 #include "media/cast/logging/logging_defines.h" |
18 #include "media/cast/logging/raw_event_subscriber.h" | 19 #include "media/cast/logging/raw_event_subscriber.h" |
19 #include "media/cast/logging/receiver_time_offset_estimator.h" | 20 #include "media/cast/logging/receiver_time_offset_estimator.h" |
20 | 21 |
21 namespace base { | 22 namespace base { |
22 class DictionaryValue; | 23 class DictionaryValue; |
23 class ListValue; | 24 class ListValue; |
24 } | 25 } |
(...skipping 15 matching lines...) Expand all Loading... |
40 | 41 |
41 // RawReventSubscriber implementations. | 42 // RawReventSubscriber implementations. |
42 void OnReceiveFrameEvent(const FrameEvent& frame_event) final; | 43 void OnReceiveFrameEvent(const FrameEvent& frame_event) final; |
43 void OnReceivePacketEvent(const PacketEvent& packet_event) final; | 44 void OnReceivePacketEvent(const PacketEvent& packet_event) final; |
44 | 45 |
45 // Returns stats as a DictionaryValue. The dictionary contains one entry - | 46 // Returns stats as a DictionaryValue. The dictionary contains one entry - |
46 // "audio" or "video" pointing to an inner dictionary. | 47 // "audio" or "video" pointing to an inner dictionary. |
47 // The inner dictionary consists of string - double entries, where the string | 48 // The inner dictionary consists of string - double entries, where the string |
48 // describes the name of the stat, and the double describes | 49 // describes the name of the stat, and the double describes |
49 // the value of the stat. See CastStat and StatsMap below. | 50 // the value of the stat. See CastStat and StatsMap below. |
50 scoped_ptr<base::DictionaryValue> GetStats() const; | 51 std::unique_ptr<base::DictionaryValue> GetStats() const; |
51 | 52 |
52 // Resets stats in this object. | 53 // Resets stats in this object. |
53 void Reset(); | 54 void Reset(); |
54 | 55 |
55 private: | 56 private: |
56 friend class StatsEventSubscriberTest; | 57 friend class StatsEventSubscriberTest; |
57 FRIEND_TEST_ALL_PREFIXES(StatsEventSubscriberTest, EmptyStats); | 58 FRIEND_TEST_ALL_PREFIXES(StatsEventSubscriberTest, EmptyStats); |
58 FRIEND_TEST_ALL_PREFIXES(StatsEventSubscriberTest, CaptureEncode); | 59 FRIEND_TEST_ALL_PREFIXES(StatsEventSubscriberTest, CaptureEncode); |
59 FRIEND_TEST_ALL_PREFIXES(StatsEventSubscriberTest, Encode); | 60 FRIEND_TEST_ALL_PREFIXES(StatsEventSubscriberTest, Encode); |
60 FRIEND_TEST_ALL_PREFIXES(StatsEventSubscriberTest, Decode); | 61 FRIEND_TEST_ALL_PREFIXES(StatsEventSubscriberTest, Decode); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 // |min| must be less than |max|. | 96 // |min| must be less than |max|. |
96 // |width| must divide |max - min| evenly. | 97 // |width| must divide |max - min| evenly. |
97 SimpleHistogram(int64_t min, int64_t max, int64_t width); | 98 SimpleHistogram(int64_t min, int64_t max, int64_t width); |
98 | 99 |
99 ~SimpleHistogram(); | 100 ~SimpleHistogram(); |
100 | 101 |
101 void Add(int64_t sample); | 102 void Add(int64_t sample); |
102 | 103 |
103 void Reset(); | 104 void Reset(); |
104 | 105 |
105 scoped_ptr<base::ListValue> GetHistogram() const; | 106 std::unique_ptr<base::ListValue> GetHistogram() const; |
106 | 107 |
107 private: | 108 private: |
108 int64_t min_; | 109 int64_t min_; |
109 int64_t max_; | 110 int64_t max_; |
110 int64_t width_; | 111 int64_t width_; |
111 std::vector<int> buckets_; | 112 std::vector<int> buckets_; |
112 }; | 113 }; |
113 | 114 |
114 enum CastStat { | 115 enum CastStat { |
115 // Capture frame rate. | 116 // Capture frame rate. |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 HistogramMap histograms_; | 280 HistogramMap histograms_; |
280 | 281 |
281 base::ThreadChecker thread_checker_; | 282 base::ThreadChecker thread_checker_; |
282 DISALLOW_COPY_AND_ASSIGN(StatsEventSubscriber); | 283 DISALLOW_COPY_AND_ASSIGN(StatsEventSubscriber); |
283 }; | 284 }; |
284 | 285 |
285 } // namespace cast | 286 } // namespace cast |
286 } // namespace media | 287 } // namespace media |
287 | 288 |
288 #endif // MEDIA_CAST_LOGGING_STATS_EVENT_SUBSCRIBER_H_ | 289 #endif // MEDIA_CAST_LOGGING_STATS_EVENT_SUBSCRIBER_H_ |
OLD | NEW |