OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 } | 366 } |
367 case ParsedRtcEventLog::AUDIO_SENDER_CONFIG_EVENT: { | 367 case ParsedRtcEventLog::AUDIO_SENDER_CONFIG_EVENT: { |
368 rtclog::StreamConfig config; | 368 rtclog::StreamConfig config; |
369 parsed_log_.GetAudioSendConfig(i, &config); | 369 parsed_log_.GetAudioSendConfig(i, &config); |
370 StreamId stream(config.local_ssrc, kOutgoingPacket); | 370 StreamId stream(config.local_ssrc, kOutgoingPacket); |
371 extension_maps[stream] = RtpHeaderExtensionMap(config.rtp_extensions); | 371 extension_maps[stream] = RtpHeaderExtensionMap(config.rtp_extensions); |
372 audio_ssrcs_.insert(stream); | 372 audio_ssrcs_.insert(stream); |
373 break; | 373 break; |
374 } | 374 } |
375 case ParsedRtcEventLog::RTP_EVENT: { | 375 case ParsedRtcEventLog::RTP_EVENT: { |
376 MediaType media_type; | 376 parsed_log_.GetRtpHeader(i, &direction, header, &header_length, |
377 parsed_log_.GetRtpHeader(i, &direction, &media_type, header, | 377 &total_length); |
378 &header_length, &total_length); | |
379 // Parse header to get SSRC. | 378 // Parse header to get SSRC. |
380 RtpUtility::RtpHeaderParser rtp_parser(header, header_length); | 379 RtpUtility::RtpHeaderParser rtp_parser(header, header_length); |
381 RTPHeader parsed_header; | 380 RTPHeader parsed_header; |
382 rtp_parser.Parse(&parsed_header); | 381 rtp_parser.Parse(&parsed_header); |
383 StreamId stream(parsed_header.ssrc, direction); | 382 StreamId stream(parsed_header.ssrc, direction); |
384 // Look up the extension_map and parse it again to get the extensions. | 383 // Look up the extension_map and parse it again to get the extensions. |
385 if (extension_maps.count(stream) == 1) { | 384 if (extension_maps.count(stream) == 1) { |
386 RtpHeaderExtensionMap* extension_map = &extension_maps[stream]; | 385 RtpHeaderExtensionMap* extension_map = &extension_maps[stream]; |
387 rtp_parser.Parse(&parsed_header, extension_map); | 386 rtp_parser.Parse(&parsed_header, extension_map); |
388 } else { | 387 } else { |
389 // Use the default extension map. | 388 // Use the default extension map. |
390 // TODO(ivoc): Once configuration of audio streams is stored in the | 389 // TODO(ivoc): Once configuration of audio streams is stored in the |
391 // event log, this can be removed. | 390 // event log, this can be removed. |
392 // Tracking bug: webrtc:6399 | 391 // Tracking bug: webrtc:6399 |
393 rtp_parser.Parse(&parsed_header, &default_extension_map); | 392 rtp_parser.Parse(&parsed_header, &default_extension_map); |
394 } | 393 } |
395 uint64_t timestamp = parsed_log_.GetTimestamp(i); | 394 uint64_t timestamp = parsed_log_.GetTimestamp(i); |
396 rtp_packets_[stream].push_back( | 395 rtp_packets_[stream].push_back( |
397 LoggedRtpPacket(timestamp, parsed_header, total_length)); | 396 LoggedRtpPacket(timestamp, parsed_header, total_length)); |
398 break; | 397 break; |
399 } | 398 } |
400 case ParsedRtcEventLog::RTCP_EVENT: { | 399 case ParsedRtcEventLog::RTCP_EVENT: { |
401 uint8_t packet[IP_PACKET_SIZE]; | 400 uint8_t packet[IP_PACKET_SIZE]; |
402 MediaType media_type; | 401 parsed_log_.GetRtcpPacket(i, &direction, packet, &total_length); |
403 parsed_log_.GetRtcpPacket(i, &direction, &media_type, packet, | |
404 &total_length); | |
405 // Currently incoming RTCP packets are logged twice, both for audio and | 402 // Currently incoming RTCP packets are logged twice, both for audio and |
406 // video. Only act on one of them. Compare against the previous parsed | 403 // video. Only act on one of them. Compare against the previous parsed |
407 // incoming RTCP packet. | 404 // incoming RTCP packet. |
408 if (direction == webrtc::kIncomingPacket) { | 405 if (direction == webrtc::kIncomingPacket) { |
409 RTC_CHECK_LE(total_length, IP_PACKET_SIZE); | 406 RTC_CHECK_LE(total_length, IP_PACKET_SIZE); |
410 if (total_length == last_incoming_rtcp_packet_length && | 407 if (total_length == last_incoming_rtcp_packet_length && |
411 memcmp(last_incoming_rtcp_packet, packet, total_length) == 0) { | 408 memcmp(last_incoming_rtcp_packet, packet, total_length) == 0) { |
412 continue; | 409 continue; |
413 } else { | 410 } else { |
414 memcpy(last_incoming_rtcp_packet, packet, total_length); | 411 memcpy(last_incoming_rtcp_packet, packet, total_length); |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
898 }; | 895 }; |
899 std::vector<TimestampSize> packets; | 896 std::vector<TimestampSize> packets; |
900 | 897 |
901 PacketDirection direction; | 898 PacketDirection direction; |
902 size_t total_length; | 899 size_t total_length; |
903 | 900 |
904 // Extract timestamps and sizes for the relevant packets. | 901 // Extract timestamps and sizes for the relevant packets. |
905 for (size_t i = 0; i < parsed_log_.GetNumberOfEvents(); i++) { | 902 for (size_t i = 0; i < parsed_log_.GetNumberOfEvents(); i++) { |
906 ParsedRtcEventLog::EventType event_type = parsed_log_.GetEventType(i); | 903 ParsedRtcEventLog::EventType event_type = parsed_log_.GetEventType(i); |
907 if (event_type == ParsedRtcEventLog::RTP_EVENT) { | 904 if (event_type == ParsedRtcEventLog::RTP_EVENT) { |
908 parsed_log_.GetRtpHeader(i, &direction, nullptr, nullptr, nullptr, | 905 parsed_log_.GetRtpHeader(i, &direction, nullptr, nullptr, &total_length); |
909 &total_length); | |
910 if (direction == desired_direction) { | 906 if (direction == desired_direction) { |
911 uint64_t timestamp = parsed_log_.GetTimestamp(i); | 907 uint64_t timestamp = parsed_log_.GetTimestamp(i); |
912 packets.push_back(TimestampSize(timestamp, total_length)); | 908 packets.push_back(TimestampSize(timestamp, total_length)); |
913 } | 909 } |
914 } | 910 } |
915 } | 911 } |
916 | 912 |
917 size_t window_index_begin = 0; | 913 size_t window_index_begin = 0; |
918 size_t window_index_end = 0; | 914 size_t window_index_end = 0; |
919 size_t bytes_in_window = 0; | 915 size_t bytes_in_window = 0; |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1395 }, | 1391 }, |
1396 audio_network_adaptation_events_, begin_time_, &time_series); | 1392 audio_network_adaptation_events_, begin_time_, &time_series); |
1397 plot->AppendTimeSeries(std::move(time_series)); | 1393 plot->AppendTimeSeries(std::move(time_series)); |
1398 plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin); | 1394 plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin); |
1399 plot->SetSuggestedYAxis(0, 1, "Number of channels (1 (mono)/2 (stereo))", | 1395 plot->SetSuggestedYAxis(0, 1, "Number of channels (1 (mono)/2 (stereo))", |
1400 kBottomMargin, kTopMargin); | 1396 kBottomMargin, kTopMargin); |
1401 plot->SetTitle("Reported audio encoder number of channels"); | 1397 plot->SetTitle("Reported audio encoder number of channels"); |
1402 } | 1398 } |
1403 } // namespace plotting | 1399 } // namespace plotting |
1404 } // namespace webrtc | 1400 } // namespace webrtc |
OLD | NEW |