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

Side by Side Diff: webrtc/modules/audio_coding/neteq/neteq_unittest.cc

Issue 2408653002: NetEq: Convert AverageIAT from int to float calculations (Closed)
Patch Set: Taking care of review comments Created 4 years, 2 months 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2011 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 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 const std::string input_rtp_file = 441 const std::string input_rtp_file =
442 webrtc::test::ResourcePath("audio_coding/neteq_universal_new", "rtp"); 442 webrtc::test::ResourcePath("audio_coding/neteq_universal_new", "rtp");
443 443
444 const std::string output_checksum = PlatformChecksum( 444 const std::string output_checksum = PlatformChecksum(
445 "acd33f5c73625c1529c412ad59b5565132826f1b", 445 "acd33f5c73625c1529c412ad59b5565132826f1b",
446 "1a2e82a0410421c1d1d3eb0615334db5e2c63784", 446 "1a2e82a0410421c1d1d3eb0615334db5e2c63784",
447 "acd33f5c73625c1529c412ad59b5565132826f1b", 447 "acd33f5c73625c1529c412ad59b5565132826f1b",
448 "52797b781758a1d2303140b80b9c5030c9093d6b"); 448 "52797b781758a1d2303140b80b9c5030c9093d6b");
449 449
450 const std::string network_stats_checksum = PlatformChecksum( 450 const std::string network_stats_checksum = PlatformChecksum(
451 "9c5bb9e74a583be89313b158a19ea10d41bf9de6", 451 "f59b3dfdb9b1b8bbb61abedd7c8cf3fc47c21f5f",
452 "e948ec65cf18852ba2a197189a3186635db34c3b", 452 "c8b2a93842e48d014f7e6efe10ae96cb3892b129",
453 "9c5bb9e74a583be89313b158a19ea10d41bf9de6", 453 "f59b3dfdb9b1b8bbb61abedd7c8cf3fc47c21f5f",
454 "9c5bb9e74a583be89313b158a19ea10d41bf9de6"); 454 "f59b3dfdb9b1b8bbb61abedd7c8cf3fc47c21f5f");
455 455
456 const std::string rtcp_stats_checksum = PlatformChecksum( 456 const std::string rtcp_stats_checksum = PlatformChecksum(
457 "b8880bf9fed2487efbddcb8d94b9937a29ae521d", 457 "b8880bf9fed2487efbddcb8d94b9937a29ae521d",
458 "f3f7b3d3e71d7e635240b5373b57df6a7e4ce9d4", 458 "f3f7b3d3e71d7e635240b5373b57df6a7e4ce9d4",
459 "b8880bf9fed2487efbddcb8d94b9937a29ae521d", 459 "b8880bf9fed2487efbddcb8d94b9937a29ae521d",
460 "b8880bf9fed2487efbddcb8d94b9937a29ae521d"); 460 "b8880bf9fed2487efbddcb8d94b9937a29ae521d");
461 461
462 DecodeAndCompare(input_rtp_file, 462 DecodeAndCompare(input_rtp_file,
463 output_checksum, 463 output_checksum,
464 network_stats_checksum, 464 network_stats_checksum,
(...skipping 12 matching lines...) Expand all
477 const std::string input_rtp_file = 477 const std::string input_rtp_file =
478 webrtc::test::ResourcePath("audio_coding/neteq_opus", "rtp"); 478 webrtc::test::ResourcePath("audio_coding/neteq_opus", "rtp");
479 479
480 const std::string output_checksum = PlatformChecksum( 480 const std::string output_checksum = PlatformChecksum(
481 "9d7d52bc94e941d106aa518f324f16a58d231586", 481 "9d7d52bc94e941d106aa518f324f16a58d231586",
482 "9d7d52bc94e941d106aa518f324f16a58d231586", 482 "9d7d52bc94e941d106aa518f324f16a58d231586",
483 "9d7d52bc94e941d106aa518f324f16a58d231586", 483 "9d7d52bc94e941d106aa518f324f16a58d231586",
484 "9d7d52bc94e941d106aa518f324f16a58d231586"); 484 "9d7d52bc94e941d106aa518f324f16a58d231586");
485 485
486 const std::string network_stats_checksum = PlatformChecksum( 486 const std::string network_stats_checksum = PlatformChecksum(
487 "191af29ed3b8b6dd4c4cc94dc3f33bdf48f055ef", 487 "d8379381d5a619f0616bb3c0a8a9eea1704a8ab8",
488 "191af29ed3b8b6dd4c4cc94dc3f33bdf48f055ef", 488 "d8379381d5a619f0616bb3c0a8a9eea1704a8ab8",
489 "191af29ed3b8b6dd4c4cc94dc3f33bdf48f055ef", 489 "d8379381d5a619f0616bb3c0a8a9eea1704a8ab8",
490 "191af29ed3b8b6dd4c4cc94dc3f33bdf48f055ef"); 490 "d8379381d5a619f0616bb3c0a8a9eea1704a8ab8");
491 491
492 const std::string rtcp_stats_checksum = PlatformChecksum( 492 const std::string rtcp_stats_checksum = PlatformChecksum(
493 "e37c797e3de6a64dda88c9ade7a013d022a2e1e0", 493 "e37c797e3de6a64dda88c9ade7a013d022a2e1e0",
494 "e37c797e3de6a64dda88c9ade7a013d022a2e1e0", 494 "e37c797e3de6a64dda88c9ade7a013d022a2e1e0",
495 "e37c797e3de6a64dda88c9ade7a013d022a2e1e0", 495 "e37c797e3de6a64dda88c9ade7a013d022a2e1e0",
496 "e37c797e3de6a64dda88c9ade7a013d022a2e1e0"); 496 "e37c797e3de6a64dda88c9ade7a013d022a2e1e0");
497 497
498 DecodeAndCompare(input_rtp_file, 498 DecodeAndCompare(input_rtp_file,
499 output_checksum, 499 output_checksum,
500 network_stats_checksum, 500 network_stats_checksum,
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 } 570 }
571 571
572 // Pull out data once. 572 // Pull out data once.
573 bool muted; 573 bool muted;
574 ASSERT_EQ(0, neteq_->GetAudio(&out_frame_, &muted)); 574 ASSERT_EQ(0, neteq_->GetAudio(&out_frame_, &muted));
575 ASSERT_EQ(kBlockSize16kHz, out_frame_.samples_per_channel_); 575 ASSERT_EQ(kBlockSize16kHz, out_frame_.samples_per_channel_);
576 } 576 }
577 577
578 NetEqNetworkStatistics network_stats; 578 NetEqNetworkStatistics network_stats;
579 ASSERT_EQ(0, neteq_->NetworkStatistics(&network_stats)); 579 ASSERT_EQ(0, neteq_->NetworkStatistics(&network_stats));
580 EXPECT_EQ(-103196, network_stats.clockdrift_ppm); 580 EXPECT_EQ(-103192, network_stats.clockdrift_ppm);
581 } 581 }
582 582
583 TEST_F(NetEqDecodingTest, TestAverageInterArrivalTimePositive) { 583 TEST_F(NetEqDecodingTest, TestAverageInterArrivalTimePositive) {
584 const int kNumFrames = 5000; // Needed for convergence. 584 const int kNumFrames = 5000; // Needed for convergence.
585 int frame_index = 0; 585 int frame_index = 0;
586 const size_t kSamples = 10 * 16; 586 const size_t kSamples = 10 * 16;
587 const size_t kPayloadBytes = kSamples * 2; 587 const size_t kPayloadBytes = kSamples * 2;
588 for (int i = 0; i < kNumFrames; ++i) { 588 for (int i = 0; i < kNumFrames; ++i) {
589 // Insert one packet each time, except every 10th time where we don't insert 589 // Insert one packet each time, except every 10th time where we don't insert
590 // any packet. This will create a positive clock-drift of approx. 11%. 590 // any packet. This will create a positive clock-drift of approx. 11%.
591 int num_packets = (i % 10 == 9 ? 0 : 1); 591 int num_packets = (i % 10 == 9 ? 0 : 1);
592 for (int n = 0; n < num_packets; ++n) { 592 for (int n = 0; n < num_packets; ++n) {
593 uint8_t payload[kPayloadBytes] = {0}; 593 uint8_t payload[kPayloadBytes] = {0};
594 WebRtcRTPHeader rtp_info; 594 WebRtcRTPHeader rtp_info;
595 PopulateRtpInfo(frame_index, frame_index * kSamples, &rtp_info); 595 PopulateRtpInfo(frame_index, frame_index * kSamples, &rtp_info);
596 ASSERT_EQ(0, neteq_->InsertPacket(rtp_info, payload, 0)); 596 ASSERT_EQ(0, neteq_->InsertPacket(rtp_info, payload, 0));
597 ++frame_index; 597 ++frame_index;
598 } 598 }
599 599
600 // Pull out data once. 600 // Pull out data once.
601 bool muted; 601 bool muted;
602 ASSERT_EQ(0, neteq_->GetAudio(&out_frame_, &muted)); 602 ASSERT_EQ(0, neteq_->GetAudio(&out_frame_, &muted));
603 ASSERT_EQ(kBlockSize16kHz, out_frame_.samples_per_channel_); 603 ASSERT_EQ(kBlockSize16kHz, out_frame_.samples_per_channel_);
604 } 604 }
605 605
606 NetEqNetworkStatistics network_stats; 606 NetEqNetworkStatistics network_stats;
607 ASSERT_EQ(0, neteq_->NetworkStatistics(&network_stats)); 607 ASSERT_EQ(0, neteq_->NetworkStatistics(&network_stats));
608 EXPECT_EQ(110946, network_stats.clockdrift_ppm); 608 EXPECT_EQ(110953, network_stats.clockdrift_ppm);
609 } 609 }
610 610
611 void NetEqDecodingTest::LongCngWithClockDrift(double drift_factor, 611 void NetEqDecodingTest::LongCngWithClockDrift(double drift_factor,
612 double network_freeze_ms, 612 double network_freeze_ms,
613 bool pull_audio_during_freeze, 613 bool pull_audio_during_freeze,
614 int delay_tolerance_ms, 614 int delay_tolerance_ms,
615 int max_time_to_speech_ms) { 615 int max_time_to_speech_ms) {
616 uint16_t seq_no = 0; 616 uint16_t seq_no = 0;
617 uint32_t timestamp = 0; 617 uint32_t timestamp = 0;
618 const int kFrameSizeMs = 30; 618 const int kFrameSizeMs = 30;
(...skipping 962 matching lines...) Expand 10 before | Expand all | Expand 10 after
1581 if (muted) { 1581 if (muted) {
1582 EXPECT_TRUE(AudioFramesEqualExceptData(out_frame1, out_frame2)); 1582 EXPECT_TRUE(AudioFramesEqualExceptData(out_frame1, out_frame2));
1583 } else { 1583 } else {
1584 EXPECT_TRUE(AudioFramesEqual(out_frame1, out_frame2)); 1584 EXPECT_TRUE(AudioFramesEqual(out_frame1, out_frame2));
1585 } 1585 }
1586 } 1586 }
1587 EXPECT_FALSE(muted); 1587 EXPECT_FALSE(muted);
1588 } 1588 }
1589 1589
1590 } // namespace webrtc 1590 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698