Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(471)

Side by Side Diff: webrtc/tools/event_log_visualizer/analyzer.cc

Issue 2501893004: Simplify creating RtpHeaderExtensionMap in EventLogAnalyzer (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtp_header_extension_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 10 matching lines...) Expand all
21 #include "webrtc/api/call/audio_send_stream.h" 21 #include "webrtc/api/call/audio_send_stream.h"
22 #include "webrtc/base/checks.h" 22 #include "webrtc/base/checks.h"
23 #include "webrtc/base/logging.h" 23 #include "webrtc/base/logging.h"
24 #include "webrtc/base/rate_statistics.h" 24 #include "webrtc/base/rate_statistics.h"
25 #include "webrtc/call.h" 25 #include "webrtc/call.h"
26 #include "webrtc/common_types.h" 26 #include "webrtc/common_types.h"
27 #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h" 27 #include "webrtc/modules/bitrate_controller/include/bitrate_controller.h"
28 #include "webrtc/modules/congestion_controller/include/congestion_controller.h" 28 #include "webrtc/modules/congestion_controller/include/congestion_controller.h"
29 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" 29 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h"
30 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" 30 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
31 #include "webrtc/modules/rtp_rtcp/source/rtp_header_extensions.h"
31 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" 32 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h"
32 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/common_header.h" 33 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/common_header.h"
33 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h" 34 #include "webrtc/modules/rtp_rtcp/source/rtcp_packet/transport_feedback.h"
34 #include "webrtc/video_receive_stream.h" 35 #include "webrtc/video_receive_stream.h"
35 #include "webrtc/video_send_stream.h" 36 #include "webrtc/video_send_stream.h"
36 37
37 namespace webrtc { 38 namespace webrtc {
38 namespace plotting { 39 namespace plotting {
39 40
40 namespace { 41 namespace {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 } 85 }
85 if (difference > max_difference / 2 || difference < min_difference / 2) { 86 if (difference > max_difference / 2 || difference < min_difference / 2) {
86 LOG(LS_WARNING) << "Difference between" << later << " and " << earlier 87 LOG(LS_WARNING) << "Difference between" << later << " and " << earlier
87 << " expected to be in the range (" << min_difference / 2 88 << " expected to be in the range (" << min_difference / 2
88 << "," << max_difference / 2 << ") but is " << difference 89 << "," << max_difference / 2 << ") but is " << difference
89 << ". Correct unwrapping is uncertain."; 90 << ". Correct unwrapping is uncertain.";
90 } 91 }
91 return difference; 92 return difference;
92 } 93 }
93 94
94 void RegisterHeaderExtensions(
95 const std::vector<webrtc::RtpExtension>& extensions,
96 webrtc::RtpHeaderExtensionMap* extension_map) {
97 extension_map->Erase();
98 for (const webrtc::RtpExtension& extension : extensions) {
99 extension_map->Register(webrtc::StringToRtpExtensionType(extension.uri),
100 extension.id);
101 }
102 }
103
104 // Return default values for header extensions, to use on streams without stored 95 // Return default values for header extensions, to use on streams without stored
105 // mapping data. Currently this only applies to audio streams, since the mapping 96 // mapping data. Currently this only applies to audio streams, since the mapping
106 // is not stored in the event log. 97 // is not stored in the event log.
107 // TODO(ivoc): Remove this once this mapping is stored in the event log for 98 // TODO(ivoc): Remove this once this mapping is stored in the event log for
108 // audio streams. Tracking bug: webrtc:6399 99 // audio streams. Tracking bug: webrtc:6399
109 webrtc::RtpHeaderExtensionMap GetDefaultHeaderExtensionMap() { 100 webrtc::RtpHeaderExtensionMap GetDefaultHeaderExtensionMap() {
110 webrtc::RtpHeaderExtensionMap default_map; 101 webrtc::RtpHeaderExtensionMap default_map;
111 default_map.Register( 102 default_map.Register<AudioLevel>(webrtc::RtpExtension::kAudioLevelDefaultId);
112 webrtc::StringToRtpExtensionType(webrtc::RtpExtension::kAudioLevelUri), 103 default_map.Register<AbsoluteSendTime>(
113 webrtc::RtpExtension::kAudioLevelDefaultId);
114 default_map.Register(
115 webrtc::StringToRtpExtensionType(webrtc::RtpExtension::kAbsSendTimeUri),
116 webrtc::RtpExtension::kAbsSendTimeDefaultId); 104 webrtc::RtpExtension::kAbsSendTimeDefaultId);
117 return default_map; 105 return default_map;
118 } 106 }
119 107
120 constexpr float kLeftMargin = 0.01f; 108 constexpr float kLeftMargin = 0.01f;
121 constexpr float kRightMargin = 0.02f; 109 constexpr float kRightMargin = 0.02f;
122 constexpr float kBottomMargin = 0.02f; 110 constexpr float kBottomMargin = 0.02f;
123 constexpr float kTopMargin = 0.05f; 111 constexpr float kTopMargin = 0.05f;
124 112
125 class PacketSizeBytes { 113 class PacketSizeBytes {
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 uint64_t timestamp = parsed_log_.GetTimestamp(i); 302 uint64_t timestamp = parsed_log_.GetTimestamp(i);
315 first_timestamp = std::min(first_timestamp, timestamp); 303 first_timestamp = std::min(first_timestamp, timestamp);
316 last_timestamp = std::max(last_timestamp, timestamp); 304 last_timestamp = std::max(last_timestamp, timestamp);
317 } 305 }
318 306
319 switch (parsed_log_.GetEventType(i)) { 307 switch (parsed_log_.GetEventType(i)) {
320 case ParsedRtcEventLog::VIDEO_RECEIVER_CONFIG_EVENT: { 308 case ParsedRtcEventLog::VIDEO_RECEIVER_CONFIG_EVENT: {
321 VideoReceiveStream::Config config(nullptr); 309 VideoReceiveStream::Config config(nullptr);
322 parsed_log_.GetVideoReceiveConfig(i, &config); 310 parsed_log_.GetVideoReceiveConfig(i, &config);
323 StreamId stream(config.rtp.remote_ssrc, kIncomingPacket); 311 StreamId stream(config.rtp.remote_ssrc, kIncomingPacket);
324 RegisterHeaderExtensions(config.rtp.extensions, 312 extension_maps[stream] = RtpHeaderExtensionMap(config.rtp.extensions);
325 &extension_maps[stream]);
326 video_ssrcs_.insert(stream); 313 video_ssrcs_.insert(stream);
327 for (auto kv : config.rtp.rtx) { 314 for (auto kv : config.rtp.rtx) {
328 StreamId rtx_stream(kv.second.ssrc, kIncomingPacket); 315 StreamId rtx_stream(kv.second.ssrc, kIncomingPacket);
329 RegisterHeaderExtensions(config.rtp.extensions, 316 extension_maps[rtx_stream] =
330 &extension_maps[rtx_stream]); 317 RtpHeaderExtensionMap(config.rtp.extensions);
331 video_ssrcs_.insert(rtx_stream); 318 video_ssrcs_.insert(rtx_stream);
332 rtx_ssrcs_.insert(rtx_stream); 319 rtx_ssrcs_.insert(rtx_stream);
333 } 320 }
334 break; 321 break;
335 } 322 }
336 case ParsedRtcEventLog::VIDEO_SENDER_CONFIG_EVENT: { 323 case ParsedRtcEventLog::VIDEO_SENDER_CONFIG_EVENT: {
337 VideoSendStream::Config config(nullptr); 324 VideoSendStream::Config config(nullptr);
338 parsed_log_.GetVideoSendConfig(i, &config); 325 parsed_log_.GetVideoSendConfig(i, &config);
339 for (auto ssrc : config.rtp.ssrcs) { 326 for (auto ssrc : config.rtp.ssrcs) {
340 StreamId stream(ssrc, kOutgoingPacket); 327 StreamId stream(ssrc, kOutgoingPacket);
341 RegisterHeaderExtensions(config.rtp.extensions, 328 extension_maps[stream] = RtpHeaderExtensionMap(config.rtp.extensions);
342 &extension_maps[stream]);
343 video_ssrcs_.insert(stream); 329 video_ssrcs_.insert(stream);
344 } 330 }
345 for (auto ssrc : config.rtp.rtx.ssrcs) { 331 for (auto ssrc : config.rtp.rtx.ssrcs) {
346 StreamId rtx_stream(ssrc, kOutgoingPacket); 332 StreamId rtx_stream(ssrc, kOutgoingPacket);
347 RegisterHeaderExtensions(config.rtp.extensions, 333 extension_maps[rtx_stream] =
348 &extension_maps[rtx_stream]); 334 RtpHeaderExtensionMap(config.rtp.extensions);
349 video_ssrcs_.insert(rtx_stream); 335 video_ssrcs_.insert(rtx_stream);
350 rtx_ssrcs_.insert(rtx_stream); 336 rtx_ssrcs_.insert(rtx_stream);
351 } 337 }
352 break; 338 break;
353 } 339 }
354 case ParsedRtcEventLog::AUDIO_RECEIVER_CONFIG_EVENT: { 340 case ParsedRtcEventLog::AUDIO_RECEIVER_CONFIG_EVENT: {
355 AudioReceiveStream::Config config; 341 AudioReceiveStream::Config config;
356 parsed_log_.GetAudioReceiveConfig(i, &config); 342 parsed_log_.GetAudioReceiveConfig(i, &config);
357 StreamId stream(config.rtp.remote_ssrc, kIncomingPacket); 343 StreamId stream(config.rtp.remote_ssrc, kIncomingPacket);
358 RegisterHeaderExtensions(config.rtp.extensions, 344 extension_maps[stream] = RtpHeaderExtensionMap(config.rtp.extensions);
359 &extension_maps[stream]);
360 audio_ssrcs_.insert(stream); 345 audio_ssrcs_.insert(stream);
361 break; 346 break;
362 } 347 }
363 case ParsedRtcEventLog::AUDIO_SENDER_CONFIG_EVENT: { 348 case ParsedRtcEventLog::AUDIO_SENDER_CONFIG_EVENT: {
364 AudioSendStream::Config config(nullptr); 349 AudioSendStream::Config config(nullptr);
365 parsed_log_.GetAudioSendConfig(i, &config); 350 parsed_log_.GetAudioSendConfig(i, &config);
366 StreamId stream(config.rtp.ssrc, kOutgoingPacket); 351 StreamId stream(config.rtp.ssrc, kOutgoingPacket);
367 RegisterHeaderExtensions(config.rtp.extensions, 352 extension_maps[stream] = RtpHeaderExtensionMap(config.rtp.extensions);
368 &extension_maps[stream]);
369 audio_ssrcs_.insert(stream); 353 audio_ssrcs_.insert(stream);
370 break; 354 break;
371 } 355 }
372 case ParsedRtcEventLog::RTP_EVENT: { 356 case ParsedRtcEventLog::RTP_EVENT: {
373 MediaType media_type; 357 MediaType media_type;
374 parsed_log_.GetRtpHeader(i, &direction, &media_type, header, 358 parsed_log_.GetRtpHeader(i, &direction, &media_type, header,
375 &header_length, &total_length); 359 &header_length, &total_length);
376 // Parse header to get SSRC. 360 // Parse header to get SSRC.
377 RtpUtility::RtpHeaderParser rtp_parser(header, header_length); 361 RtpUtility::RtpHeaderParser rtp_parser(header, header_length);
378 RTPHeader parsed_header; 362 RTPHeader parsed_header;
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after
1171 point.y -= estimated_base_delay_ms; 1155 point.y -= estimated_base_delay_ms;
1172 // Add the data set to the plot. 1156 // Add the data set to the plot.
1173 plot->series_list_.push_back(std::move(time_series)); 1157 plot->series_list_.push_back(std::move(time_series));
1174 1158
1175 plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin); 1159 plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin);
1176 plot->SetSuggestedYAxis(0, 10, "Delay (ms)", kBottomMargin, kTopMargin); 1160 plot->SetSuggestedYAxis(0, 10, "Delay (ms)", kBottomMargin, kTopMargin);
1177 plot->SetTitle("Network Delay Change."); 1161 plot->SetTitle("Network Delay Change.");
1178 } 1162 }
1179 } // namespace plotting 1163 } // namespace plotting
1180 } // namespace webrtc 1164 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtp_header_extension_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698