OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 const AudioFrame& audio_frame, | 382 const AudioFrame& audio_frame, |
383 bool muted, | 383 bool muted, |
384 NetEq* neteq) override { | 384 NetEq* neteq) override { |
385 if (++counter_ >= 100) { | 385 if (++counter_ >= 100) { |
386 counter_ = 0; | 386 counter_ = 0; |
387 NetEqNetworkStatistics stats; | 387 NetEqNetworkStatistics stats; |
388 RTC_CHECK_EQ(neteq->NetworkStatistics(&stats), 0); | 388 RTC_CHECK_EQ(neteq->NetworkStatistics(&stats), 0); |
389 stats_.push_back(stats); | 389 stats_.push_back(stats); |
390 } | 390 } |
391 if (other_callback_) { | 391 if (other_callback_) { |
392 other_callback_->BeforeGetAudio(neteq); | 392 other_callback_->AfterGetAudio(time_now_ms, audio_frame, muted, neteq); |
393 } | 393 } |
394 } | 394 } |
395 | 395 |
396 double AverageSpeechExpandRate() const { | 396 double AverageSpeechExpandRate() const { |
397 double sum_speech_expand = | 397 double sum_speech_expand = |
398 std::accumulate(stats_.begin(), stats_.end(), double{0.0}, | 398 std::accumulate(stats_.begin(), stats_.end(), double{0.0}, |
399 [](double a, NetEqNetworkStatistics b) { | 399 [](double a, NetEqNetworkStatistics b) { |
400 return a + static_cast<double>(b.speech_expand_rate); | 400 return a + static_cast<double>(b.speech_expand_rate); |
401 }); | 401 }); |
402 return sum_speech_expand / 16384.0 / stats_.size(); | 402 return sum_speech_expand / 16384.0 / stats_.size(); |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
628 StatsGetter stats_getter(delay_analyzer.get()); | 628 StatsGetter stats_getter(delay_analyzer.get()); |
629 callbacks.get_audio_callback = &stats_getter; | 629 callbacks.get_audio_callback = &stats_getter; |
630 NetEq::Config config; | 630 NetEq::Config config; |
631 config.sample_rate_hz = *sample_rate_hz; | 631 config.sample_rate_hz = *sample_rate_hz; |
632 NetEqTest test(config, codecs, ext_codecs, std::move(input), | 632 NetEqTest test(config, codecs, ext_codecs, std::move(input), |
633 std::move(output), callbacks); | 633 std::move(output), callbacks); |
634 | 634 |
635 int64_t test_duration_ms = test.Run(); | 635 int64_t test_duration_ms = test.Run(); |
636 | 636 |
637 if (FLAGS_matlabplot) { | 637 if (FLAGS_matlabplot) { |
638 std::cout << "Creating Matlab plot script " << output_file_name + ".m" | 638 auto matlab_script_name = output_file_name; |
| 639 std::replace(matlab_script_name.begin(), matlab_script_name.end(), '.', |
| 640 '_'); |
| 641 std::cout << "Creating Matlab plot script " << matlab_script_name + ".m" |
639 << std::endl; | 642 << std::endl; |
640 delay_analyzer->CreateMatlabScript(output_file_name + ".m"); | 643 delay_analyzer->CreateMatlabScript(matlab_script_name + ".m"); |
641 } | 644 } |
642 | 645 |
643 printf("Simulation statistics:\n"); | 646 printf("Simulation statistics:\n"); |
644 printf(" output duration: %" PRId64 " ms\n", test_duration_ms); | 647 printf(" output duration: %" PRId64 " ms\n", test_duration_ms); |
645 auto stats = stats_getter.AverageStats(); | 648 auto stats = stats_getter.AverageStats(); |
646 printf(" packet_loss_rate: %f %%\n", 100.0 * stats.packet_loss_rate); | 649 printf(" packet_loss_rate: %f %%\n", 100.0 * stats.packet_loss_rate); |
647 printf(" expand_rate: %f %%\n", 100.0 * stats.expand_rate); | 650 printf(" expand_rate: %f %%\n", 100.0 * stats.expand_rate); |
648 printf(" speech_expand_rate: %f %%\n", 100.0 * stats.speech_expand_rate); | 651 printf(" speech_expand_rate: %f %%\n", 100.0 * stats.speech_expand_rate); |
649 printf(" preemptive_rate: %f %%\n", 100.0 * stats.preemptive_rate); | 652 printf(" preemptive_rate: %f %%\n", 100.0 * stats.preemptive_rate); |
650 printf(" accelerate_rate: %f %%\n", 100.0 * stats.accelerate_rate); | 653 printf(" accelerate_rate: %f %%\n", 100.0 * stats.accelerate_rate); |
(...skipping 10 matching lines...) Expand all Loading... |
661 return 0; | 664 return 0; |
662 } | 665 } |
663 | 666 |
664 } // namespace | 667 } // namespace |
665 } // namespace test | 668 } // namespace test |
666 } // namespace webrtc | 669 } // namespace webrtc |
667 | 670 |
668 int main(int argc, char* argv[]) { | 671 int main(int argc, char* argv[]) { |
669 webrtc::test::RunTest(argc, argv); | 672 webrtc::test::RunTest(argc, argv); |
670 } | 673 } |
OLD | NEW |