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

Side by Side Diff: webrtc/modules/audio_coding/acm2/audio_coding_module_unittest.cc

Issue 2930243003: Opus implementation of the AudioEncoderFactoryTemplate API (Closed)
Patch Set: rebase Created 3 years, 6 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) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 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 1483 matching lines...) Expand 10 before | Expand all | Expand 10 after
1494 "d781cce1ab986b618d0da87226cdde30", 1494 "d781cce1ab986b618d0da87226cdde30",
1495 "d781cce1ab986b618d0da87226cdde30", 1495 "d781cce1ab986b618d0da87226cdde30",
1496 "8d6782b905c3230d4b0e3e83e1fc3439", 1496 "8d6782b905c3230d4b0e3e83e1fc3439",
1497 "798347a685fac7d0c2d8f748ffe66881", 1497 "798347a685fac7d0c2d8f748ffe66881",
1498 "798347a685fac7d0c2d8f748ffe66881"), 1498 "798347a685fac7d0c2d8f748ffe66881"),
1499 50, test::AcmReceiveTestOldApi::kStereoOutput); 1499 50, test::AcmReceiveTestOldApi::kStereoOutput);
1500 } 1500 }
1501 1501
1502 TEST_F(AcmSenderBitExactnessNewApi, MAYBE_OpusFromFormat_stereo_20ms) { 1502 TEST_F(AcmSenderBitExactnessNewApi, MAYBE_OpusFromFormat_stereo_20ms) {
1503 const SdpAudioFormat kOpusFormat("opus", 48000, 2, {{"stereo", "1"}}); 1503 const SdpAudioFormat kOpusFormat("opus", 48000, 2, {{"stereo", "1"}});
1504 AudioEncoderOpus encoder(120, kOpusFormat); 1504 AudioEncoderOpusImpl encoder(120, kOpusFormat);
1505 ASSERT_NO_FATAL_FAILURE(SetUpTestExternalEncoder(&encoder, 120)); 1505 ASSERT_NO_FATAL_FAILURE(SetUpTestExternalEncoder(&encoder, 120));
1506 Run(AcmReceiverBitExactnessOldApi::PlatformChecksum( 1506 Run(AcmReceiverBitExactnessOldApi::PlatformChecksum(
1507 "855041f2490b887302bce9d544731849", 1507 "855041f2490b887302bce9d544731849",
1508 "855041f2490b887302bce9d544731849", 1508 "855041f2490b887302bce9d544731849",
1509 "9692eede45638eb425e0daf9c75b5c7a", 1509 "9692eede45638eb425e0daf9c75b5c7a",
1510 "86d3552bb3492247f965cdd0e88a1c82", 1510 "86d3552bb3492247f965cdd0e88a1c82",
1511 "86d3552bb3492247f965cdd0e88a1c82"), 1511 "86d3552bb3492247f965cdd0e88a1c82"),
1512 AcmReceiverBitExactnessOldApi::PlatformChecksum( 1512 AcmReceiverBitExactnessOldApi::PlatformChecksum(
1513 "d781cce1ab986b618d0da87226cdde30", 1513 "d781cce1ab986b618d0da87226cdde30",
1514 "d781cce1ab986b618d0da87226cdde30", 1514 "d781cce1ab986b618d0da87226cdde30",
(...skipping 25 matching lines...) Expand all
1540 "c7340b1189652ab6b5e80dade7390cb4", 1540 "c7340b1189652ab6b5e80dade7390cb4",
1541 "c7340b1189652ab6b5e80dade7390cb4", 1541 "c7340b1189652ab6b5e80dade7390cb4",
1542 "95612864c954ee63e28cc6eebad56626", 1542 "95612864c954ee63e28cc6eebad56626",
1543 "ae33ea2e43407cf9ebdabbbd6ca912a3", 1543 "ae33ea2e43407cf9ebdabbbd6ca912a3",
1544 "ae33ea2e43407cf9ebdabbbd6ca912a3"), 1544 "ae33ea2e43407cf9ebdabbbd6ca912a3"),
1545 50, test::AcmReceiveTestOldApi::kStereoOutput); 1545 50, test::AcmReceiveTestOldApi::kStereoOutput);
1546 } 1546 }
1547 1547
1548 TEST_F(AcmSenderBitExactnessNewApi, MAYBE_OpusFromFormat_stereo_20ms_voip) { 1548 TEST_F(AcmSenderBitExactnessNewApi, MAYBE_OpusFromFormat_stereo_20ms_voip) {
1549 const SdpAudioFormat kOpusFormat("opus", 48000, 2, {{"stereo", "1"}}); 1549 const SdpAudioFormat kOpusFormat("opus", 48000, 2, {{"stereo", "1"}});
1550 AudioEncoderOpus encoder(120, kOpusFormat); 1550 AudioEncoderOpusImpl encoder(120, kOpusFormat);
1551 ASSERT_NO_FATAL_FAILURE(SetUpTestExternalEncoder(&encoder, 120)); 1551 ASSERT_NO_FATAL_FAILURE(SetUpTestExternalEncoder(&encoder, 120));
1552 // If not set, default will be kAudio in case of stereo. 1552 // If not set, default will be kAudio in case of stereo.
1553 EXPECT_EQ(0, send_test_->acm()->SetOpusApplication(kVoip)); 1553 EXPECT_EQ(0, send_test_->acm()->SetOpusApplication(kVoip));
1554 Run(AcmReceiverBitExactnessOldApi::PlatformChecksum( 1554 Run(AcmReceiverBitExactnessOldApi::PlatformChecksum(
1555 "9b9e12bc3cc793740966e11cbfa8b35b", 1555 "9b9e12bc3cc793740966e11cbfa8b35b",
1556 "9b9e12bc3cc793740966e11cbfa8b35b", 1556 "9b9e12bc3cc793740966e11cbfa8b35b",
1557 "0de6249018fdd316c21086db84e10610", 1557 "0de6249018fdd316c21086db84e10610",
1558 "9c4cb69db77b85841a5f8225bb8f508b", 1558 "9c4cb69db77b85841a5f8225bb8f508b",
1559 "9c4cb69db77b85841a5f8225bb8f508b"), 1559 "9c4cb69db77b85841a5f8225bb8f508b"),
1560 AcmReceiverBitExactnessOldApi::PlatformChecksum( 1560 AcmReceiverBitExactnessOldApi::PlatformChecksum(
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
1657 TEST_F(AcmSetBitRateOldApi, MAYBE_Opus_48khz_20ms_10kbps) { 1657 TEST_F(AcmSetBitRateOldApi, MAYBE_Opus_48khz_20ms_10kbps) {
1658 ASSERT_NO_FATAL_FAILURE(SetUpTest("opus", 48000, 1, 107, 960, 960)); 1658 ASSERT_NO_FATAL_FAILURE(SetUpTest("opus", 48000, 1, 107, 960, 960));
1659 #if defined(WEBRTC_ANDROID) 1659 #if defined(WEBRTC_ANDROID)
1660 Run(10000, 9288); 1660 Run(10000, 9288);
1661 #else 1661 #else
1662 Run(10000, 9024); 1662 Run(10000, 9024);
1663 #endif // WEBRTC_ANDROID 1663 #endif // WEBRTC_ANDROID
1664 } 1664 }
1665 1665
1666 TEST_F(AcmSetBitRateNewApi, MAYBE_OpusFromFormat_48khz_20ms_10kbps) { 1666 TEST_F(AcmSetBitRateNewApi, MAYBE_OpusFromFormat_48khz_20ms_10kbps) {
1667 AudioEncoderOpus encoder( 1667 AudioEncoderOpusImpl encoder(
1668 107, SdpAudioFormat("opus", 48000, 2, {{"maxaveragebitrate", "10000"}})); 1668 107, SdpAudioFormat("opus", 48000, 2, {{"maxaveragebitrate", "10000"}}));
1669 ASSERT_TRUE(SetUpSender()); 1669 ASSERT_TRUE(SetUpSender());
1670 ASSERT_TRUE(RegisterExternalSendCodec(&encoder, 107)); 1670 ASSERT_TRUE(RegisterExternalSendCodec(&encoder, 107));
1671 #if defined(WEBRTC_ANDROID) 1671 #if defined(WEBRTC_ANDROID)
1672 RunInner(9288); 1672 RunInner(9288);
1673 #else 1673 #else
1674 RunInner(9024); 1674 RunInner(9024);
1675 #endif // WEBRTC_ANDROID 1675 #endif // WEBRTC_ANDROID
1676 } 1676 }
1677 1677
1678 #if WEBRTC_OPUS_SUPPORT_120MS_PTIME 1678 #if WEBRTC_OPUS_SUPPORT_120MS_PTIME
1679 #define MAYBE_Opus_48khz_20ms_50kbps DISABLED_Opus_48khz_20ms_50kbps 1679 #define MAYBE_Opus_48khz_20ms_50kbps DISABLED_Opus_48khz_20ms_50kbps
1680 #define MAYBE_OpusFromFormat_48khz_20ms_50kbps \ 1680 #define MAYBE_OpusFromFormat_48khz_20ms_50kbps \
1681 DISABLED_OpusFromFormat_48khz_20ms_50kbps 1681 DISABLED_OpusFromFormat_48khz_20ms_50kbps
1682 #else 1682 #else
1683 #define MAYBE_Opus_48khz_20ms_50kbps Opus_48khz_20ms_50kbps 1683 #define MAYBE_Opus_48khz_20ms_50kbps Opus_48khz_20ms_50kbps
1684 #define MAYBE_OpusFromFormat_48khz_20ms_50kbps OpusFromFormat_48khz_20ms_50kbps 1684 #define MAYBE_OpusFromFormat_48khz_20ms_50kbps OpusFromFormat_48khz_20ms_50kbps
1685 #endif 1685 #endif
1686 TEST_F(AcmSetBitRateOldApi, MAYBE_Opus_48khz_20ms_50kbps) { 1686 TEST_F(AcmSetBitRateOldApi, MAYBE_Opus_48khz_20ms_50kbps) {
1687 ASSERT_NO_FATAL_FAILURE(SetUpTest("opus", 48000, 1, 107, 960, 960)); 1687 ASSERT_NO_FATAL_FAILURE(SetUpTest("opus", 48000, 1, 107, 960, 960));
1688 #if defined(WEBRTC_ANDROID) 1688 #if defined(WEBRTC_ANDROID)
1689 Run(50000, 47960); 1689 Run(50000, 47960);
1690 #else 1690 #else
1691 Run(50000, 49544); 1691 Run(50000, 49544);
1692 #endif // WEBRTC_ANDROID 1692 #endif // WEBRTC_ANDROID
1693 } 1693 }
1694 1694
1695 TEST_F(AcmSetBitRateNewApi, MAYBE_OpusFromFormat_48khz_20ms_50kbps) { 1695 TEST_F(AcmSetBitRateNewApi, MAYBE_OpusFromFormat_48khz_20ms_50kbps) {
1696 AudioEncoderOpus encoder( 1696 AudioEncoderOpusImpl encoder(
1697 107, SdpAudioFormat("opus", 48000, 2, {{"maxaveragebitrate", "50000"}})); 1697 107, SdpAudioFormat("opus", 48000, 2, {{"maxaveragebitrate", "50000"}}));
1698 ASSERT_TRUE(SetUpSender()); 1698 ASSERT_TRUE(SetUpSender());
1699 ASSERT_TRUE(RegisterExternalSendCodec(&encoder, 107)); 1699 ASSERT_TRUE(RegisterExternalSendCodec(&encoder, 107));
1700 #if defined(WEBRTC_ANDROID) 1700 #if defined(WEBRTC_ANDROID)
1701 RunInner(47960); 1701 RunInner(47960);
1702 #else 1702 #else
1703 RunInner(49544); 1703 RunInner(49544);
1704 #endif // WEBRTC_ANDROID 1704 #endif // WEBRTC_ANDROID
1705 } 1705 }
1706 1706
1707 // The result on the Android platforms is inconsistent for this test case. 1707 // The result on the Android platforms is inconsistent for this test case.
1708 // On android_rel the result is different from android and android arm64 rel. 1708 // On android_rel the result is different from android and android arm64 rel.
1709 #if defined(WEBRTC_ANDROID) || WEBRTC_OPUS_SUPPORT_120MS_PTIME 1709 #if defined(WEBRTC_ANDROID) || WEBRTC_OPUS_SUPPORT_120MS_PTIME
1710 #define MAYBE_Opus_48khz_20ms_100kbps DISABLED_Opus_48khz_20ms_100kbps 1710 #define MAYBE_Opus_48khz_20ms_100kbps DISABLED_Opus_48khz_20ms_100kbps
1711 #define MAYBE_OpusFromFormat_48khz_20ms_100kbps \ 1711 #define MAYBE_OpusFromFormat_48khz_20ms_100kbps \
1712 DISABLED_OpusFromFormat_48khz_20ms_100kbps 1712 DISABLED_OpusFromFormat_48khz_20ms_100kbps
1713 #else 1713 #else
1714 #define MAYBE_Opus_48khz_20ms_100kbps Opus_48khz_20ms_100kbps 1714 #define MAYBE_Opus_48khz_20ms_100kbps Opus_48khz_20ms_100kbps
1715 #define MAYBE_OpusFromFormat_48khz_20ms_100kbps \ 1715 #define MAYBE_OpusFromFormat_48khz_20ms_100kbps \
1716 OpusFromFormat_48khz_20ms_100kbps 1716 OpusFromFormat_48khz_20ms_100kbps
1717 #endif 1717 #endif
1718 TEST_F(AcmSetBitRateOldApi, MAYBE_Opus_48khz_20ms_100kbps) { 1718 TEST_F(AcmSetBitRateOldApi, MAYBE_Opus_48khz_20ms_100kbps) {
1719 ASSERT_NO_FATAL_FAILURE(SetUpTest("opus", 48000, 1, 107, 960, 960)); 1719 ASSERT_NO_FATAL_FAILURE(SetUpTest("opus", 48000, 1, 107, 960, 960));
1720 Run(100000, 100888); 1720 Run(100000, 100888);
1721 } 1721 }
1722 1722
1723 TEST_F(AcmSetBitRateNewApi, MAYBE_OpusFromFormat_48khz_20ms_100kbps) { 1723 TEST_F(AcmSetBitRateNewApi, MAYBE_OpusFromFormat_48khz_20ms_100kbps) {
1724 AudioEncoderOpus encoder( 1724 AudioEncoderOpusImpl encoder(
1725 107, SdpAudioFormat("opus", 48000, 2, {{"maxaveragebitrate", "100000"}})); 1725 107, SdpAudioFormat("opus", 48000, 2, {{"maxaveragebitrate", "100000"}}));
1726 ASSERT_TRUE(SetUpSender()); 1726 ASSERT_TRUE(SetUpSender());
1727 ASSERT_TRUE(RegisterExternalSendCodec(&encoder, 107)); 1727 ASSERT_TRUE(RegisterExternalSendCodec(&encoder, 107));
1728 RunInner(100888); 1728 RunInner(100888);
1729 } 1729 }
1730 1730
1731 // These next 2 tests ensure that the SetBitRate function has no effect on PCM 1731 // These next 2 tests ensure that the SetBitRate function has no effect on PCM
1732 TEST_F(AcmSetBitRateOldApi, Pcm16_8khz_10ms_8kbps) { 1732 TEST_F(AcmSetBitRateOldApi, Pcm16_8khz_10ms_8kbps) {
1733 ASSERT_NO_FATAL_FAILURE(SetUpTest("L16", 8000, 1, 107, 80, 80)); 1733 ASSERT_NO_FATAL_FAILURE(SetUpTest("L16", 8000, 1, 107, 80, 80));
1734 Run(8000, 128000); 1734 Run(8000, 128000);
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
2003 Run(16000, 8000, 1000); 2003 Run(16000, 8000, 1000);
2004 } 2004 }
2005 2005
2006 TEST_F(AcmSwitchingOutputFrequencyOldApi, Toggle8KhzTo16Khz) { 2006 TEST_F(AcmSwitchingOutputFrequencyOldApi, Toggle8KhzTo16Khz) {
2007 Run(8000, 16000, 1000); 2007 Run(8000, 16000, 1000);
2008 } 2008 }
2009 2009
2010 #endif 2010 #endif
2011 2011
2012 } // namespace webrtc 2012 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698