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 | 4 |
5 #ifndef MEDIA_CAST_LOGGING_LOGGING_DEFINES_H_ | 5 #ifndef MEDIA_CAST_LOGGING_LOGGING_DEFINES_H_ |
6 #define MEDIA_CAST_LOGGING_LOGGING_DEFINES_H_ | 6 #define MEDIA_CAST_LOGGING_LOGGING_DEFINES_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/memory/linked_ptr.h" | |
13 #include "base/time/time.h" | 12 #include "base/time/time.h" |
14 | 13 |
15 namespace media { | 14 namespace media { |
16 namespace cast { | 15 namespace cast { |
17 | 16 |
18 static const uint32 kFrameIdUnknown = 0xFFFF; | 17 static const uint32 kFrameIdUnknown = 0xFFFF; |
19 | 18 |
20 struct CastLoggingConfig { | 19 struct CastLoggingConfig { |
21 CastLoggingConfig(bool sender); | 20 CastLoggingConfig(bool sender); |
22 ~CastLoggingConfig(); | 21 ~CastLoggingConfig(); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
69 kNumOfLoggingEvents, | 68 kNumOfLoggingEvents, |
70 }; | 69 }; |
71 | 70 |
72 std::string CastLoggingToString(CastLoggingEvent event); | 71 std::string CastLoggingToString(CastLoggingEvent event); |
73 | 72 |
74 struct FrameEvent { | 73 struct FrameEvent { |
75 FrameEvent(); | 74 FrameEvent(); |
76 ~FrameEvent(); | 75 ~FrameEvent(); |
77 | 76 |
78 uint32 frame_id; | 77 uint32 frame_id; |
79 size_t size; // Encoded size only. | 78 // Size is set only for kAudioFrameEncoded and kVideoFrameEncoded. |
79 size_t size; | |
80 std::vector<base::TimeTicks> timestamp; | 80 std::vector<base::TimeTicks> timestamp; |
81 std::vector<CastLoggingEvent> type; | 81 std::vector<CastLoggingEvent> type; |
82 // Delay is only set for kAudioPlayoutDelay and kVideoRenderDelay. | |
82 base::TimeDelta delay_delta; // Render/playout delay. | 83 base::TimeDelta delay_delta; // Render/playout delay. |
83 }; | 84 }; |
84 | 85 |
85 // Internal map sorted by packet id. | 86 // Internal map sorted by packet id. |
86 struct BasePacketInfo { | 87 struct BasePacketInfo { |
87 BasePacketInfo(); | 88 BasePacketInfo(); |
88 ~BasePacketInfo(); | 89 ~BasePacketInfo(); |
89 | 90 |
90 size_t size; | 91 size_t size; |
91 std::vector<base::TimeTicks> timestamp; | 92 std::vector<base::TimeTicks> timestamp; |
(...skipping 10 matching lines...) Expand all Loading... | |
102 BasePacketMap packet_map; | 103 BasePacketMap packet_map; |
103 }; | 104 }; |
104 | 105 |
105 struct GenericEvent { | 106 struct GenericEvent { |
106 GenericEvent(); | 107 GenericEvent(); |
107 ~GenericEvent(); | 108 ~GenericEvent(); |
108 std::vector<int> value; | 109 std::vector<int> value; |
109 std::vector<base::TimeTicks> timestamp; | 110 std::vector<base::TimeTicks> timestamp; |
110 }; | 111 }; |
111 | 112 |
113 // Generic statistics given the raw data. More specific data (e.g. frame rate | |
114 // and bit rate) can be computed given the basic metrics. | |
115 // Some of the metrics will only be set when applicable, e.g. delay and size. | |
112 struct FrameLogStats { | 116 struct FrameLogStats { |
113 FrameLogStats(); | 117 FrameLogStats(); |
114 ~FrameLogStats(); | 118 ~FrameLogStats(); |
119 base::TimeTicks first_event_time; | |
120 base::TimeTicks last_event_time; | |
121 int event_counter; | |
122 size_t sum_size; | |
123 base::TimeDelta min_delay; | |
124 base::TimeDelta max_delay; | |
125 base::TimeDelta sum_delay; | |
126 }; | |
115 | 127 |
116 double framerate_fps; | 128 struct PacketLogStats { |
117 double bitrate_kbps; | 129 PacketLogStats(); |
118 int max_delay_ms; | 130 ~PacketLogStats(); |
119 int min_delay_ms; | 131 base::TimeTicks first_event_time; |
120 int avg_delay_ms; | 132 base::TimeTicks last_event_time; |
133 int event_counter; | |
134 size_t sum_size; | |
135 }; | |
136 | |
137 struct GenericLogStats { | |
138 GenericLogStats(); | |
139 ~GenericLogStats(); | |
140 base::TimeTicks first_event_time; | |
141 base::TimeTicks last_event_time; | |
142 int event_counter; | |
143 int sum; | |
144 int64 sum_squared; | |
imcheng
2014/01/23 21:17:18
nit: uint64?
mikhal1
2014/01/23 23:02:17
Done.
| |
145 int min; | |
146 int max; | |
121 }; | 147 }; |
122 | 148 |
123 struct ReceiverRtcpEvent { | 149 struct ReceiverRtcpEvent { |
124 ReceiverRtcpEvent(); | 150 ReceiverRtcpEvent(); |
125 ~ReceiverRtcpEvent(); | 151 ~ReceiverRtcpEvent(); |
126 | 152 |
127 CastLoggingEvent type; | 153 CastLoggingEvent type; |
128 base::TimeTicks timestamp; | 154 base::TimeTicks timestamp; |
129 base::TimeDelta delay_delta; // Render/playout delay. | 155 base::TimeDelta delay_delta; // Render/playout delay. |
130 uint16 packet_id; | 156 uint16 packet_id; |
131 }; | 157 }; |
132 | 158 |
133 // Store all log types in a map based on the event. | 159 // Store all log types in a map based on the event. |
134 typedef std::map<uint32, FrameEvent> FrameRawMap; | 160 typedef std::map<uint32, FrameEvent> FrameRawMap; |
135 typedef std::map<uint32, PacketEvent> PacketRawMap; | 161 typedef std::map<uint32, PacketEvent> PacketRawMap; |
136 typedef std::map<CastLoggingEvent, GenericEvent> GenericRawMap; | 162 typedef std::map<CastLoggingEvent, GenericEvent> GenericRawMap; |
137 | 163 |
138 typedef std::multimap<uint32, ReceiverRtcpEvent> AudioRtcpRawMap; | 164 typedef std::multimap<uint32, ReceiverRtcpEvent> AudioRtcpRawMap; |
139 typedef std::multimap<uint32, ReceiverRtcpEvent> VideoRtcpRawMap; | 165 typedef std::multimap<uint32, ReceiverRtcpEvent> VideoRtcpRawMap; |
140 | 166 |
141 typedef std::map<CastLoggingEvent, linked_ptr<FrameLogStats > > FrameStatsMap; | 167 typedef std::map<CastLoggingEvent, FrameLogStats > FrameStatsMap; |
imcheng
2014/01/23 21:17:18
nit: extra space before closing angle bracket here
mikhal1
2014/01/23 23:02:17
Done.
| |
142 typedef std::map<CastLoggingEvent, double> PacketStatsMap; | 168 typedef std::map<CastLoggingEvent, PacketLogStats > PacketStatsMap; |
143 typedef std::map<CastLoggingEvent, double> GenericStatsMap; | 169 typedef std::map<CastLoggingEvent, GenericLogStats > GenericStatsMap; |
144 | 170 |
145 } // namespace cast | 171 } // namespace cast |
146 } // namespace media | 172 } // namespace media |
147 | 173 |
148 #endif // MEDIA_CAST_LOGGING_LOGGING_DEFINES_H_ | 174 #endif // MEDIA_CAST_LOGGING_LOGGING_DEFINES_H_ |
OLD | NEW |