Remove Unused AsTextButtonBorder RTTI helper.
[chromium-blink-merge.git] / media / cast / logging / logging_defines.h
blob38d1b9f849edca40534b8f75f605b47df429b08c
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
3 // found in the LICENSE file.
5 #ifndef MEDIA_CAST_LOGGING_LOGGING_DEFINES_H_
6 #define MEDIA_CAST_LOGGING_LOGGING_DEFINES_H_
8 #include <map>
9 #include <string>
10 #include <vector>
12 #include "base/time/time.h"
14 namespace media {
15 namespace cast {
17 static const uint32 kFrameIdUnknown = 0xFFFFFFFF;
19 struct CastLoggingConfig {
20 // Constructs default config - all logging is disabled.
21 CastLoggingConfig();
22 ~CastLoggingConfig();
24 bool enable_raw_data_collection;
25 bool enable_stats_data_collection;
26 bool enable_tracing;
29 // Currently these are the same as the default config.
30 CastLoggingConfig GetDefaultCastSenderLoggingConfig();
31 CastLoggingConfig GetDefaultCastReceiverLoggingConfig();
33 // Enable raw and stats data collection. Disable tracing.
34 CastLoggingConfig GetLoggingConfigWithRawEventsAndStatsEnabled();
36 enum CastLoggingEvent {
37 // Generic events.
38 kUnknown,
39 kRttMs,
40 kPacketLoss,
41 kJitterMs,
42 kVideoAckReceived,
43 kRembBitrate,
44 // TODO(imcheng): k{Audio,Video}AckSent may need to be FrameEvents
45 // (crbug.com/339590)
46 kAudioAckSent,
47 kVideoAckSent,
48 // Audio sender.
49 kAudioFrameReceived,
50 kAudioFrameCaptured,
51 kAudioFrameEncoded,
52 // Audio receiver.
53 kAudioPlayoutDelay,
54 kAudioFrameDecoded,
55 // Video sender.
56 kVideoFrameCaptured,
57 kVideoFrameReceived,
58 kVideoFrameSentToEncoder,
59 kVideoFrameEncoded,
60 // Video receiver.
61 kVideoFrameDecoded,
62 kVideoRenderDelay,
63 // Send-side packet events.
64 kPacketSentToPacer,
65 kPacketSentToNetwork,
66 kPacketRetransmitted,
67 // Receive-side packet events.
68 kAudioPacketReceived,
69 kVideoPacketReceived,
70 kDuplicatePacketReceived,
71 kNumOfLoggingEvents,
74 std::string CastLoggingToString(CastLoggingEvent event);
76 typedef uint32 RtpTimestamp;
78 struct FrameEvent {
79 FrameEvent();
80 ~FrameEvent();
82 RtpTimestamp rtp_timestamp;
83 uint32 frame_id;
84 size_t size; // Encoded size only.
86 // Time of event logged.
87 base::TimeTicks timestamp;
88 CastLoggingEvent type;
90 // Render / playout delay. Only set for kAudioPlayoutDelay and
91 // kVideoRenderDelay events.
92 base::TimeDelta delay_delta;
95 struct PacketEvent {
96 PacketEvent();
97 ~PacketEvent();
99 RtpTimestamp rtp_timestamp;
100 uint32 frame_id;
101 uint16 max_packet_id;
102 uint16 packet_id;
103 size_t size;
105 // Time of event logged.
106 base::TimeTicks timestamp;
107 CastLoggingEvent type;
110 struct GenericEvent {
111 GenericEvent();
112 ~GenericEvent();
114 CastLoggingEvent type;
116 // Depending on |type|, |value| can have different meanings:
117 // kRttMs - RTT in milliseconds
118 // kPacketLoss - Fraction of packet loss, denominated in 256
119 // kJitterMs - Jitter in milliseconds
120 // kVideoAckReceived - Frame ID
121 // kRembBitrate - Receiver Estimated Maximum Bitrate
122 // kAudioAckSent - Frame ID
123 // kVideoAckSent - Frame ID
124 int value;
126 // Time of event logged.
127 base::TimeTicks timestamp;
130 // Generic statistics given the raw data. More specific data (e.g. frame rate
131 // and bit rate) can be computed given the basic metrics.
132 // Some of the metrics will only be set when applicable, e.g. delay and size.
133 struct FrameLogStats {
134 FrameLogStats();
135 ~FrameLogStats();
136 base::TimeTicks first_event_time;
137 base::TimeTicks last_event_time;
138 int event_counter;
139 size_t sum_size;
140 base::TimeDelta min_delay;
141 base::TimeDelta max_delay;
142 base::TimeDelta sum_delay;
145 struct PacketLogStats {
146 PacketLogStats();
147 ~PacketLogStats();
148 base::TimeTicks first_event_time;
149 base::TimeTicks last_event_time;
150 int event_counter;
151 size_t sum_size;
154 struct GenericLogStats {
155 GenericLogStats();
156 ~GenericLogStats();
157 base::TimeTicks first_event_time;
158 base::TimeTicks last_event_time;
159 int event_counter;
160 int sum;
161 uint64 sum_squared;
162 int min;
163 int max;
167 typedef std::map<CastLoggingEvent, FrameLogStats> FrameStatsMap;
168 typedef std::map<CastLoggingEvent, PacketLogStats> PacketStatsMap;
169 typedef std::map<CastLoggingEvent, GenericLogStats> GenericStatsMap;
171 } // namespace cast
172 } // namespace media
174 #endif // MEDIA_CAST_LOGGING_LOGGING_DEFINES_H_