Chromium Code Reviews| 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 |
| 11 #include <stdio.h> | 11 #include <stdio.h> |
| 12 #include <string.h> | 12 #include <string.h> |
| 13 #include <memory> | 13 #include <memory> |
| 14 #include <vector> | 14 #include <vector> |
| 15 | 15 |
| 16 #include "webrtc/api/audio_codecs/builtin_audio_decoder_factory.h" | 16 #include "webrtc/api/audio_codecs/builtin_audio_decoder_factory.h" |
| 17 #include "webrtc/base/criticalsection.h" | 17 #include "webrtc/base/criticalsection.h" |
| 18 #include "webrtc/base/md5digest.h" | 18 #include "webrtc/base/md5digest.h" |
| 19 #include "webrtc/base/platform_thread.h" | 19 #include "webrtc/base/platform_thread.h" |
| 20 #include "webrtc/base/thread_annotations.h" | 20 #include "webrtc/base/thread_annotations.h" |
| 21 #include "webrtc/modules/audio_coding/acm2/acm_receive_test.h" | 21 #include "webrtc/modules/audio_coding/acm2/acm_receive_test.h" |
| 22 #include "webrtc/modules/audio_coding/acm2/acm_send_test.h" | 22 #include "webrtc/modules/audio_coding/acm2/acm_send_test.h" |
| 23 #include "webrtc/modules/audio_coding/codecs/audio_encoder.h" | 23 #include "webrtc/modules/audio_coding/codecs/audio_encoder.h" |
| 24 #include "webrtc/modules/audio_coding/codecs/audio_format_conversion.h" | 24 #include "webrtc/modules/audio_coding/codecs/audio_format_conversion.h" |
| 25 #include "webrtc/modules/audio_coding/codecs/g711/audio_decoder_pcm.h" | 25 #include "webrtc/modules/audio_coding/codecs/g711/audio_decoder_pcm.h" |
| 26 #include "webrtc/modules/audio_coding/codecs/g711/audio_encoder_pcm.h" | 26 #include "webrtc/modules/audio_coding/codecs/g711/audio_encoder_pcm.h" |
| 27 #include "webrtc/modules/audio_coding/codecs/isac/main/include/audio_encoder_isa c.h" | 27 #include "webrtc/modules/audio_coding/codecs/isac/main/include/audio_encoder_isa c.h" |
| 28 #include "webrtc/modules/audio_coding/codecs/mock/mock_audio_encoder.h" | 28 #include "webrtc/modules/audio_coding/codecs/mock/mock_audio_encoder.h" |
| 29 #include "webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus.h" | |
| 29 #include "webrtc/modules/audio_coding/include/audio_coding_module.h" | 30 #include "webrtc/modules/audio_coding/include/audio_coding_module.h" |
| 30 #include "webrtc/modules/audio_coding/include/audio_coding_module_typedefs.h" | 31 #include "webrtc/modules/audio_coding/include/audio_coding_module_typedefs.h" |
| 31 #include "webrtc/modules/audio_coding/neteq/audio_decoder_impl.h" | 32 #include "webrtc/modules/audio_coding/neteq/audio_decoder_impl.h" |
| 32 #include "webrtc/modules/audio_coding/neteq/mock/mock_audio_decoder.h" | 33 #include "webrtc/modules/audio_coding/neteq/mock/mock_audio_decoder.h" |
| 33 #include "webrtc/modules/audio_coding/neteq/tools/audio_checksum.h" | 34 #include "webrtc/modules/audio_coding/neteq/tools/audio_checksum.h" |
| 34 #include "webrtc/modules/audio_coding/neteq/tools/audio_loop.h" | 35 #include "webrtc/modules/audio_coding/neteq/tools/audio_loop.h" |
| 35 #include "webrtc/modules/audio_coding/neteq/tools/constant_pcm_packet_source.h" | 36 #include "webrtc/modules/audio_coding/neteq/tools/constant_pcm_packet_source.h" |
| 36 #include "webrtc/modules/audio_coding/neteq/tools/input_audio_file.h" | 37 #include "webrtc/modules/audio_coding/neteq/tools/input_audio_file.h" |
| 37 #include "webrtc/modules/audio_coding/neteq/tools/output_audio_file.h" | 38 #include "webrtc/modules/audio_coding/neteq/tools/output_audio_file.h" |
| 38 #include "webrtc/modules/audio_coding/neteq/tools/packet.h" | 39 #include "webrtc/modules/audio_coding/neteq/tools/packet.h" |
| (...skipping 1219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1258 std::unique_ptr<test::AcmSendTestOldApi> send_test_; | 1259 std::unique_ptr<test::AcmSendTestOldApi> send_test_; |
| 1259 std::unique_ptr<test::InputAudioFile> audio_source_; | 1260 std::unique_ptr<test::InputAudioFile> audio_source_; |
| 1260 uint32_t frame_size_rtp_timestamps_; | 1261 uint32_t frame_size_rtp_timestamps_; |
| 1261 int packet_count_; | 1262 int packet_count_; |
| 1262 uint8_t payload_type_; | 1263 uint8_t payload_type_; |
| 1263 uint16_t last_sequence_number_; | 1264 uint16_t last_sequence_number_; |
| 1264 uint32_t last_timestamp_; | 1265 uint32_t last_timestamp_; |
| 1265 rtc::Md5Digest payload_checksum_; | 1266 rtc::Md5Digest payload_checksum_; |
| 1266 }; | 1267 }; |
| 1267 | 1268 |
| 1269 class AcmSenderBitExactnessNewApi : public AcmSenderBitExactnessOldApi {}; | |
| 1270 | |
| 1268 #if defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX) | 1271 #if defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX) |
| 1269 TEST_F(AcmSenderBitExactnessOldApi, IsacWb30ms) { | 1272 TEST_F(AcmSenderBitExactnessOldApi, IsacWb30ms) { |
| 1270 ASSERT_NO_FATAL_FAILURE(SetUpTest("ISAC", 16000, 1, 103, 480, 480)); | 1273 ASSERT_NO_FATAL_FAILURE(SetUpTest("ISAC", 16000, 1, 103, 480, 480)); |
| 1271 Run(AcmReceiverBitExactnessOldApi::PlatformChecksum( | 1274 Run(AcmReceiverBitExactnessOldApi::PlatformChecksum( |
| 1272 "0b58f9eeee43d5891f5f6c75e77984a3", | 1275 "0b58f9eeee43d5891f5f6c75e77984a3", |
| 1273 "c7e5bdadfa2871df95639fcc297cf23d", | 1276 "c7e5bdadfa2871df95639fcc297cf23d", |
| 1274 "0499ca260390769b3172136faad925b9", | 1277 "0499ca260390769b3172136faad925b9", |
| 1275 "866abf524acd2807efbe65e133c23f95"), | 1278 "866abf524acd2807efbe65e133c23f95"), |
| 1276 AcmReceiverBitExactnessOldApi::PlatformChecksum( | 1279 AcmReceiverBitExactnessOldApi::PlatformChecksum( |
| 1277 "3c79f16f34218271f3dca4e2b1dfe1bb", | 1280 "3c79f16f34218271f3dca4e2b1dfe1bb", |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1482 "0de6249018fdd316c21086db84e10610", | 1485 "0de6249018fdd316c21086db84e10610", |
| 1483 "9c4cb69db77b85841a5f8225bb8f508b"), | 1486 "9c4cb69db77b85841a5f8225bb8f508b"), |
| 1484 AcmReceiverBitExactnessOldApi::PlatformChecksum( | 1487 AcmReceiverBitExactnessOldApi::PlatformChecksum( |
| 1485 "c7340b1189652ab6b5e80dade7390cb4", | 1488 "c7340b1189652ab6b5e80dade7390cb4", |
| 1486 "c7340b1189652ab6b5e80dade7390cb4", | 1489 "c7340b1189652ab6b5e80dade7390cb4", |
| 1487 "95612864c954ee63e28cc6eebad56626", | 1490 "95612864c954ee63e28cc6eebad56626", |
| 1488 "ae33ea2e43407cf9ebdabbbd6ca912a3"), | 1491 "ae33ea2e43407cf9ebdabbbd6ca912a3"), |
| 1489 50, test::AcmReceiveTestOldApi::kStereoOutput); | 1492 50, test::AcmReceiveTestOldApi::kStereoOutput); |
| 1490 } | 1493 } |
| 1491 | 1494 |
| 1495 static const SdpAudioFormat kOpusFormat("opus", 48000, 2, {{"stereo", "1"}}); | |
|
kwiberg-webrtc
2017/03/24 12:43:24
The style guide prohibits this: https://google.git
ossu
2017/04/05 14:41:51
I don't see how this would break in practice, even
| |
| 1496 | |
| 1497 TEST_F(AcmSenderBitExactnessNewApi, OpusFromFormat_stereo_20ms) { | |
|
minyue-webrtc
2017/03/23 11:36:53
need to carefully exclude newer Opus version, do t
ossu
2017/03/23 12:01:59
Alright. Will keep that in mind.
minyue-webrtc
2017/03/23 12:20:22
Make sure you do it before submit, otherwise may b
ossu
2017/04/05 14:41:51
I've added the MAYBE_ macros for the tests below.
| |
| 1498 std::unique_ptr<AudioEncoder> encoder( | |
| 1499 new AudioEncoderOpus(120, kOpusFormat)); | |
|
kwiberg-webrtc
2017/03/24 12:43:24
Put this on the stack instead of on the heap? (I c
ossu
2017/04/05 14:41:51
Acknowledged.
| |
| 1500 ASSERT_NO_FATAL_FAILURE(SetUpTestExternalEncoder(encoder.get(), 120)); | |
| 1501 Run(AcmReceiverBitExactnessOldApi::PlatformChecksum( | |
| 1502 "855041f2490b887302bce9d544731849", | |
| 1503 "855041f2490b887302bce9d544731849", | |
| 1504 "9692eede45638eb425e0daf9c75b5c7a", | |
| 1505 "86d3552bb3492247f965cdd0e88a1c82"), | |
| 1506 AcmReceiverBitExactnessOldApi::PlatformChecksum( | |
| 1507 "d781cce1ab986b618d0da87226cdde30", | |
| 1508 "d781cce1ab986b618d0da87226cdde30", | |
| 1509 "8d6782b905c3230d4b0e3e83e1fc3439", | |
| 1510 "798347a685fac7d0c2d8f748ffe66881"), | |
| 1511 50, test::AcmReceiveTestOldApi::kStereoOutput); | |
| 1512 } | |
| 1513 | |
| 1514 TEST_F(AcmSenderBitExactnessNewApi, OpusFromFormat_stereo_20ms_voip) { | |
| 1515 std::unique_ptr<AudioEncoder> encoder( | |
| 1516 new AudioEncoderOpus(120, kOpusFormat)); | |
| 1517 ASSERT_NO_FATAL_FAILURE(SetUpTestExternalEncoder(encoder.get(), 120)); | |
| 1518 // If not set, default will be kAudio in case of stereo. | |
| 1519 EXPECT_EQ(0, send_test_->acm()->SetOpusApplication(kVoip)); | |
| 1520 Run(AcmReceiverBitExactnessOldApi::PlatformChecksum( | |
| 1521 "9b9e12bc3cc793740966e11cbfa8b35b", | |
| 1522 "9b9e12bc3cc793740966e11cbfa8b35b", | |
| 1523 "0de6249018fdd316c21086db84e10610", | |
| 1524 "9c4cb69db77b85841a5f8225bb8f508b"), | |
| 1525 AcmReceiverBitExactnessOldApi::PlatformChecksum( | |
| 1526 "c7340b1189652ab6b5e80dade7390cb4", | |
| 1527 "c7340b1189652ab6b5e80dade7390cb4", | |
| 1528 "95612864c954ee63e28cc6eebad56626", | |
| 1529 "ae33ea2e43407cf9ebdabbbd6ca912a3"), | |
| 1530 50, test::AcmReceiveTestOldApi::kStereoOutput); | |
| 1531 } | |
| 1532 | |
| 1492 // This test is for verifying the SetBitRate function. The bitrate is changed at | 1533 // This test is for verifying the SetBitRate function. The bitrate is changed at |
| 1493 // the beginning, and the number of generated bytes are checked. | 1534 // the beginning, and the number of generated bytes are checked. |
| 1494 class AcmSetBitRateOldApi : public ::testing::Test { | 1535 class AcmSetBitRateTest : public ::testing::Test { |
| 1495 protected: | 1536 protected: |
| 1496 static const int kTestDurationMs = 1000; | 1537 static const int kTestDurationMs = 1000; |
| 1497 | 1538 |
| 1498 // Sets up the test::AcmSendTest object. Returns true on success, otherwise | 1539 // Sets up the test::AcmSendTest object. Returns true on success, otherwise |
| 1499 // false. | 1540 // false. |
| 1500 bool SetUpSender() { | 1541 bool SetUpSender() { |
| 1501 const std::string input_file_name = | 1542 const std::string input_file_name = |
| 1502 webrtc::test::ResourcePath("audio_coding/testfile32kHz", "pcm"); | 1543 webrtc::test::ResourcePath("audio_coding/testfile32kHz", "pcm"); |
| 1503 // Note that |audio_source_| will loop forever. The test duration is set | 1544 // Note that |audio_source_| will loop forever. The test duration is set |
| 1504 // explicitly by |kTestDurationMs|. | 1545 // explicitly by |kTestDurationMs|. |
| 1505 audio_source_.reset(new test::InputAudioFile(input_file_name)); | 1546 audio_source_.reset(new test::InputAudioFile(input_file_name)); |
| 1506 static const int kSourceRateHz = 32000; | 1547 static const int kSourceRateHz = 32000; |
| 1507 send_test_.reset(new test::AcmSendTestOldApi( | 1548 send_test_.reset(new test::AcmSendTestOldApi( |
| 1508 audio_source_.get(), kSourceRateHz, kTestDurationMs)); | 1549 audio_source_.get(), kSourceRateHz, kTestDurationMs)); |
| 1509 return send_test_.get(); | 1550 return send_test_.get(); |
| 1510 } | 1551 } |
| 1511 | 1552 |
| 1512 // Registers a send codec in the test::AcmSendTest object. Returns true on | 1553 // Registers a send codec in the test::AcmSendTest object. Returns true on |
| 1513 // success, false on failure. | 1554 // success, false on failure. |
| 1514 virtual bool RegisterSendCodec(const char* payload_name, | 1555 virtual bool RegisterSendCodec(const char* payload_name, |
| 1515 int sampling_freq_hz, | 1556 int sampling_freq_hz, |
| 1516 int channels, | 1557 int channels, |
| 1517 int payload_type, | 1558 int payload_type, |
| 1518 int frame_size_samples, | 1559 int frame_size_samples, |
| 1519 int frame_size_rtp_timestamps) { | 1560 int frame_size_rtp_timestamps) { |
| 1520 return send_test_->RegisterCodec(payload_name, sampling_freq_hz, channels, | 1561 return send_test_->RegisterCodec(payload_name, sampling_freq_hz, channels, |
| 1521 payload_type, frame_size_samples); | 1562 payload_type, frame_size_samples); |
| 1522 } | 1563 } |
| 1523 | 1564 |
| 1524 // Runs the test. SetUpSender() and RegisterSendCodec() must have been called | 1565 bool RegisterExternalSendCodec(AudioEncoder* external_speech_encoder, |
| 1525 // before calling this method. | 1566 int payload_type) { |
| 1526 void Run(int target_bitrate_bps, int expected_total_bits) { | 1567 return send_test_->RegisterExternalCodec(external_speech_encoder); |
| 1527 ASSERT_TRUE(send_test_->acm()); | 1568 } |
| 1528 send_test_->acm()->SetBitRate(target_bitrate_bps); | 1569 |
| 1570 void RunInner(int expected_total_bits) { | |
| 1529 int nr_bytes = 0; | 1571 int nr_bytes = 0; |
| 1530 while (std::unique_ptr<test::Packet> next_packet = | 1572 while (std::unique_ptr<test::Packet> next_packet = |
| 1531 send_test_->NextPacket()) { | 1573 send_test_->NextPacket()) { |
| 1532 nr_bytes += next_packet->payload_length_bytes(); | 1574 nr_bytes += next_packet->payload_length_bytes(); |
| 1533 } | 1575 } |
| 1534 EXPECT_EQ(expected_total_bits, nr_bytes * 8); | 1576 EXPECT_EQ(expected_total_bits, nr_bytes * 8); |
| 1535 } | 1577 } |
| 1536 | 1578 |
| 1537 void SetUpTest(const char* codec_name, | 1579 void SetUpTest(const char* codec_name, |
| 1538 int codec_sample_rate_hz, | 1580 int codec_sample_rate_hz, |
| 1539 int channels, | 1581 int channels, |
| 1540 int payload_type, | 1582 int payload_type, |
| 1541 int codec_frame_size_samples, | 1583 int codec_frame_size_samples, |
| 1542 int codec_frame_size_rtp_timestamps) { | 1584 int codec_frame_size_rtp_timestamps) { |
| 1543 ASSERT_TRUE(SetUpSender()); | 1585 ASSERT_TRUE(SetUpSender()); |
| 1544 ASSERT_TRUE(RegisterSendCodec(codec_name, codec_sample_rate_hz, channels, | 1586 ASSERT_TRUE(RegisterSendCodec(codec_name, codec_sample_rate_hz, channels, |
| 1545 payload_type, codec_frame_size_samples, | 1587 payload_type, codec_frame_size_samples, |
| 1546 codec_frame_size_rtp_timestamps)); | 1588 codec_frame_size_rtp_timestamps)); |
| 1547 } | 1589 } |
| 1548 | 1590 |
| 1549 std::unique_ptr<test::AcmSendTestOldApi> send_test_; | 1591 std::unique_ptr<test::AcmSendTestOldApi> send_test_; |
| 1550 std::unique_ptr<test::InputAudioFile> audio_source_; | 1592 std::unique_ptr<test::InputAudioFile> audio_source_; |
| 1551 }; | 1593 }; |
| 1552 | 1594 |
| 1595 class AcmSetBitRateOldApi : public AcmSetBitRateTest { | |
| 1596 protected: | |
| 1597 // Runs the test. SetUpSender() must have been called and a codec must be set | |
| 1598 // up before calling this method. | |
| 1599 void Run(int target_bitrate_bps, int expected_total_bits) { | |
| 1600 ASSERT_TRUE(send_test_->acm()); | |
| 1601 send_test_->acm()->SetBitRate(target_bitrate_bps); | |
| 1602 RunInner(expected_total_bits); | |
| 1603 } | |
| 1604 }; | |
| 1605 | |
| 1606 class AcmSetBitRateNewApi : public AcmSetBitRateTest { | |
| 1607 protected: | |
| 1608 // Runs the test. SetUpSender() must have been called and a codec must be set | |
| 1609 // up before calling this method. | |
| 1610 void Run(int expected_total_bits) { | |
| 1611 RunInner(expected_total_bits); | |
| 1612 } | |
| 1613 }; | |
| 1614 | |
| 1553 TEST_F(AcmSetBitRateOldApi, Opus_48khz_20ms_10kbps) { | 1615 TEST_F(AcmSetBitRateOldApi, Opus_48khz_20ms_10kbps) { |
| 1554 ASSERT_NO_FATAL_FAILURE(SetUpTest("opus", 48000, 1, 107, 960, 960)); | 1616 ASSERT_NO_FATAL_FAILURE(SetUpTest("opus", 48000, 1, 107, 960, 960)); |
| 1555 #if defined(WEBRTC_ANDROID) | 1617 #if defined(WEBRTC_ANDROID) |
| 1556 Run(10000, 9288); | 1618 Run(10000, 9288); |
| 1557 #else | 1619 #else |
| 1558 Run(10000, 9024); | 1620 Run(10000, 9024); |
| 1559 #endif // WEBRTC_ANDROID | 1621 #endif // WEBRTC_ANDROID |
| 1560 } | 1622 } |
| 1561 | 1623 |
| 1562 TEST_F(AcmSetBitRateOldApi, Opus_48khz_20ms_50kbps) { | 1624 TEST_F(AcmSetBitRateOldApi, Opus_48khz_20ms_50kbps) { |
| 1563 ASSERT_NO_FATAL_FAILURE(SetUpTest("opus", 48000, 1, 107, 960, 960)); | 1625 ASSERT_NO_FATAL_FAILURE(SetUpTest("opus", 48000, 1, 107, 960, 960)); |
| 1564 #if defined(WEBRTC_ANDROID) | 1626 #if defined(WEBRTC_ANDROID) |
| 1565 Run(50000, 47960); | 1627 Run(50000, 47960); |
| 1566 #else | 1628 #else |
| 1567 Run(50000, 49544); | 1629 Run(50000, 49544); |
| 1568 #endif // WEBRTC_ANDROID | 1630 #endif // WEBRTC_ANDROID |
| 1569 } | 1631 } |
| 1570 | 1632 |
| 1633 | |
| 1571 // The result on the Android platforms is inconsistent for this test case. | 1634 // The result on the Android platforms is inconsistent for this test case. |
| 1572 // On android_rel the result is different from android and android arm64 rel. | 1635 // On android_rel the result is different from android and android arm64 rel. |
| 1573 #if defined(WEBRTC_ANDROID) | 1636 #if defined(WEBRTC_ANDROID) |
| 1574 #define MAYBE_Opus_48khz_20ms_100kbps DISABLED_Opus_48khz_20ms_100kbps | 1637 #define MAYBE_Opus_48khz_20ms_100kbps DISABLED_Opus_48khz_20ms_100kbps |
| 1638 #define MAYBE_OpusFromFormat_48khz_20ms_100kbps \ | |
|
minyue-webrtc
2017/03/23 11:36:53
same here
| |
| 1639 DISABLED_OpusFromFormat_48khz_20ms_100kbps | |
| 1575 #else | 1640 #else |
| 1576 #define MAYBE_Opus_48khz_20ms_100kbps Opus_48khz_20ms_100kbps | 1641 #define MAYBE_Opus_48khz_20ms_100kbps Opus_48khz_20ms_100kbps |
| 1642 #define MAYBE_OpusFromFormat_48khz_20ms_100kbps \ | |
| 1643 OpusFromFormat_48khz_20ms_100kbps | |
| 1577 #endif | 1644 #endif |
| 1578 TEST_F(AcmSetBitRateOldApi, MAYBE_Opus_48khz_20ms_100kbps) { | 1645 TEST_F(AcmSetBitRateOldApi, MAYBE_Opus_48khz_20ms_100kbps) { |
| 1579 ASSERT_NO_FATAL_FAILURE(SetUpTest("opus", 48000, 1, 107, 960, 960)); | 1646 ASSERT_NO_FATAL_FAILURE(SetUpTest("opus", 48000, 1, 107, 960, 960)); |
| 1580 Run(100000, 100888); | 1647 Run(100000, 100888); |
| 1581 } | 1648 } |
| 1582 | 1649 |
| 1650 TEST_F(AcmSetBitRateNewApi, OpusFromFormat_48khz_20ms_10kbps) { | |
| 1651 std::unique_ptr<AudioEncoder> encoder(new AudioEncoderOpus( | |
| 1652 107, SdpAudioFormat("opus", 48000, 2, {{"maxaveragebitrate", "10000"}}))); | |
| 1653 ASSERT_TRUE(SetUpSender()); | |
| 1654 ASSERT_TRUE(RegisterExternalSendCodec(encoder.get(), 107)); | |
| 1655 #if defined(WEBRTC_ANDROID) | |
| 1656 RunInner(9288); | |
| 1657 #else | |
| 1658 RunInner(9024); | |
| 1659 #endif // WEBRTC_ANDROID | |
| 1660 } | |
| 1661 | |
| 1662 TEST_F(AcmSetBitRateNewApi, OpusFromFormat_48khz_20ms_50kbps) { | |
| 1663 std::unique_ptr<AudioEncoder> encoder(new AudioEncoderOpus( | |
| 1664 107, SdpAudioFormat("opus", 48000, 2, {{"maxaveragebitrate", "50000"}}))); | |
| 1665 ASSERT_TRUE(SetUpSender()); | |
| 1666 ASSERT_TRUE(RegisterExternalSendCodec(encoder.get(), 107)); | |
| 1667 #if defined(WEBRTC_ANDROID) | |
| 1668 RunInner(47960); | |
| 1669 #else | |
| 1670 RunInner(49544); | |
| 1671 #endif // WEBRTC_ANDROID | |
| 1672 } | |
| 1673 | |
| 1674 TEST_F(AcmSetBitRateNewApi, MAYBE_OpusFromFormat_48khz_20ms_100kbps) { | |
| 1675 std::unique_ptr<AudioEncoder> encoder(new AudioEncoderOpus( | |
| 1676 107, | |
| 1677 SdpAudioFormat("opus", 48000, 2, {{"maxaveragebitrate", "100000"}}))); | |
| 1678 ASSERT_TRUE(SetUpSender()); | |
| 1679 ASSERT_TRUE(RegisterExternalSendCodec(encoder.get(), 107)); | |
| 1680 RunInner(100888); | |
| 1681 } | |
| 1682 | |
| 1583 // These next 2 tests ensure that the SetBitRate function has no effect on PCM | 1683 // These next 2 tests ensure that the SetBitRate function has no effect on PCM |
| 1584 TEST_F(AcmSetBitRateOldApi, Pcm16_8khz_10ms_8kbps) { | 1684 TEST_F(AcmSetBitRateOldApi, Pcm16_8khz_10ms_8kbps) { |
| 1585 ASSERT_NO_FATAL_FAILURE(SetUpTest("L16", 8000, 1, 107, 80, 80)); | 1685 ASSERT_NO_FATAL_FAILURE(SetUpTest("L16", 8000, 1, 107, 80, 80)); |
| 1586 Run(8000, 128000); | 1686 Run(8000, 128000); |
| 1587 } | 1687 } |
| 1588 | 1688 |
| 1589 TEST_F(AcmSetBitRateOldApi, Pcm16_8khz_10ms_32kbps) { | 1689 TEST_F(AcmSetBitRateOldApi, Pcm16_8khz_10ms_32kbps) { |
| 1590 ASSERT_NO_FATAL_FAILURE(SetUpTest("L16", 8000, 1, 107, 80, 80)); | 1690 ASSERT_NO_FATAL_FAILURE(SetUpTest("L16", 8000, 1, 107, 80, 80)); |
| 1591 Run(32000, 128000); | 1691 Run(32000, 128000); |
| 1592 } | 1692 } |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1839 Run(16000, 8000, 1000); | 1939 Run(16000, 8000, 1000); |
| 1840 } | 1940 } |
| 1841 | 1941 |
| 1842 TEST_F(AcmSwitchingOutputFrequencyOldApi, Toggle8KhzTo16Khz) { | 1942 TEST_F(AcmSwitchingOutputFrequencyOldApi, Toggle8KhzTo16Khz) { |
| 1843 Run(8000, 16000, 1000); | 1943 Run(8000, 16000, 1000); |
| 1844 } | 1944 } |
| 1845 | 1945 |
| 1846 #endif | 1946 #endif |
| 1847 | 1947 |
| 1848 } // namespace webrtc | 1948 } // namespace webrtc |
| OLD | NEW |