Chromium Code Reviews| 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 22 matching lines...) Expand all Loading... | |
| 33 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbn.h" | 33 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbn.h" |
| 34 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbr.h" | 34 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/tmmbr.h" |
| 35 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h" | 35 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h" |
| 36 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extensions.h" | 36 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extensions.h" |
| 37 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" | 37 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" |
| 38 #include "webrtc/rtc_base/checks.h" | 38 #include "webrtc/rtc_base/checks.h" |
| 39 #include "webrtc/rtc_base/flags.h" | 39 #include "webrtc/rtc_base/flags.h" |
| 40 | 40 |
| 41 namespace { | 41 namespace { |
| 42 | 42 |
| 43 DEFINE_bool(noconfig, false, "Excludes stream configurations."); | 43 DEFINE_bool(config, true, "Excludes stream configurations."); |
|
oprypin_webrtc
2017/09/04 14:48:21
It seems like the descriptions are misleading now.
terelius
2017/09/05 11:26:28
Changed to "Includes/excludes \1" instead. Is this
oprypin_webrtc
2017/09/05 11:31:52
The problem is that people will not know how to us
terelius
2017/09/12 11:16:55
Oh, I see; the (intuitive) --config=false no longe
| |
| 44 DEFINE_bool(noincoming, false, "Excludes incoming packets."); | 44 DEFINE_bool(incoming, true, "Excludes incoming packets."); |
| 45 DEFINE_bool(nooutgoing, false, "Excludes outgoing packets."); | 45 DEFINE_bool(outgoing, true, "Excludes outgoing packets."); |
| 46 // TODO(terelius): Note that the media type doesn't work with outgoing packets. | 46 // TODO(terelius): Note that the media type doesn't work with outgoing packets. |
| 47 DEFINE_bool(noaudio, false, "Excludes audio packets."); | 47 DEFINE_bool(audio, true, "Excludes audio packets."); |
| 48 // TODO(terelius): Note that the media type doesn't work with outgoing packets. | 48 // TODO(terelius): Note that the media type doesn't work with outgoing packets. |
| 49 DEFINE_bool(novideo, false, "Excludes video packets."); | 49 DEFINE_bool(video, true, "Excludes video packets."); |
| 50 // TODO(terelius): Note that the media type doesn't work with outgoing packets. | 50 // TODO(terelius): Note that the media type doesn't work with outgoing packets. |
| 51 DEFINE_bool(nodata, false, "Excludes data packets."); | 51 DEFINE_bool(data, true, "Excludes data packets."); |
| 52 DEFINE_bool(nortp, false, "Excludes RTP packets."); | 52 DEFINE_bool(rtp, true, "Excludes RTP packets."); |
| 53 DEFINE_bool(nortcp, false, "Excludes RTCP packets."); | 53 DEFINE_bool(rtcp, true, "Excludes RTCP packets."); |
| 54 // TODO(terelius): Allow a list of SSRCs. | 54 // TODO(terelius): Allow a list of SSRCs. |
| 55 DEFINE_string(ssrc, | 55 DEFINE_string(ssrc, |
| 56 "", | 56 "", |
| 57 "Print only packets with this SSRC (decimal or hex, the latter " | 57 "Print only packets with this SSRC (decimal or hex, the latter " |
| 58 "starting with 0x)."); | 58 "starting with 0x)."); |
| 59 DEFINE_bool(help, false, "Prints this message."); | 59 DEFINE_bool(help, false, "Prints this message."); |
| 60 | 60 |
| 61 using MediaType = webrtc::ParsedRtcEventLog::MediaType; | 61 using MediaType = webrtc::ParsedRtcEventLog::MediaType; |
| 62 | 62 |
| 63 static uint32_t filtered_ssrc = 0; | 63 static uint32_t filtered_ssrc = 0; |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 77 str = str.substr(2); | 77 str = str.substr(2); |
| 78 } | 78 } |
| 79 std::stringstream ss(str); | 79 std::stringstream ss(str); |
| 80 ss >> read_mode >> filtered_ssrc; | 80 ss >> read_mode >> filtered_ssrc; |
| 81 return str.empty() || (!ss.fail() && ss.eof()); | 81 return str.empty() || (!ss.fail() && ss.eof()); |
| 82 } | 82 } |
| 83 | 83 |
| 84 bool ExcludePacket(webrtc::PacketDirection direction, | 84 bool ExcludePacket(webrtc::PacketDirection direction, |
| 85 MediaType media_type, | 85 MediaType media_type, |
| 86 uint32_t packet_ssrc) { | 86 uint32_t packet_ssrc) { |
| 87 if (FLAG_nooutgoing && direction == webrtc::kOutgoingPacket) | 87 if (!FLAG_outgoing && direction == webrtc::kOutgoingPacket) |
| 88 return true; | 88 return true; |
| 89 if (FLAG_noincoming && direction == webrtc::kIncomingPacket) | 89 if (!FLAG_incoming && direction == webrtc::kIncomingPacket) |
| 90 return true; | 90 return true; |
| 91 if (FLAG_noaudio && media_type == MediaType::AUDIO) | 91 if (!FLAG_audio && media_type == MediaType::AUDIO) |
| 92 return true; | 92 return true; |
| 93 if (FLAG_novideo && media_type == MediaType::VIDEO) | 93 if (!FLAG_video && media_type == MediaType::VIDEO) |
| 94 return true; | 94 return true; |
| 95 if (FLAG_nodata && media_type == MediaType::DATA) | 95 if (!FLAG_data && media_type == MediaType::DATA) |
| 96 return true; | 96 return true; |
| 97 if (strlen(FLAG_ssrc) > 0 && packet_ssrc != filtered_ssrc) | 97 if (strlen(FLAG_ssrc) > 0 && packet_ssrc != filtered_ssrc) |
| 98 return true; | 98 return true; |
| 99 return false; | 99 return false; |
| 100 } | 100 } |
| 101 | 101 |
| 102 const char* StreamInfo(webrtc::PacketDirection direction, | 102 const char* StreamInfo(webrtc::PacketDirection direction, |
| 103 MediaType media_type) { | 103 MediaType media_type) { |
| 104 if (direction == webrtc::kOutgoingPacket) { | 104 if (direction == webrtc::kOutgoingPacket) { |
| 105 if (media_type == MediaType::AUDIO) | 105 if (media_type == MediaType::AUDIO) |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 379 | 379 |
| 380 webrtc::RtpHeaderExtensionMap default_map = GetDefaultHeaderExtensionMap(); | 380 webrtc::RtpHeaderExtensionMap default_map = GetDefaultHeaderExtensionMap(); |
| 381 | 381 |
| 382 webrtc::ParsedRtcEventLog parsed_stream; | 382 webrtc::ParsedRtcEventLog parsed_stream; |
| 383 if (!parsed_stream.ParseFile(input_file)) { | 383 if (!parsed_stream.ParseFile(input_file)) { |
| 384 std::cerr << "Error while parsing input file: " << input_file << std::endl; | 384 std::cerr << "Error while parsing input file: " << input_file << std::endl; |
| 385 return -1; | 385 return -1; |
| 386 } | 386 } |
| 387 | 387 |
| 388 for (size_t i = 0; i < parsed_stream.GetNumberOfEvents(); i++) { | 388 for (size_t i = 0; i < parsed_stream.GetNumberOfEvents(); i++) { |
| 389 if (!FLAG_noconfig && !FLAG_novideo && !FLAG_noincoming && | 389 if (FLAG_config && !!FLAG_video && !!FLAG_incoming && |
| 390 parsed_stream.GetEventType(i) == | 390 parsed_stream.GetEventType(i) == |
| 391 webrtc::ParsedRtcEventLog::VIDEO_RECEIVER_CONFIG_EVENT) { | 391 webrtc::ParsedRtcEventLog::VIDEO_RECEIVER_CONFIG_EVENT) { |
| 392 webrtc::rtclog::StreamConfig config = | 392 webrtc::rtclog::StreamConfig config = |
| 393 parsed_stream.GetVideoReceiveConfig(i); | 393 parsed_stream.GetVideoReceiveConfig(i); |
| 394 std::cout << parsed_stream.GetTimestamp(i) << "\tVIDEO_RECV_CONFIG" | 394 std::cout << parsed_stream.GetTimestamp(i) << "\tVIDEO_RECV_CONFIG" |
| 395 << "\tssrc=" << config.remote_ssrc | 395 << "\tssrc=" << config.remote_ssrc |
| 396 << "\tfeedback_ssrc=" << config.local_ssrc; | 396 << "\tfeedback_ssrc=" << config.local_ssrc; |
| 397 std::cout << "\textensions={"; | 397 std::cout << "\textensions={"; |
| 398 for (const auto& extension : config.rtp_extensions) { | 398 for (const auto& extension : config.rtp_extensions) { |
| 399 std::cout << extension.ToString() << ","; | 399 std::cout << extension.ToString() << ","; |
| 400 } | 400 } |
| 401 std::cout << "}"; | 401 std::cout << "}"; |
| 402 std::cout << "\tcodecs={"; | 402 std::cout << "\tcodecs={"; |
| 403 for (const auto& codec : config.codecs) { | 403 for (const auto& codec : config.codecs) { |
| 404 std::cout << "{name: " << codec.payload_name | 404 std::cout << "{name: " << codec.payload_name |
| 405 << ", payload_type: " << codec.payload_type | 405 << ", payload_type: " << codec.payload_type |
| 406 << ", rtx_payload_type: " << codec.rtx_payload_type << "}"; | 406 << ", rtx_payload_type: " << codec.rtx_payload_type << "}"; |
| 407 } | 407 } |
| 408 std::cout << "}" << std::endl; | 408 std::cout << "}" << std::endl; |
| 409 } | 409 } |
| 410 if (!FLAG_noconfig && !FLAG_novideo && !FLAG_nooutgoing && | 410 if (!!FLAG_config && !!FLAG_video && !!FLAG_outgoing && |
| 411 parsed_stream.GetEventType(i) == | 411 parsed_stream.GetEventType(i) == |
| 412 webrtc::ParsedRtcEventLog::VIDEO_SENDER_CONFIG_EVENT) { | 412 webrtc::ParsedRtcEventLog::VIDEO_SENDER_CONFIG_EVENT) { |
| 413 std::vector<webrtc::rtclog::StreamConfig> configs = | 413 std::vector<webrtc::rtclog::StreamConfig> configs = |
| 414 parsed_stream.GetVideoSendConfig(i); | 414 parsed_stream.GetVideoSendConfig(i); |
| 415 for (const auto& config : configs) { | 415 for (const auto& config : configs) { |
| 416 std::cout << parsed_stream.GetTimestamp(i) << "\tVIDEO_SEND_CONFIG"; | 416 std::cout << parsed_stream.GetTimestamp(i) << "\tVIDEO_SEND_CONFIG"; |
| 417 std::cout << "\tssrcs=" << config.local_ssrc; | 417 std::cout << "\tssrcs=" << config.local_ssrc; |
| 418 std::cout << "\trtx_ssrcs=" << config.rtx_ssrc; | 418 std::cout << "\trtx_ssrcs=" << config.rtx_ssrc; |
| 419 std::cout << "\textensions={"; | 419 std::cout << "\textensions={"; |
| 420 for (const auto& extension : config.rtp_extensions) { | 420 for (const auto& extension : config.rtp_extensions) { |
| 421 std::cout << extension.ToString() << ","; | 421 std::cout << extension.ToString() << ","; |
| 422 } | 422 } |
| 423 std::cout << "}"; | 423 std::cout << "}"; |
| 424 std::cout << "\tcodecs={"; | 424 std::cout << "\tcodecs={"; |
| 425 for (const auto& codec : config.codecs) { | 425 for (const auto& codec : config.codecs) { |
| 426 std::cout << "{name: " << codec.payload_name | 426 std::cout << "{name: " << codec.payload_name |
| 427 << ", payload_type: " << codec.payload_type | 427 << ", payload_type: " << codec.payload_type |
| 428 << ", rtx_payload_type: " << codec.rtx_payload_type << "}"; | 428 << ", rtx_payload_type: " << codec.rtx_payload_type << "}"; |
| 429 } | 429 } |
| 430 std::cout << "}" << std::endl; | 430 std::cout << "}" << std::endl; |
| 431 } | 431 } |
| 432 } | 432 } |
| 433 if (!FLAG_noconfig && !FLAG_noaudio && !FLAG_noincoming && | 433 if (!!FLAG_config && !!FLAG_audio && !!FLAG_incoming && |
| 434 parsed_stream.GetEventType(i) == | 434 parsed_stream.GetEventType(i) == |
| 435 webrtc::ParsedRtcEventLog::AUDIO_RECEIVER_CONFIG_EVENT) { | 435 webrtc::ParsedRtcEventLog::AUDIO_RECEIVER_CONFIG_EVENT) { |
| 436 webrtc::rtclog::StreamConfig config = | 436 webrtc::rtclog::StreamConfig config = |
| 437 parsed_stream.GetAudioReceiveConfig(i); | 437 parsed_stream.GetAudioReceiveConfig(i); |
| 438 std::cout << parsed_stream.GetTimestamp(i) << "\tAUDIO_RECV_CONFIG" | 438 std::cout << parsed_stream.GetTimestamp(i) << "\tAUDIO_RECV_CONFIG" |
| 439 << "\tssrc=" << config.remote_ssrc | 439 << "\tssrc=" << config.remote_ssrc |
| 440 << "\tfeedback_ssrc=" << config.local_ssrc; | 440 << "\tfeedback_ssrc=" << config.local_ssrc; |
| 441 std::cout << "\textensions={"; | 441 std::cout << "\textensions={"; |
| 442 for (const auto& extension : config.rtp_extensions) { | 442 for (const auto& extension : config.rtp_extensions) { |
| 443 std::cout << extension.ToString() << ","; | 443 std::cout << extension.ToString() << ","; |
| 444 } | 444 } |
| 445 std::cout << "}"; | 445 std::cout << "}"; |
| 446 std::cout << "\tcodecs={"; | 446 std::cout << "\tcodecs={"; |
| 447 for (const auto& codec : config.codecs) { | 447 for (const auto& codec : config.codecs) { |
| 448 std::cout << "{name: " << codec.payload_name | 448 std::cout << "{name: " << codec.payload_name |
| 449 << ", payload_type: " << codec.payload_type | 449 << ", payload_type: " << codec.payload_type |
| 450 << ", rtx_payload_type: " << codec.rtx_payload_type << "}"; | 450 << ", rtx_payload_type: " << codec.rtx_payload_type << "}"; |
| 451 } | 451 } |
| 452 std::cout << "}" << std::endl; | 452 std::cout << "}" << std::endl; |
| 453 } | 453 } |
| 454 if (!FLAG_noconfig && !FLAG_noaudio && !FLAG_nooutgoing && | 454 if (!!FLAG_config && !!FLAG_audio && !!FLAG_outgoing && |
| 455 parsed_stream.GetEventType(i) == | 455 parsed_stream.GetEventType(i) == |
| 456 webrtc::ParsedRtcEventLog::AUDIO_SENDER_CONFIG_EVENT) { | 456 webrtc::ParsedRtcEventLog::AUDIO_SENDER_CONFIG_EVENT) { |
| 457 webrtc::rtclog::StreamConfig config = parsed_stream.GetAudioSendConfig(i); | 457 webrtc::rtclog::StreamConfig config = parsed_stream.GetAudioSendConfig(i); |
| 458 std::cout << parsed_stream.GetTimestamp(i) << "\tAUDIO_SEND_CONFIG" | 458 std::cout << parsed_stream.GetTimestamp(i) << "\tAUDIO_SEND_CONFIG" |
| 459 << "\tssrc=" << config.local_ssrc; | 459 << "\tssrc=" << config.local_ssrc; |
| 460 std::cout << "\textensions={"; | 460 std::cout << "\textensions={"; |
| 461 for (const auto& extension : config.rtp_extensions) { | 461 for (const auto& extension : config.rtp_extensions) { |
| 462 std::cout << extension.ToString() << ","; | 462 std::cout << extension.ToString() << ","; |
| 463 } | 463 } |
| 464 std::cout << "}"; | 464 std::cout << "}"; |
| 465 std::cout << "\tcodecs={"; | 465 std::cout << "\tcodecs={"; |
| 466 for (const auto& codec : config.codecs) { | 466 for (const auto& codec : config.codecs) { |
| 467 std::cout << "{name: " << codec.payload_name | 467 std::cout << "{name: " << codec.payload_name |
| 468 << ", payload_type: " << codec.payload_type | 468 << ", payload_type: " << codec.payload_type |
| 469 << ", rtx_payload_type: " << codec.rtx_payload_type << "}"; | 469 << ", rtx_payload_type: " << codec.rtx_payload_type << "}"; |
| 470 } | 470 } |
| 471 std::cout << "}" << std::endl; | 471 std::cout << "}" << std::endl; |
| 472 } | 472 } |
| 473 if (!FLAG_nortp && | 473 if (!!FLAG_rtp && |
| 474 parsed_stream.GetEventType(i) == webrtc::ParsedRtcEventLog::RTP_EVENT) { | 474 parsed_stream.GetEventType(i) == webrtc::ParsedRtcEventLog::RTP_EVENT) { |
| 475 size_t header_length; | 475 size_t header_length; |
| 476 size_t total_length; | 476 size_t total_length; |
| 477 uint8_t header[IP_PACKET_SIZE]; | 477 uint8_t header[IP_PACKET_SIZE]; |
| 478 webrtc::PacketDirection direction; | 478 webrtc::PacketDirection direction; |
| 479 webrtc::RtpHeaderExtensionMap* extension_map = parsed_stream.GetRtpHeader( | 479 webrtc::RtpHeaderExtensionMap* extension_map = parsed_stream.GetRtpHeader( |
| 480 i, &direction, header, &header_length, &total_length); | 480 i, &direction, header, &header_length, &total_length); |
| 481 | 481 |
| 482 if (extension_map == nullptr) | 482 if (extension_map == nullptr) |
| 483 extension_map = &default_map; | 483 extension_map = &default_map; |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 514 } | 514 } |
| 515 if (parsed_header.extension.hasTransmissionTimeOffset) { | 515 if (parsed_header.extension.hasTransmissionTimeOffset) { |
| 516 std::cout << "\tTransmTimeOffset=" | 516 std::cout << "\tTransmTimeOffset=" |
| 517 << parsed_header.extension.transmissionTimeOffset; | 517 << parsed_header.extension.transmissionTimeOffset; |
| 518 } | 518 } |
| 519 if (parsed_header.extension.hasAudioLevel) { | 519 if (parsed_header.extension.hasAudioLevel) { |
| 520 std::cout << "\tAudioLevel=" << parsed_header.extension.audioLevel; | 520 std::cout << "\tAudioLevel=" << parsed_header.extension.audioLevel; |
| 521 } | 521 } |
| 522 std::cout << std::endl; | 522 std::cout << std::endl; |
| 523 } | 523 } |
| 524 if (!FLAG_nortcp && | 524 if (!!FLAG_rtcp && |
| 525 parsed_stream.GetEventType(i) == | 525 parsed_stream.GetEventType(i) == |
| 526 webrtc::ParsedRtcEventLog::RTCP_EVENT) { | 526 webrtc::ParsedRtcEventLog::RTCP_EVENT) { |
| 527 size_t length; | 527 size_t length; |
| 528 uint8_t packet[IP_PACKET_SIZE]; | 528 uint8_t packet[IP_PACKET_SIZE]; |
| 529 webrtc::PacketDirection direction; | 529 webrtc::PacketDirection direction; |
| 530 parsed_stream.GetRtcpPacket(i, &direction, packet, &length); | 530 parsed_stream.GetRtcpPacket(i, &direction, packet, &length); |
| 531 | 531 |
| 532 webrtc::rtcp::CommonHeader rtcp_block; | 532 webrtc::rtcp::CommonHeader rtcp_block; |
| 533 const uint8_t* packet_end = packet + length; | 533 const uint8_t* packet_end = packet + length; |
| 534 for (const uint8_t* next_block = packet; next_block != packet_end; | 534 for (const uint8_t* next_block = packet; next_block != packet_end; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 567 direction); | 567 direction); |
| 568 break; | 568 break; |
| 569 default: | 569 default: |
| 570 break; | 570 break; |
| 571 } | 571 } |
| 572 } | 572 } |
| 573 } | 573 } |
| 574 } | 574 } |
| 575 return 0; | 575 return 0; |
| 576 } | 576 } |
| OLD | NEW |