OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
66 if (str.size() > 2 && | 66 if (str.size() > 2 && |
67 (str.substr(0, 2) == "0x" || str.substr(0, 2) == "0X")) { | 67 (str.substr(0, 2) == "0x" || str.substr(0, 2) == "0X")) { |
68 read_mode = std::hex; | 68 read_mode = std::hex; |
69 str = str.substr(2); | 69 str = str.substr(2); |
70 } | 70 } |
71 std::stringstream ss(str); | 71 std::stringstream ss(str); |
72 ss >> read_mode >> filtered_ssrc; | 72 ss >> read_mode >> filtered_ssrc; |
73 return str.empty() || (!ss.fail() && ss.eof()); | 73 return str.empty() || (!ss.fail() && ss.eof()); |
74 } | 74 } |
75 | 75 |
76 // Struct used for storing all SSRCs used in a Stream. | |
terelius
2017/05/19 11:55:59
Why "all"? The struct only holds one SSRC.
perkj_webrtc
2017/05/19 12:02:52
Done.
| |
77 struct Stream { | |
78 Stream(uint32_t ssrc, | |
79 webrtc::MediaType media_type, | |
80 webrtc::PacketDirection direction) | |
81 : ssrc(ssrc), media_type(media_type), direction(direction) {} | |
82 uint32_t ssrc; | |
83 webrtc::MediaType media_type; | |
84 webrtc::PacketDirection direction; | |
85 }; | |
86 | |
87 // All configured streams found in the event log. | |
88 std::vector<Stream> global_streams; | |
89 | |
90 // Returns the MediaType for registered SSRCs. Search from the end to use last | |
91 // registered types first. | |
92 webrtc::MediaType GetMediaType(uint32_t ssrc, | |
93 webrtc::PacketDirection direction) { | |
94 for (auto rit = global_streams.rbegin(); rit != global_streams.rend(); | |
95 ++rit) { | |
96 if (rit->ssrc == ssrc && rit->direction == direction) | |
97 return rit->media_type; | |
98 } | |
99 return webrtc::MediaType::ANY; | |
100 } | |
101 | |
76 bool ExcludePacket(webrtc::PacketDirection direction, | 102 bool ExcludePacket(webrtc::PacketDirection direction, |
77 webrtc::MediaType media_type, | 103 webrtc::MediaType media_type, |
78 uint32_t packet_ssrc) { | 104 uint32_t packet_ssrc) { |
79 if (FLAGS_nooutgoing && direction == webrtc::kOutgoingPacket) | 105 if (FLAGS_nooutgoing && direction == webrtc::kOutgoingPacket) |
80 return true; | 106 return true; |
81 if (FLAGS_noincoming && direction == webrtc::kIncomingPacket) | 107 if (FLAGS_noincoming && direction == webrtc::kIncomingPacket) |
82 return true; | 108 return true; |
83 if (FLAGS_noaudio && media_type == webrtc::MediaType::AUDIO) | 109 if (FLAGS_noaudio && media_type == webrtc::MediaType::AUDIO) |
84 return true; | 110 return true; |
85 if (FLAGS_novideo && media_type == webrtc::MediaType::VIDEO) | 111 if (FLAGS_novideo && media_type == webrtc::MediaType::VIDEO) |
(...skipping 25 matching lines...) Expand all Loading... | |
111 else if (media_type == webrtc::MediaType::DATA) | 137 else if (media_type == webrtc::MediaType::DATA) |
112 return "(in,data)"; | 138 return "(in,data)"; |
113 else | 139 else |
114 return "(in)"; | 140 return "(in)"; |
115 } | 141 } |
116 return "(unknown)"; | 142 return "(unknown)"; |
117 } | 143 } |
118 | 144 |
119 void PrintSenderReport(const webrtc::rtcp::CommonHeader& rtcp_block, | 145 void PrintSenderReport(const webrtc::rtcp::CommonHeader& rtcp_block, |
120 uint64_t log_timestamp, | 146 uint64_t log_timestamp, |
121 webrtc::PacketDirection direction, | 147 webrtc::PacketDirection direction) { |
122 webrtc::MediaType media_type) { | |
123 webrtc::rtcp::SenderReport sr; | 148 webrtc::rtcp::SenderReport sr; |
124 if (!sr.Parse(rtcp_block)) | 149 if (!sr.Parse(rtcp_block)) |
125 return; | 150 return; |
151 webrtc::MediaType media_type = GetMediaType(sr.sender_ssrc(), direction); | |
126 if (ExcludePacket(direction, media_type, sr.sender_ssrc())) | 152 if (ExcludePacket(direction, media_type, sr.sender_ssrc())) |
127 return; | 153 return; |
128 std::cout << log_timestamp << "\t" | 154 std::cout << log_timestamp << "\t" |
129 << "RTCP_SR" << StreamInfo(direction, media_type) | 155 << "RTCP_SR" << StreamInfo(direction, media_type) |
130 << "\tssrc=" << sr.sender_ssrc() | 156 << "\tssrc=" << sr.sender_ssrc() |
131 << "\ttimestamp=" << sr.rtp_timestamp() << std::endl; | 157 << "\ttimestamp=" << sr.rtp_timestamp() << std::endl; |
132 } | 158 } |
133 | 159 |
134 void PrintReceiverReport(const webrtc::rtcp::CommonHeader& rtcp_block, | 160 void PrintReceiverReport(const webrtc::rtcp::CommonHeader& rtcp_block, |
135 uint64_t log_timestamp, | 161 uint64_t log_timestamp, |
136 webrtc::PacketDirection direction, | 162 webrtc::PacketDirection direction) { |
137 webrtc::MediaType media_type) { | |
138 webrtc::rtcp::ReceiverReport rr; | 163 webrtc::rtcp::ReceiverReport rr; |
139 if (!rr.Parse(rtcp_block)) | 164 if (!rr.Parse(rtcp_block)) |
140 return; | 165 return; |
166 webrtc::MediaType media_type = GetMediaType(rr.sender_ssrc(), direction); | |
141 if (ExcludePacket(direction, media_type, rr.sender_ssrc())) | 167 if (ExcludePacket(direction, media_type, rr.sender_ssrc())) |
142 return; | 168 return; |
143 std::cout << log_timestamp << "\t" | 169 std::cout << log_timestamp << "\t" |
144 << "RTCP_RR" << StreamInfo(direction, media_type) | 170 << "RTCP_RR" << StreamInfo(direction, media_type) |
145 << "\tssrc=" << rr.sender_ssrc() << std::endl; | 171 << "\tssrc=" << rr.sender_ssrc() << std::endl; |
146 } | 172 } |
147 | 173 |
148 void PrintXr(const webrtc::rtcp::CommonHeader& rtcp_block, | 174 void PrintXr(const webrtc::rtcp::CommonHeader& rtcp_block, |
149 uint64_t log_timestamp, | 175 uint64_t log_timestamp, |
150 webrtc::PacketDirection direction, | 176 webrtc::PacketDirection direction) { |
151 webrtc::MediaType media_type) { | |
152 webrtc::rtcp::ExtendedReports xr; | 177 webrtc::rtcp::ExtendedReports xr; |
153 if (!xr.Parse(rtcp_block)) | 178 if (!xr.Parse(rtcp_block)) |
154 return; | 179 return; |
180 webrtc::MediaType media_type = GetMediaType(xr.sender_ssrc(), direction); | |
155 if (ExcludePacket(direction, media_type, xr.sender_ssrc())) | 181 if (ExcludePacket(direction, media_type, xr.sender_ssrc())) |
156 return; | 182 return; |
157 std::cout << log_timestamp << "\t" | 183 std::cout << log_timestamp << "\t" |
158 << "RTCP_XR" << StreamInfo(direction, media_type) | 184 << "RTCP_XR" << StreamInfo(direction, media_type) |
159 << "\tssrc=" << xr.sender_ssrc() << std::endl; | 185 << "\tssrc=" << xr.sender_ssrc() << std::endl; |
160 } | 186 } |
161 | 187 |
162 void PrintSdes(const webrtc::rtcp::CommonHeader& rtcp_block, | 188 void PrintSdes(const webrtc::rtcp::CommonHeader& rtcp_block, |
163 uint64_t log_timestamp, | 189 uint64_t log_timestamp, |
164 webrtc::PacketDirection direction, | 190 webrtc::PacketDirection direction) { |
165 webrtc::MediaType media_type) { | |
166 std::cout << log_timestamp << "\t" | 191 std::cout << log_timestamp << "\t" |
167 << "RTCP_SDES" << StreamInfo(direction, media_type) << std::endl; | 192 << "RTCP_SDES" << StreamInfo(direction, webrtc::MediaType::ANY) |
193 << std::endl; | |
168 RTC_NOTREACHED() << "SDES should have been redacted when writing the log"; | 194 RTC_NOTREACHED() << "SDES should have been redacted when writing the log"; |
169 } | 195 } |
170 | 196 |
171 void PrintBye(const webrtc::rtcp::CommonHeader& rtcp_block, | 197 void PrintBye(const webrtc::rtcp::CommonHeader& rtcp_block, |
172 uint64_t log_timestamp, | 198 uint64_t log_timestamp, |
173 webrtc::PacketDirection direction, | 199 webrtc::PacketDirection direction) { |
174 webrtc::MediaType media_type) { | |
175 webrtc::rtcp::Bye bye; | 200 webrtc::rtcp::Bye bye; |
176 if (!bye.Parse(rtcp_block)) | 201 if (!bye.Parse(rtcp_block)) |
177 return; | 202 return; |
203 webrtc::MediaType media_type = GetMediaType(bye.sender_ssrc(), direction); | |
178 if (ExcludePacket(direction, media_type, bye.sender_ssrc())) | 204 if (ExcludePacket(direction, media_type, bye.sender_ssrc())) |
179 return; | 205 return; |
180 std::cout << log_timestamp << "\t" | 206 std::cout << log_timestamp << "\t" |
181 << "RTCP_BYE" << StreamInfo(direction, media_type) | 207 << "RTCP_BYE" << StreamInfo(direction, media_type) |
182 << "\tssrc=" << bye.sender_ssrc() << std::endl; | 208 << "\tssrc=" << bye.sender_ssrc() << std::endl; |
183 } | 209 } |
184 | 210 |
185 void PrintRtpFeedback(const webrtc::rtcp::CommonHeader& rtcp_block, | 211 void PrintRtpFeedback(const webrtc::rtcp::CommonHeader& rtcp_block, |
186 uint64_t log_timestamp, | 212 uint64_t log_timestamp, |
187 webrtc::PacketDirection direction, | 213 webrtc::PacketDirection direction) { |
188 webrtc::MediaType media_type) { | |
189 switch (rtcp_block.fmt()) { | 214 switch (rtcp_block.fmt()) { |
190 case webrtc::rtcp::Nack::kFeedbackMessageType: { | 215 case webrtc::rtcp::Nack::kFeedbackMessageType: { |
191 webrtc::rtcp::Nack nack; | 216 webrtc::rtcp::Nack nack; |
192 if (!nack.Parse(rtcp_block)) | 217 if (!nack.Parse(rtcp_block)) |
193 return; | 218 return; |
219 webrtc::MediaType media_type = | |
220 GetMediaType(nack.sender_ssrc(), direction); | |
194 if (ExcludePacket(direction, media_type, nack.sender_ssrc())) | 221 if (ExcludePacket(direction, media_type, nack.sender_ssrc())) |
195 return; | 222 return; |
196 std::cout << log_timestamp << "\t" | 223 std::cout << log_timestamp << "\t" |
197 << "RTCP_NACK" << StreamInfo(direction, media_type) | 224 << "RTCP_NACK" << StreamInfo(direction, media_type) |
198 << "\tssrc=" << nack.sender_ssrc() << std::endl; | 225 << "\tssrc=" << nack.sender_ssrc() << std::endl; |
199 break; | 226 break; |
200 } | 227 } |
201 case webrtc::rtcp::Tmmbr::kFeedbackMessageType: { | 228 case webrtc::rtcp::Tmmbr::kFeedbackMessageType: { |
202 webrtc::rtcp::Tmmbr tmmbr; | 229 webrtc::rtcp::Tmmbr tmmbr; |
203 if (!tmmbr.Parse(rtcp_block)) | 230 if (!tmmbr.Parse(rtcp_block)) |
204 return; | 231 return; |
232 webrtc::MediaType media_type = | |
233 GetMediaType(tmmbr.sender_ssrc(), direction); | |
205 if (ExcludePacket(direction, media_type, tmmbr.sender_ssrc())) | 234 if (ExcludePacket(direction, media_type, tmmbr.sender_ssrc())) |
206 return; | 235 return; |
207 std::cout << log_timestamp << "\t" | 236 std::cout << log_timestamp << "\t" |
208 << "RTCP_TMMBR" << StreamInfo(direction, media_type) | 237 << "RTCP_TMMBR" << StreamInfo(direction, media_type) |
209 << "\tssrc=" << tmmbr.sender_ssrc() << std::endl; | 238 << "\tssrc=" << tmmbr.sender_ssrc() << std::endl; |
210 break; | 239 break; |
211 } | 240 } |
212 case webrtc::rtcp::Tmmbn::kFeedbackMessageType: { | 241 case webrtc::rtcp::Tmmbn::kFeedbackMessageType: { |
213 webrtc::rtcp::Tmmbn tmmbn; | 242 webrtc::rtcp::Tmmbn tmmbn; |
214 if (!tmmbn.Parse(rtcp_block)) | 243 if (!tmmbn.Parse(rtcp_block)) |
215 return; | 244 return; |
245 webrtc::MediaType media_type = | |
246 GetMediaType(tmmbn.sender_ssrc(), direction); | |
216 if (ExcludePacket(direction, media_type, tmmbn.sender_ssrc())) | 247 if (ExcludePacket(direction, media_type, tmmbn.sender_ssrc())) |
217 return; | 248 return; |
218 std::cout << log_timestamp << "\t" | 249 std::cout << log_timestamp << "\t" |
219 << "RTCP_TMMBN" << StreamInfo(direction, media_type) | 250 << "RTCP_TMMBN" << StreamInfo(direction, media_type) |
220 << "\tssrc=" << tmmbn.sender_ssrc() << std::endl; | 251 << "\tssrc=" << tmmbn.sender_ssrc() << std::endl; |
221 break; | 252 break; |
222 } | 253 } |
223 case webrtc::rtcp::RapidResyncRequest::kFeedbackMessageType: { | 254 case webrtc::rtcp::RapidResyncRequest::kFeedbackMessageType: { |
224 webrtc::rtcp::RapidResyncRequest sr_req; | 255 webrtc::rtcp::RapidResyncRequest sr_req; |
225 if (!sr_req.Parse(rtcp_block)) | 256 if (!sr_req.Parse(rtcp_block)) |
226 return; | 257 return; |
258 webrtc::MediaType media_type = | |
259 GetMediaType(sr_req.sender_ssrc(), direction); | |
227 if (ExcludePacket(direction, media_type, sr_req.sender_ssrc())) | 260 if (ExcludePacket(direction, media_type, sr_req.sender_ssrc())) |
228 return; | 261 return; |
229 std::cout << log_timestamp << "\t" | 262 std::cout << log_timestamp << "\t" |
230 << "RTCP_SRREQ" << StreamInfo(direction, media_type) | 263 << "RTCP_SRREQ" << StreamInfo(direction, media_type) |
231 << "\tssrc=" << sr_req.sender_ssrc() << std::endl; | 264 << "\tssrc=" << sr_req.sender_ssrc() << std::endl; |
232 break; | 265 break; |
233 } | 266 } |
234 case webrtc::rtcp::TransportFeedback::kFeedbackMessageType: { | 267 case webrtc::rtcp::TransportFeedback::kFeedbackMessageType: { |
235 webrtc::rtcp::TransportFeedback transport_feedback; | 268 webrtc::rtcp::TransportFeedback transport_feedback; |
236 if (!transport_feedback.Parse(rtcp_block)) | 269 if (!transport_feedback.Parse(rtcp_block)) |
237 return; | 270 return; |
271 webrtc::MediaType media_type = | |
272 GetMediaType(transport_feedback.sender_ssrc(), direction); | |
238 if (ExcludePacket(direction, media_type, | 273 if (ExcludePacket(direction, media_type, |
239 transport_feedback.sender_ssrc())) | 274 transport_feedback.sender_ssrc())) |
240 return; | 275 return; |
241 std::cout << log_timestamp << "\t" | 276 std::cout << log_timestamp << "\t" |
242 << "RTCP_NEWFB" << StreamInfo(direction, media_type) | 277 << "RTCP_NEWFB" << StreamInfo(direction, media_type) |
243 << "\tssrc=" << transport_feedback.sender_ssrc() << std::endl; | 278 << "\tssrc=" << transport_feedback.sender_ssrc() << std::endl; |
244 break; | 279 break; |
245 } | 280 } |
246 default: | 281 default: |
247 break; | 282 break; |
248 } | 283 } |
249 } | 284 } |
250 | 285 |
251 void PrintPsFeedback(const webrtc::rtcp::CommonHeader& rtcp_block, | 286 void PrintPsFeedback(const webrtc::rtcp::CommonHeader& rtcp_block, |
252 uint64_t log_timestamp, | 287 uint64_t log_timestamp, |
253 webrtc::PacketDirection direction, | 288 webrtc::PacketDirection direction) { |
254 webrtc::MediaType media_type) { | |
255 switch (rtcp_block.fmt()) { | 289 switch (rtcp_block.fmt()) { |
256 case webrtc::rtcp::Pli::kFeedbackMessageType: { | 290 case webrtc::rtcp::Pli::kFeedbackMessageType: { |
257 webrtc::rtcp::Pli pli; | 291 webrtc::rtcp::Pli pli; |
258 if (!pli.Parse(rtcp_block)) | 292 if (!pli.Parse(rtcp_block)) |
259 return; | 293 return; |
294 webrtc::MediaType media_type = GetMediaType(pli.sender_ssrc(), direction); | |
260 if (ExcludePacket(direction, media_type, pli.sender_ssrc())) | 295 if (ExcludePacket(direction, media_type, pli.sender_ssrc())) |
261 return; | 296 return; |
262 std::cout << log_timestamp << "\t" | 297 std::cout << log_timestamp << "\t" |
263 << "RTCP_PLI" << StreamInfo(direction, media_type) | 298 << "RTCP_PLI" << StreamInfo(direction, media_type) |
264 << "\tssrc=" << pli.sender_ssrc() << std::endl; | 299 << "\tssrc=" << pli.sender_ssrc() << std::endl; |
265 break; | 300 break; |
266 } | 301 } |
267 case webrtc::rtcp::Fir::kFeedbackMessageType: { | 302 case webrtc::rtcp::Fir::kFeedbackMessageType: { |
268 webrtc::rtcp::Fir fir; | 303 webrtc::rtcp::Fir fir; |
269 if (!fir.Parse(rtcp_block)) | 304 if (!fir.Parse(rtcp_block)) |
270 return; | 305 return; |
306 webrtc::MediaType media_type = GetMediaType(fir.sender_ssrc(), direction); | |
271 if (ExcludePacket(direction, media_type, fir.sender_ssrc())) | 307 if (ExcludePacket(direction, media_type, fir.sender_ssrc())) |
272 return; | 308 return; |
273 std::cout << log_timestamp << "\t" | 309 std::cout << log_timestamp << "\t" |
274 << "RTCP_FIR" << StreamInfo(direction, media_type) | 310 << "RTCP_FIR" << StreamInfo(direction, media_type) |
275 << "\tssrc=" << fir.sender_ssrc() << std::endl; | 311 << "\tssrc=" << fir.sender_ssrc() << std::endl; |
276 break; | 312 break; |
277 } | 313 } |
278 case webrtc::rtcp::Remb::kFeedbackMessageType: { | 314 case webrtc::rtcp::Remb::kFeedbackMessageType: { |
279 webrtc::rtcp::Remb remb; | 315 webrtc::rtcp::Remb remb; |
280 if (!remb.Parse(rtcp_block)) | 316 if (!remb.Parse(rtcp_block)) |
281 return; | 317 return; |
318 webrtc::MediaType media_type = | |
319 GetMediaType(remb.sender_ssrc(), direction); | |
282 if (ExcludePacket(direction, media_type, remb.sender_ssrc())) | 320 if (ExcludePacket(direction, media_type, remb.sender_ssrc())) |
283 return; | 321 return; |
284 std::cout << log_timestamp << "\t" | 322 std::cout << log_timestamp << "\t" |
285 << "RTCP_REMB" << StreamInfo(direction, media_type) | 323 << "RTCP_REMB" << StreamInfo(direction, media_type) |
286 << "\tssrc=" << remb.sender_ssrc() << std::endl; | 324 << "\tssrc=" << remb.sender_ssrc() << std::endl; |
287 break; | 325 break; |
288 } | 326 } |
289 default: | 327 default: |
290 break; | 328 break; |
291 } | 329 } |
(...skipping 25 matching lines...) Expand all Loading... | |
317 if (!FLAGS_ssrc.empty()) | 355 if (!FLAGS_ssrc.empty()) |
318 RTC_CHECK(ParseSsrc(FLAGS_ssrc)) << "Flag verification has failed."; | 356 RTC_CHECK(ParseSsrc(FLAGS_ssrc)) << "Flag verification has failed."; |
319 | 357 |
320 webrtc::ParsedRtcEventLog parsed_stream; | 358 webrtc::ParsedRtcEventLog parsed_stream; |
321 if (!parsed_stream.ParseFile(input_file)) { | 359 if (!parsed_stream.ParseFile(input_file)) { |
322 std::cerr << "Error while parsing input file: " << input_file << std::endl; | 360 std::cerr << "Error while parsing input file: " << input_file << std::endl; |
323 return -1; | 361 return -1; |
324 } | 362 } |
325 | 363 |
326 for (size_t i = 0; i < parsed_stream.GetNumberOfEvents(); i++) { | 364 for (size_t i = 0; i < parsed_stream.GetNumberOfEvents(); i++) { |
327 if (!FLAGS_noconfig && !FLAGS_novideo && !FLAGS_noincoming && | 365 if (parsed_stream.GetEventType(i) == |
328 parsed_stream.GetEventType(i) == | 366 webrtc::ParsedRtcEventLog::VIDEO_RECEIVER_CONFIG_EVENT) { |
329 webrtc::ParsedRtcEventLog::VIDEO_RECEIVER_CONFIG_EVENT) { | |
330 webrtc::VideoReceiveStream::Config config(nullptr); | 367 webrtc::VideoReceiveStream::Config config(nullptr); |
331 parsed_stream.GetVideoReceiveConfig(i, &config); | 368 parsed_stream.GetVideoReceiveConfig(i, &config); |
332 std::cout << parsed_stream.GetTimestamp(i) << "\tVIDEO_RECV_CONFIG" | 369 |
333 << "\tssrc=" << config.rtp.remote_ssrc | 370 global_streams.emplace_back(config.rtp.remote_ssrc, |
334 << "\tfeedback_ssrc=" << config.rtp.local_ssrc << std::endl; | 371 webrtc::MediaType::VIDEO, |
372 webrtc::kIncomingPacket); | |
373 global_streams.emplace_back(config.rtp.local_ssrc, | |
374 webrtc::MediaType::VIDEO, | |
375 webrtc::kOutgoingPacket); | |
376 | |
377 if (!FLAGS_noconfig && !FLAGS_novideo && !FLAGS_noincoming) { | |
378 std::cout << parsed_stream.GetTimestamp(i) << "\tVIDEO_RECV_CONFIG" | |
379 << "\tssrc=" << config.rtp.remote_ssrc | |
380 << "\tfeedback_ssrc=" << config.rtp.local_ssrc << std::endl; | |
381 } | |
335 } | 382 } |
336 if (!FLAGS_noconfig && !FLAGS_novideo && !FLAGS_nooutgoing && | 383 if (parsed_stream.GetEventType(i) == |
337 parsed_stream.GetEventType(i) == | 384 webrtc::ParsedRtcEventLog::VIDEO_SENDER_CONFIG_EVENT) { |
338 webrtc::ParsedRtcEventLog::VIDEO_SENDER_CONFIG_EVENT) { | |
339 webrtc::VideoSendStream::Config config(nullptr); | 385 webrtc::VideoSendStream::Config config(nullptr); |
340 parsed_stream.GetVideoSendConfig(i, &config); | 386 parsed_stream.GetVideoSendConfig(i, &config); |
341 std::cout << parsed_stream.GetTimestamp(i) << "\tVIDEO_SEND_CONFIG"; | 387 |
342 std::cout << "\tssrcs="; | 388 for (uint32_t ssrc : config.rtp.ssrcs) { |
343 for (const auto& ssrc : config.rtp.ssrcs) | 389 global_streams.emplace_back(ssrc, webrtc::MediaType::VIDEO, |
344 std::cout << ssrc << ','; | 390 webrtc::kOutgoingPacket); |
345 std::cout << "\trtx_ssrcs="; | 391 } |
346 for (const auto& ssrc : config.rtp.rtx.ssrcs) | 392 for (uint32_t ssrc : config.rtp.rtx.ssrcs) { |
347 std::cout << ssrc << ','; | 393 global_streams.emplace_back(ssrc, webrtc::MediaType::VIDEO, |
348 std::cout << std::endl; | 394 webrtc::kOutgoingPacket); |
395 } | |
396 if (config.rtp.flexfec.ssrc > 0) { | |
terelius
2017/05/19 11:55:59
We don't log FlexFEC SSRCs, so this is always goin
perkj_webrtc
2017/05/19 12:02:52
removed.
| |
397 global_streams.emplace_back(config.rtp.flexfec.ssrc, | |
398 webrtc::MediaType::VIDEO, | |
399 webrtc::kOutgoingPacket); | |
400 } | |
401 | |
402 if (!FLAGS_noconfig && !FLAGS_novideo && !FLAGS_nooutgoing) { | |
403 std::cout << parsed_stream.GetTimestamp(i) << "\tVIDEO_SEND_CONFIG"; | |
404 std::cout << "\tssrcs="; | |
405 for (const auto& ssrc : config.rtp.ssrcs) | |
406 std::cout << ssrc << ','; | |
407 std::cout << "\trtx_ssrcs="; | |
408 for (const auto& ssrc : config.rtp.rtx.ssrcs) | |
409 std::cout << ssrc << ','; | |
410 std::cout << std::endl; | |
411 } | |
349 } | 412 } |
350 if (!FLAGS_noconfig && !FLAGS_noaudio && !FLAGS_noincoming && | 413 if (parsed_stream.GetEventType(i) == |
351 parsed_stream.GetEventType(i) == | 414 webrtc::ParsedRtcEventLog::AUDIO_RECEIVER_CONFIG_EVENT) { |
352 webrtc::ParsedRtcEventLog::AUDIO_RECEIVER_CONFIG_EVENT) { | |
353 webrtc::AudioReceiveStream::Config config; | 415 webrtc::AudioReceiveStream::Config config; |
354 parsed_stream.GetAudioReceiveConfig(i, &config); | 416 parsed_stream.GetAudioReceiveConfig(i, &config); |
355 std::cout << parsed_stream.GetTimestamp(i) << "\tAUDIO_RECV_CONFIG" | 417 global_streams.emplace_back(config.rtp.remote_ssrc, |
356 << "\tssrc=" << config.rtp.remote_ssrc | 418 webrtc::MediaType::AUDIO, |
357 << "\tfeedback_ssrc=" << config.rtp.local_ssrc << std::endl; | 419 webrtc::kIncomingPacket); |
420 global_streams.emplace_back(config.rtp.local_ssrc, | |
421 webrtc::MediaType::AUDIO, | |
422 webrtc::kOutgoingPacket); | |
423 if (!FLAGS_noconfig && !FLAGS_noaudio && !FLAGS_noincoming) { | |
424 std::cout << parsed_stream.GetTimestamp(i) << "\tAUDIO_RECV_CONFIG" | |
425 << "\tssrc=" << config.rtp.remote_ssrc | |
426 << "\tfeedback_ssrc=" << config.rtp.local_ssrc << std::endl; | |
427 } | |
358 } | 428 } |
359 if (!FLAGS_noconfig && !FLAGS_noaudio && !FLAGS_nooutgoing && | 429 if (parsed_stream.GetEventType(i) == |
360 parsed_stream.GetEventType(i) == | 430 webrtc::ParsedRtcEventLog::AUDIO_SENDER_CONFIG_EVENT) { |
361 webrtc::ParsedRtcEventLog::AUDIO_SENDER_CONFIG_EVENT) { | |
362 webrtc::AudioSendStream::Config config(nullptr); | 431 webrtc::AudioSendStream::Config config(nullptr); |
363 parsed_stream.GetAudioSendConfig(i, &config); | 432 parsed_stream.GetAudioSendConfig(i, &config); |
364 std::cout << parsed_stream.GetTimestamp(i) << "\tAUDIO_SEND_CONFIG" | 433 global_streams.emplace_back(config.rtp.ssrc, webrtc::MediaType::AUDIO, |
365 << "\tssrc=" << config.rtp.ssrc << std::endl; | 434 webrtc::kOutgoingPacket); |
435 if (!FLAGS_noconfig && !FLAGS_noaudio && !FLAGS_nooutgoing) { | |
436 std::cout << parsed_stream.GetTimestamp(i) << "\tAUDIO_SEND_CONFIG" | |
437 << "\tssrc=" << config.rtp.ssrc << std::endl; | |
438 } | |
366 } | 439 } |
367 if (!FLAGS_nortp && | 440 if (!FLAGS_nortp && |
368 parsed_stream.GetEventType(i) == webrtc::ParsedRtcEventLog::RTP_EVENT) { | 441 parsed_stream.GetEventType(i) == webrtc::ParsedRtcEventLog::RTP_EVENT) { |
369 size_t header_length; | 442 size_t header_length; |
370 size_t total_length; | 443 size_t total_length; |
371 uint8_t header[IP_PACKET_SIZE]; | 444 uint8_t header[IP_PACKET_SIZE]; |
372 webrtc::PacketDirection direction; | 445 webrtc::PacketDirection direction; |
373 webrtc::MediaType media_type; | 446 webrtc::MediaType media_type; |
374 parsed_stream.GetRtpHeader(i, &direction, &media_type, header, | 447 parsed_stream.GetRtpHeader(i, &direction, &media_type, header, |
375 &header_length, &total_length); | 448 &header_length, &total_length); |
376 | 449 |
377 // Parse header to get SSRC and RTP time. | 450 // Parse header to get SSRC and RTP time. |
378 webrtc::RtpUtility::RtpHeaderParser rtp_parser(header, header_length); | 451 webrtc::RtpUtility::RtpHeaderParser rtp_parser(header, header_length); |
379 webrtc::RTPHeader parsed_header; | 452 webrtc::RTPHeader parsed_header; |
380 rtp_parser.Parse(&parsed_header); | 453 rtp_parser.Parse(&parsed_header); |
454 media_type = GetMediaType(parsed_header.ssrc, direction); | |
381 | 455 |
382 if (ExcludePacket(direction, media_type, parsed_header.ssrc)) | 456 if (ExcludePacket(direction, media_type, parsed_header.ssrc)) |
383 continue; | 457 continue; |
384 | 458 |
385 std::cout << parsed_stream.GetTimestamp(i) << "\tRTP" | 459 std::cout << parsed_stream.GetTimestamp(i) << "\tRTP" |
386 << StreamInfo(direction, media_type) | 460 << StreamInfo(direction, media_type) |
387 << "\tssrc=" << parsed_header.ssrc | 461 << "\tssrc=" << parsed_header.ssrc |
388 << "\ttimestamp=" << parsed_header.timestamp << std::endl; | 462 << "\ttimestamp=" << parsed_header.timestamp << std::endl; |
389 } | 463 } |
390 if (!FLAGS_nortcp && | 464 if (!FLAGS_nortcp && |
(...skipping 11 matching lines...) Expand all Loading... | |
402 next_block = rtcp_block.NextPacket()) { | 476 next_block = rtcp_block.NextPacket()) { |
403 ptrdiff_t remaining_blocks_size = packet_end - next_block; | 477 ptrdiff_t remaining_blocks_size = packet_end - next_block; |
404 RTC_DCHECK_GT(remaining_blocks_size, 0); | 478 RTC_DCHECK_GT(remaining_blocks_size, 0); |
405 if (!rtcp_block.Parse(next_block, remaining_blocks_size)) { | 479 if (!rtcp_block.Parse(next_block, remaining_blocks_size)) { |
406 break; | 480 break; |
407 } | 481 } |
408 | 482 |
409 uint64_t log_timestamp = parsed_stream.GetTimestamp(i); | 483 uint64_t log_timestamp = parsed_stream.GetTimestamp(i); |
410 switch (rtcp_block.type()) { | 484 switch (rtcp_block.type()) { |
411 case webrtc::rtcp::SenderReport::kPacketType: | 485 case webrtc::rtcp::SenderReport::kPacketType: |
412 PrintSenderReport(rtcp_block, log_timestamp, direction, media_type); | 486 PrintSenderReport(rtcp_block, log_timestamp, direction); |
413 break; | 487 break; |
414 case webrtc::rtcp::ReceiverReport::kPacketType: | 488 case webrtc::rtcp::ReceiverReport::kPacketType: |
415 PrintReceiverReport(rtcp_block, log_timestamp, direction, | 489 PrintReceiverReport(rtcp_block, log_timestamp, direction); |
416 media_type); | |
417 break; | 490 break; |
418 case webrtc::rtcp::Sdes::kPacketType: | 491 case webrtc::rtcp::Sdes::kPacketType: |
419 PrintSdes(rtcp_block, log_timestamp, direction, media_type); | 492 PrintSdes(rtcp_block, log_timestamp, direction); |
420 break; | 493 break; |
421 case webrtc::rtcp::ExtendedReports::kPacketType: | 494 case webrtc::rtcp::ExtendedReports::kPacketType: |
422 PrintXr(rtcp_block, log_timestamp, direction, media_type); | 495 PrintXr(rtcp_block, log_timestamp, direction); |
423 break; | 496 break; |
424 case webrtc::rtcp::Bye::kPacketType: | 497 case webrtc::rtcp::Bye::kPacketType: |
425 PrintBye(rtcp_block, log_timestamp, direction, media_type); | 498 PrintBye(rtcp_block, log_timestamp, direction); |
426 break; | 499 break; |
427 case webrtc::rtcp::Rtpfb::kPacketType: | 500 case webrtc::rtcp::Rtpfb::kPacketType: |
428 PrintRtpFeedback(rtcp_block, log_timestamp, direction, media_type); | 501 PrintRtpFeedback(rtcp_block, log_timestamp, direction); |
429 break; | 502 break; |
430 case webrtc::rtcp::Psfb::kPacketType: | 503 case webrtc::rtcp::Psfb::kPacketType: |
431 PrintPsFeedback(rtcp_block, log_timestamp, direction, media_type); | 504 PrintPsFeedback(rtcp_block, log_timestamp, direction); |
432 break; | 505 break; |
433 default: | 506 default: |
434 break; | 507 break; |
435 } | 508 } |
436 } | 509 } |
437 } | 510 } |
438 } | 511 } |
439 return 0; | 512 return 0; |
440 } | 513 } |
OLD | NEW |