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_
12 #include "base/time/time.h"
17 static const uint32 kFrameIdUnknown
= 0xFFFFFFFF;
19 struct CastLoggingConfig
{
20 // Constructs default config - all logging is disabled.
24 bool enable_raw_data_collection
;
25 bool enable_stats_data_collection
;
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
{
44 // TODO(imcheng): k{Audio,Video}AckSent may need to be FrameEvents
58 kVideoFrameSentToEncoder
,
63 // Send-side packet events.
67 // Receive-side packet events.
70 kDuplicatePacketReceived
,
74 std::string
CastLoggingToString(CastLoggingEvent event
);
76 typedef uint32 RtpTimestamp
;
82 RtpTimestamp rtp_timestamp
;
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
;
99 RtpTimestamp rtp_timestamp
;
101 uint16 max_packet_id
;
105 // Time of event logged.
106 base::TimeTicks timestamp
;
107 CastLoggingEvent type
;
110 struct 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
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
{
136 base::TimeTicks first_event_time
;
137 base::TimeTicks last_event_time
;
140 base::TimeDelta min_delay
;
141 base::TimeDelta max_delay
;
142 base::TimeDelta sum_delay
;
145 struct PacketLogStats
{
148 base::TimeTicks first_event_time
;
149 base::TimeTicks last_event_time
;
154 struct GenericLogStats
{
157 base::TimeTicks first_event_time
;
158 base::TimeTicks last_event_time
;
167 typedef std::map
<CastLoggingEvent
, FrameLogStats
> FrameStatsMap
;
168 typedef std::map
<CastLoggingEvent
, PacketLogStats
> PacketStatsMap
;
169 typedef std::map
<CastLoggingEvent
, GenericLogStats
> GenericStatsMap
;
174 #endif // MEDIA_CAST_LOGGING_LOGGING_DEFINES_H_