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 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 parsed_log_.GetLossBasedBweUpdate(i, &bwe_update.new_bitrate, | 444 parsed_log_.GetLossBasedBweUpdate(i, &bwe_update.new_bitrate, |
445 &bwe_update.fraction_loss, | 445 &bwe_update.fraction_loss, |
446 &bwe_update.expected_packets); | 446 &bwe_update.expected_packets); |
447 bwe_loss_updates_.push_back(bwe_update); | 447 bwe_loss_updates_.push_back(bwe_update); |
448 break; | 448 break; |
449 } | 449 } |
450 case ParsedRtcEventLog::DELAY_BASED_BWE_UPDATE: { | 450 case ParsedRtcEventLog::DELAY_BASED_BWE_UPDATE: { |
451 break; | 451 break; |
452 } | 452 } |
453 case ParsedRtcEventLog::AUDIO_NETWORK_ADAPTATION_EVENT: { | 453 case ParsedRtcEventLog::AUDIO_NETWORK_ADAPTATION_EVENT: { |
| 454 AudioNetworkAdaptationEvent ana_event; |
| 455 ana_event.timestamp = parsed_log_.GetTimestamp(i); |
| 456 parsed_log_.GetAudioNetworkAdaptation(i, &ana_event.config); |
| 457 audio_network_adaptation_events_.push_back(ana_event); |
454 break; | 458 break; |
455 } | 459 } |
456 case ParsedRtcEventLog::UNKNOWN_EVENT: { | 460 case ParsedRtcEventLog::UNKNOWN_EVENT: { |
457 break; | 461 break; |
458 } | 462 } |
459 } | 463 } |
460 } | 464 } |
461 | 465 |
462 if (last_timestamp < first_timestamp) { | 466 if (last_timestamp < first_timestamp) { |
463 // No useful events in the log. | 467 // No useful events in the log. |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 name << "RTX "; | 529 name << "RTX "; |
526 if (stream_id.GetDirection() == kIncomingPacket) { | 530 if (stream_id.GetDirection() == kIncomingPacket) { |
527 name << "(In) "; | 531 name << "(In) "; |
528 } else { | 532 } else { |
529 name << "(Out) "; | 533 name << "(Out) "; |
530 } | 534 } |
531 name << SsrcToString(stream_id.GetSsrc()); | 535 name << SsrcToString(stream_id.GetSsrc()); |
532 return name.str(); | 536 return name.str(); |
533 } | 537 } |
534 | 538 |
| 539 void EventLogAnalyzer::FillAudioEncoderTimeSeries( |
| 540 Plot* plot, |
| 541 rtc::FunctionView<rtc::Optional<float>( |
| 542 const AudioNetworkAdaptationEvent& ana_event)> get_y) const { |
| 543 plot->series_list_.push_back(TimeSeries()); |
| 544 plot->series_list_.back().style = LINE_DOT_GRAPH; |
| 545 for (auto& ana_event : audio_network_adaptation_events_) { |
| 546 rtc::Optional<float> y = get_y(ana_event); |
| 547 if (y) { |
| 548 float x = static_cast<float>(ana_event.timestamp - begin_time_) / 1000000; |
| 549 plot->series_list_.back().points.emplace_back(x, *y); |
| 550 } |
| 551 } |
| 552 } |
| 553 |
535 void EventLogAnalyzer::CreatePacketGraph(PacketDirection desired_direction, | 554 void EventLogAnalyzer::CreatePacketGraph(PacketDirection desired_direction, |
536 Plot* plot) { | 555 Plot* plot) { |
537 for (auto& kv : rtp_packets_) { | 556 for (auto& kv : rtp_packets_) { |
538 StreamId stream_id = kv.first; | 557 StreamId stream_id = kv.first; |
539 const std::vector<LoggedRtpPacket>& packet_stream = kv.second; | 558 const std::vector<LoggedRtpPacket>& packet_stream = kv.second; |
540 // Filter on direction and SSRC. | 559 // Filter on direction and SSRC. |
541 if (stream_id.GetDirection() != desired_direction || | 560 if (stream_id.GetDirection() != desired_direction || |
542 !MatchingSsrc(stream_id.GetSsrc(), desired_ssrc_)) { | 561 !MatchingSsrc(stream_id.GetSsrc(), desired_ssrc_)) { |
543 continue; | 562 continue; |
544 } | 563 } |
(...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1268 } | 1287 } |
1269 plot->series_list_.push_back(std::move(timestamp_data)); | 1288 plot->series_list_.push_back(std::move(timestamp_data)); |
1270 } | 1289 } |
1271 } | 1290 } |
1272 } | 1291 } |
1273 | 1292 |
1274 plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin); | 1293 plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin); |
1275 plot->SetSuggestedYAxis(0, 1, "Timestamp (90khz)", kBottomMargin, kTopMargin); | 1294 plot->SetSuggestedYAxis(0, 1, "Timestamp (90khz)", kBottomMargin, kTopMargin); |
1276 plot->SetTitle("Timestamps"); | 1295 plot->SetTitle("Timestamps"); |
1277 } | 1296 } |
| 1297 |
| 1298 void EventLogAnalyzer::CreateAudioEncoderTargetBitrateGraph(Plot* plot) { |
| 1299 FillAudioEncoderTimeSeries( |
| 1300 plot, [](const AudioNetworkAdaptationEvent& ana_event) { |
| 1301 if (ana_event.config.bitrate_bps) |
| 1302 return rtc::Optional<float>( |
| 1303 static_cast<float>(*ana_event.config.bitrate_bps)); |
| 1304 return rtc::Optional<float>(); |
| 1305 }); |
| 1306 plot->series_list_.back().label = "Audio encoder target bitrate"; |
| 1307 plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin); |
| 1308 plot->SetSuggestedYAxis(0, 1, "Bitrate (bps)", kBottomMargin, kTopMargin); |
| 1309 plot->SetTitle("Reported audio encoder target bitrate"); |
| 1310 } |
| 1311 |
| 1312 void EventLogAnalyzer::CreateAudioEncoderFrameLengthGraph(Plot* plot) { |
| 1313 FillAudioEncoderTimeSeries( |
| 1314 plot, [](const AudioNetworkAdaptationEvent& ana_event) { |
| 1315 if (ana_event.config.frame_length_ms) |
| 1316 return rtc::Optional<float>( |
| 1317 static_cast<float>(*ana_event.config.frame_length_ms)); |
| 1318 return rtc::Optional<float>(); |
| 1319 }); |
| 1320 plot->series_list_.back().label = "Audio encoder frame length"; |
| 1321 plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin); |
| 1322 plot->SetSuggestedYAxis(0, 1, "Frame length (ms)", kBottomMargin, kTopMargin); |
| 1323 plot->SetTitle("Reported audio encoder frame length"); |
| 1324 } |
| 1325 |
| 1326 void EventLogAnalyzer::CreateAudioEncoderUplinkPacketLossFractionGraph( |
| 1327 Plot* plot) { |
| 1328 FillAudioEncoderTimeSeries( |
| 1329 plot, [&](const AudioNetworkAdaptationEvent& ana_event) { |
| 1330 if (ana_event.config.uplink_packet_loss_fraction) |
| 1331 return rtc::Optional<float>(static_cast<float>( |
| 1332 *ana_event.config.uplink_packet_loss_fraction)); |
| 1333 return rtc::Optional<float>(); |
| 1334 }); |
| 1335 plot->series_list_.back().label = "Audio encoder uplink packet loss fraction"; |
| 1336 plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin); |
| 1337 plot->SetSuggestedYAxis(0, 10, "Percent lost packets", kBottomMargin, |
| 1338 kTopMargin); |
| 1339 plot->SetTitle("Reported audio encoder lost packets"); |
| 1340 } |
| 1341 |
| 1342 void EventLogAnalyzer::CreateAudioEncoderEnableFecGraph(Plot* plot) { |
| 1343 FillAudioEncoderTimeSeries( |
| 1344 plot, [&](const AudioNetworkAdaptationEvent& ana_event) { |
| 1345 if (ana_event.config.enable_fec) |
| 1346 return rtc::Optional<float>( |
| 1347 static_cast<float>(*ana_event.config.enable_fec)); |
| 1348 return rtc::Optional<float>(); |
| 1349 }); |
| 1350 plot->series_list_.back().label = "Audio encoder FEC"; |
| 1351 plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin); |
| 1352 plot->SetSuggestedYAxis(0, 1, "FEC (false/true)", kBottomMargin, kTopMargin); |
| 1353 plot->SetTitle("Reported audio encoder FEC"); |
| 1354 } |
| 1355 |
| 1356 void EventLogAnalyzer::CreateAudioEncoderEnableDtxGraph(Plot* plot) { |
| 1357 FillAudioEncoderTimeSeries( |
| 1358 plot, [&](const AudioNetworkAdaptationEvent& ana_event) { |
| 1359 if (ana_event.config.enable_dtx) |
| 1360 return rtc::Optional<float>( |
| 1361 static_cast<float>(*ana_event.config.enable_dtx)); |
| 1362 return rtc::Optional<float>(); |
| 1363 }); |
| 1364 plot->series_list_.back().label = "Audio encoder DTX"; |
| 1365 plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin); |
| 1366 plot->SetSuggestedYAxis(0, 1, "DTX (false/true)", kBottomMargin, kTopMargin); |
| 1367 plot->SetTitle("Reported audio encoder DTX"); |
| 1368 } |
| 1369 |
| 1370 void EventLogAnalyzer::CreateAudioEncoderNumChannelsGraph(Plot* plot) { |
| 1371 FillAudioEncoderTimeSeries( |
| 1372 plot, [&](const AudioNetworkAdaptationEvent& ana_event) { |
| 1373 if (ana_event.config.num_channels) |
| 1374 return rtc::Optional<float>( |
| 1375 static_cast<float>(*ana_event.config.num_channels)); |
| 1376 return rtc::Optional<float>(); |
| 1377 }); |
| 1378 plot->series_list_.back().label = "Audio encoder number of channels"; |
| 1379 plot->SetXAxis(0, call_duration_s_, "Time (s)", kLeftMargin, kRightMargin); |
| 1380 plot->SetSuggestedYAxis(0, 1, "Number of channels (1 (mono)/2 (stereo))", |
| 1381 kBottomMargin, kTopMargin); |
| 1382 plot->SetTitle("Reported audio encoder number of channels"); |
| 1383 } |
1278 } // namespace plotting | 1384 } // namespace plotting |
1279 } // namespace webrtc | 1385 } // namespace webrtc |
OLD | NEW |