| OLD | NEW |
| 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 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1044 return format.name == "MockPCMu" ? std::move(mock_decoder_) | 1044 return format.name == "MockPCMu" ? std::move(mock_decoder_) |
| 1045 : fact_->MakeAudioDecoder(format); | 1045 : fact_->MakeAudioDecoder(format); |
| 1046 } | 1046 } |
| 1047 | 1047 |
| 1048 private: | 1048 private: |
| 1049 // Class intended to forward a call from a mock DecodeInternal to Decode on | 1049 // Class intended to forward a call from a mock DecodeInternal to Decode on |
| 1050 // the real decoder's Decode. DecodeInternal for the real decoder isn't | 1050 // the real decoder's Decode. DecodeInternal for the real decoder isn't |
| 1051 // public. | 1051 // public. |
| 1052 class DecodeForwarder { | 1052 class DecodeForwarder { |
| 1053 public: | 1053 public: |
| 1054 DecodeForwarder(AudioDecoder* decoder) : decoder_(decoder) {} | 1054 explicit DecodeForwarder(AudioDecoder* decoder) : decoder_(decoder) {} |
| 1055 int Decode(const uint8_t* encoded, | 1055 int Decode(const uint8_t* encoded, |
| 1056 size_t encoded_len, | 1056 size_t encoded_len, |
| 1057 int sample_rate_hz, | 1057 int sample_rate_hz, |
| 1058 int16_t* decoded, | 1058 int16_t* decoded, |
| 1059 AudioDecoder::SpeechType* speech_type) { | 1059 AudioDecoder::SpeechType* speech_type) { |
| 1060 return decoder_->Decode(encoded, encoded_len, sample_rate_hz, | 1060 return decoder_->Decode(encoded, encoded_len, sample_rate_hz, |
| 1061 decoder_->PacketDuration(encoded, encoded_len) * | 1061 decoder_->PacketDuration(encoded, encoded_len) * |
| 1062 decoder_->Channels() * sizeof(int16_t), | 1062 decoder_->Channels() * sizeof(int16_t), |
| 1063 decoded, speech_type); | 1063 decoded, speech_type); |
| 1064 } | 1064 } |
| (...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1543 std::unique_ptr<test::AcmSendTestOldApi> send_test_; | 1543 std::unique_ptr<test::AcmSendTestOldApi> send_test_; |
| 1544 std::unique_ptr<test::InputAudioFile> audio_source_; | 1544 std::unique_ptr<test::InputAudioFile> audio_source_; |
| 1545 }; | 1545 }; |
| 1546 | 1546 |
| 1547 TEST_F(AcmSetBitRateOldApi, Opus_48khz_20ms_10kbps) { | 1547 TEST_F(AcmSetBitRateOldApi, Opus_48khz_20ms_10kbps) { |
| 1548 ASSERT_NO_FATAL_FAILURE(SetUpTest("opus", 48000, 1, 107, 960, 960)); | 1548 ASSERT_NO_FATAL_FAILURE(SetUpTest("opus", 48000, 1, 107, 960, 960)); |
| 1549 #if defined(WEBRTC_ANDROID) | 1549 #if defined(WEBRTC_ANDROID) |
| 1550 Run(10000, 9288); | 1550 Run(10000, 9288); |
| 1551 #else | 1551 #else |
| 1552 Run(10000, 9024); | 1552 Run(10000, 9024); |
| 1553 #endif // WEBRTC_ANDROID | 1553 #endif // WEBRTC_ANDROID |
| 1554 | |
| 1555 } | 1554 } |
| 1556 | 1555 |
| 1557 TEST_F(AcmSetBitRateOldApi, Opus_48khz_20ms_50kbps) { | 1556 TEST_F(AcmSetBitRateOldApi, Opus_48khz_20ms_50kbps) { |
| 1558 ASSERT_NO_FATAL_FAILURE(SetUpTest("opus", 48000, 1, 107, 960, 960)); | 1557 ASSERT_NO_FATAL_FAILURE(SetUpTest("opus", 48000, 1, 107, 960, 960)); |
| 1559 #if defined(WEBRTC_ANDROID) | 1558 #if defined(WEBRTC_ANDROID) |
| 1560 Run(50000, 47960); | 1559 Run(50000, 47960); |
| 1561 #else | 1560 #else |
| 1562 Run(50000, 49544); | 1561 Run(50000, 49544); |
| 1563 #endif // WEBRTC_ANDROID | 1562 #endif // WEBRTC_ANDROID |
| 1564 } | 1563 } |
| 1565 | 1564 |
| 1566 // The result on the Android platforms is inconsistent for this test case. | 1565 // The result on the Android platforms is inconsistent for this test case. |
| 1567 // On android_rel the result is different from android and android arm64 rel. | 1566 // On android_rel the result is different from android and android arm64 rel. |
| 1568 #if defined(WEBRTC_ANDROID) | 1567 #if defined(WEBRTC_ANDROID) |
| 1569 #define MAYBE_Opus_48khz_20ms_100kbps DISABLED_Opus_48khz_20ms_100kbps | 1568 #define MAYBE_Opus_48khz_20ms_100kbps DISABLED_Opus_48khz_20ms_100kbps |
| 1570 #else | 1569 #else |
| 1571 #define MAYBE_Opus_48khz_20ms_100kbps Opus_48khz_20ms_100kbps | 1570 #define MAYBE_Opus_48khz_20ms_100kbps Opus_48khz_20ms_100kbps |
| 1572 #endif | 1571 #endif |
| 1573 TEST_F(AcmSetBitRateOldApi, MAYBE_Opus_48khz_20ms_100kbps) { | 1572 TEST_F(AcmSetBitRateOldApi, MAYBE_Opus_48khz_20ms_100kbps) { |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1635 uint32_t sampling_freq_hz_; | 1634 uint32_t sampling_freq_hz_; |
| 1636 uint32_t frame_size_samples_; | 1635 uint32_t frame_size_samples_; |
| 1637 }; | 1636 }; |
| 1638 | 1637 |
| 1639 TEST_F(AcmChangeBitRateOldApi, Opus_48khz_20ms_10kbps) { | 1638 TEST_F(AcmChangeBitRateOldApi, Opus_48khz_20ms_10kbps) { |
| 1640 ASSERT_NO_FATAL_FAILURE(SetUpTest("opus", 48000, 1, 107, 960, 960)); | 1639 ASSERT_NO_FATAL_FAILURE(SetUpTest("opus", 48000, 1, 107, 960, 960)); |
| 1641 #if defined(WEBRTC_ANDROID) | 1640 #if defined(WEBRTC_ANDROID) |
| 1642 Run(10000, 32200, 5176); | 1641 Run(10000, 32200, 5176); |
| 1643 #else | 1642 #else |
| 1644 Run(10000, 32200, 5456); | 1643 Run(10000, 32200, 5456); |
| 1645 #endif // WEBRTC_ANDROID | 1644 #endif // WEBRTC_ANDROID |
| 1646 } | 1645 } |
| 1647 | 1646 |
| 1648 TEST_F(AcmChangeBitRateOldApi, Opus_48khz_20ms_50kbps) { | 1647 TEST_F(AcmChangeBitRateOldApi, Opus_48khz_20ms_50kbps) { |
| 1649 ASSERT_NO_FATAL_FAILURE(SetUpTest("opus", 48000, 1, 107, 960, 960)); | 1648 ASSERT_NO_FATAL_FAILURE(SetUpTest("opus", 48000, 1, 107, 960, 960)); |
| 1650 #if defined(WEBRTC_ANDROID) | 1649 #if defined(WEBRTC_ANDROID) |
| 1651 Run(50000, 32200, 24768); | 1650 Run(50000, 32200, 24768); |
| 1652 #else | 1651 #else |
| 1653 Run(50000, 32200, 24848); | 1652 Run(50000, 32200, 24848); |
| 1654 #endif // WEBRTC_ANDROID | 1653 #endif // WEBRTC_ANDROID |
| 1655 } | 1654 } |
| 1656 | 1655 |
| 1657 TEST_F(AcmChangeBitRateOldApi, Opus_48khz_20ms_100kbps) { | 1656 TEST_F(AcmChangeBitRateOldApi, Opus_48khz_20ms_100kbps) { |
| 1658 ASSERT_NO_FATAL_FAILURE(SetUpTest("opus", 48000, 1, 107, 960, 960)); | 1657 ASSERT_NO_FATAL_FAILURE(SetUpTest("opus", 48000, 1, 107, 960, 960)); |
| 1659 #if defined(WEBRTC_ANDROID) | 1658 #if defined(WEBRTC_ANDROID) |
| 1660 #if defined(WEBRTC_ARCH_ARM64) | 1659 #if defined(WEBRTC_ARCH_ARM64) |
| 1661 Run(100000, 32200, 51152); | 1660 Run(100000, 32200, 51152); |
| 1662 #else | 1661 #else |
| 1663 Run(100000, 32200, 51248); | 1662 Run(100000, 32200, 51248); |
| 1664 #endif // WEBRTC_ARCH_ARM64 | 1663 #endif // WEBRTC_ARCH_ARM64 |
| 1665 #else | 1664 #else |
| 1666 Run(100000, 32200, 50584); | 1665 Run(100000, 32200, 50584); |
| 1667 #endif // WEBRTC_ANDROID | 1666 #endif // WEBRTC_ANDROID |
| 1668 } | 1667 } |
| 1669 | 1668 |
| 1670 // These next 2 tests ensure that the SetBitRate function has no effect on PCM | 1669 // These next 2 tests ensure that the SetBitRate function has no effect on PCM |
| 1671 TEST_F(AcmChangeBitRateOldApi, Pcm16_8khz_10ms_8kbps) { | 1670 TEST_F(AcmChangeBitRateOldApi, Pcm16_8khz_10ms_8kbps) { |
| 1672 ASSERT_NO_FATAL_FAILURE(SetUpTest("L16", 8000, 1, 107, 80, 80)); | 1671 ASSERT_NO_FATAL_FAILURE(SetUpTest("L16", 8000, 1, 107, 80, 80)); |
| 1673 Run(8000, 64000, 64000); | 1672 Run(8000, 64000, 64000); |
| 1674 } | 1673 } |
| 1675 | 1674 |
| 1676 TEST_F(AcmChangeBitRateOldApi, Pcm16_8khz_10ms_32kbps) { | 1675 TEST_F(AcmChangeBitRateOldApi, Pcm16_8khz_10ms_32kbps) { |
| 1677 ASSERT_NO_FATAL_FAILURE(SetUpTest("L16", 8000, 1, 107, 80, 80)); | 1676 ASSERT_NO_FATAL_FAILURE(SetUpTest("L16", 8000, 1, 107, 80, 80)); |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1834 Run(16000, 8000, 1000); | 1833 Run(16000, 8000, 1000); |
| 1835 } | 1834 } |
| 1836 | 1835 |
| 1837 TEST_F(AcmSwitchingOutputFrequencyOldApi, Toggle8KhzTo16Khz) { | 1836 TEST_F(AcmSwitchingOutputFrequencyOldApi, Toggle8KhzTo16Khz) { |
| 1838 Run(8000, 16000, 1000); | 1837 Run(8000, 16000, 1000); |
| 1839 } | 1838 } |
| 1840 | 1839 |
| 1841 #endif | 1840 #endif |
| 1842 | 1841 |
| 1843 } // namespace webrtc | 1842 } // namespace webrtc |
| OLD | NEW |