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 #ifndef MEDIA_CAST_LOGGING_LOGGING_IMPL_H_ | 4 #ifndef MEDIA_CAST_LOGGING_LOGGING_IMPL_H_ |
5 #define MEDIA_CAST_LOGGING_LOGGING_IMPL_H_ | 5 #define MEDIA_CAST_LOGGING_LOGGING_IMPL_H_ |
6 | 6 |
7 // Generic class that handles event logging for the cast library. | 7 // Generic class that handles event logging for the cast library. |
8 // Logging has three possible optional forms: | 8 // Logging has three possible optional forms: |
9 // 1. Raw data and stats accessible by the application. | 9 // 1. Raw data and stats accessible by the application. |
10 // 2. Tracing of raw events. | 10 // 2. Tracing of raw events. |
11 | 11 |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/threading/thread_checker.h" | 13 #include "base/threading/thread_checker.h" |
14 #include "media/cast/cast_config.h" | 14 #include "media/cast/cast_config.h" |
15 #include "media/cast/logging/logging_defines.h" | 15 #include "media/cast/logging/logging_defines.h" |
16 #include "media/cast/logging/logging_raw.h" | 16 #include "media/cast/logging/logging_raw.h" |
17 #include "media/cast/logging/logging_stats.h" | |
18 | 17 |
19 namespace media { | 18 namespace media { |
20 namespace cast { | 19 namespace cast { |
21 | 20 |
22 class LoggingImpl { | 21 class LoggingImpl { |
23 public: | 22 public: |
24 explicit LoggingImpl(const CastLoggingConfig& config); | 23 LoggingImpl(); |
25 | |
26 ~LoggingImpl(); | 24 ~LoggingImpl(); |
27 | 25 |
28 // Note: All methods below should be called from the same thread. | 26 // Note: All methods below should be called from the same thread. |
29 | 27 |
30 void InsertFrameEvent(const base::TimeTicks& time_of_event, | 28 void InsertFrameEvent(const base::TimeTicks& time_of_event, |
31 CastLoggingEvent event, uint32 rtp_timestamp, | 29 CastLoggingEvent event, uint32 rtp_timestamp, |
32 uint32 frame_id); | 30 uint32 frame_id); |
33 | 31 |
34 void InsertFrameEventWithSize(const base::TimeTicks& time_of_event, | 32 void InsertFrameEventWithSize(const base::TimeTicks& time_of_event, |
35 CastLoggingEvent event, uint32 rtp_timestamp, | 33 CastLoggingEvent event, uint32 rtp_timestamp, |
(...skipping 18 matching lines...) Expand all Loading... |
54 void InsertGenericEvent(const base::TimeTicks& time_of_event, | 52 void InsertGenericEvent(const base::TimeTicks& time_of_event, |
55 CastLoggingEvent event, int value); | 53 CastLoggingEvent event, int value); |
56 | 54 |
57 | 55 |
58 // Delegates to |LoggingRaw::AddRawEventSubscriber()|. | 56 // Delegates to |LoggingRaw::AddRawEventSubscriber()|. |
59 void AddRawEventSubscriber(RawEventSubscriber* subscriber); | 57 void AddRawEventSubscriber(RawEventSubscriber* subscriber); |
60 | 58 |
61 // Delegates to |LoggingRaw::RemoveRawEventSubscriber()|. | 59 // Delegates to |LoggingRaw::RemoveRawEventSubscriber()|. |
62 void RemoveRawEventSubscriber(RawEventSubscriber* subscriber); | 60 void RemoveRawEventSubscriber(RawEventSubscriber* subscriber); |
63 | 61 |
64 // Get stats only. | |
65 FrameStatsMap GetFrameStatsData(EventMediaType media_type) const; | |
66 PacketStatsMap GetPacketStatsData(EventMediaType media_type) const; | |
67 GenericStatsMap GetGenericStatsData() const; | |
68 | |
69 // Reset stats logging data. | |
70 void ResetStats(); | |
71 | |
72 private: | 62 private: |
73 base::ThreadChecker thread_checker_; | 63 base::ThreadChecker thread_checker_; |
74 const CastLoggingConfig config_; | |
75 LoggingRaw raw_; | 64 LoggingRaw raw_; |
76 LoggingStats stats_; | |
77 | 65 |
78 DISALLOW_COPY_AND_ASSIGN(LoggingImpl); | 66 DISALLOW_COPY_AND_ASSIGN(LoggingImpl); |
79 }; | 67 }; |
80 | 68 |
81 } // namespace cast | 69 } // namespace cast |
82 } // namespace media | 70 } // namespace media |
83 | 71 |
84 #endif // MEDIA_CAST_LOGGING_LOGGING_IMPL_H_ | 72 #endif // MEDIA_CAST_LOGGING_LOGGING_IMPL_H_ |
OLD | NEW |