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

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

Issue 1547343002: Remove DISABLED_ON_ macros. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: MAYBE_ yo Created 4 years, 11 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 23 matching lines...) Expand all
34 #include "webrtc/modules/audio_coding/neteq/tools/input_audio_file.h" 34 #include "webrtc/modules/audio_coding/neteq/tools/input_audio_file.h"
35 #include "webrtc/modules/audio_coding/neteq/tools/output_audio_file.h" 35 #include "webrtc/modules/audio_coding/neteq/tools/output_audio_file.h"
36 #include "webrtc/modules/audio_coding/neteq/tools/packet.h" 36 #include "webrtc/modules/audio_coding/neteq/tools/packet.h"
37 #include "webrtc/modules/audio_coding/neteq/tools/rtp_file_source.h" 37 #include "webrtc/modules/audio_coding/neteq/tools/rtp_file_source.h"
38 #include "webrtc/modules/include/module_common_types.h" 38 #include "webrtc/modules/include/module_common_types.h"
39 #include "webrtc/system_wrappers/include/clock.h" 39 #include "webrtc/system_wrappers/include/clock.h"
40 #include "webrtc/system_wrappers/include/critical_section_wrapper.h" 40 #include "webrtc/system_wrappers/include/critical_section_wrapper.h"
41 #include "webrtc/system_wrappers/include/event_wrapper.h" 41 #include "webrtc/system_wrappers/include/event_wrapper.h"
42 #include "webrtc/system_wrappers/include/sleep.h" 42 #include "webrtc/system_wrappers/include/sleep.h"
43 #include "webrtc/test/testsupport/fileutils.h" 43 #include "webrtc/test/testsupport/fileutils.h"
44 #include "webrtc/test/testsupport/gtest_disable.h"
45 44
46 using ::testing::AtLeast; 45 using ::testing::AtLeast;
47 using ::testing::Invoke; 46 using ::testing::Invoke;
48 using ::testing::_; 47 using ::testing::_;
49 48
50 namespace webrtc { 49 namespace webrtc {
51 50
52 namespace { 51 namespace {
53 const int kSampleRateHz = 16000; 52 const int kSampleRateHz = 16000;
54 const int kNumSamples10ms = kSampleRateHz / 100; 53 const int kNumSamples10ms = kSampleRateHz / 100;
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 rtc::scoped_ptr<AudioCodingModule> acm_; 230 rtc::scoped_ptr<AudioCodingModule> acm_;
232 PacketizationCallbackStubOldApi packet_cb_; 231 PacketizationCallbackStubOldApi packet_cb_;
233 WebRtcRTPHeader rtp_header_; 232 WebRtcRTPHeader rtp_header_;
234 AudioFrame input_frame_; 233 AudioFrame input_frame_;
235 CodecInst codec_; 234 CodecInst codec_;
236 Clock* clock_; 235 Clock* clock_;
237 }; 236 };
238 237
239 // Check if the statistics are initialized correctly. Before any call to ACM 238 // Check if the statistics are initialized correctly. Before any call to ACM
240 // all fields have to be zero. 239 // all fields have to be zero.
241 TEST_F(AudioCodingModuleTestOldApi, DISABLED_ON_ANDROID(InitializedToZero)) { 240 #if defined(WEBRTC_ANDROID)
241 #define MAYBE_InitializedToZero DISABLED_InitializedToZero
242 #else
243 #define MAYBE_InitializedToZero InitializedToZero
244 #endif
245 TEST_F(AudioCodingModuleTestOldApi, MAYBE_InitializedToZero) {
242 RegisterCodec(); 246 RegisterCodec();
243 AudioDecodingCallStats stats; 247 AudioDecodingCallStats stats;
244 acm_->GetDecodingCallStatistics(&stats); 248 acm_->GetDecodingCallStatistics(&stats);
245 EXPECT_EQ(0, stats.calls_to_neteq); 249 EXPECT_EQ(0, stats.calls_to_neteq);
246 EXPECT_EQ(0, stats.calls_to_silence_generator); 250 EXPECT_EQ(0, stats.calls_to_silence_generator);
247 EXPECT_EQ(0, stats.decoded_normal); 251 EXPECT_EQ(0, stats.decoded_normal);
248 EXPECT_EQ(0, stats.decoded_cng); 252 EXPECT_EQ(0, stats.decoded_cng);
249 EXPECT_EQ(0, stats.decoded_plc); 253 EXPECT_EQ(0, stats.decoded_plc);
250 EXPECT_EQ(0, stats.decoded_plc_cng); 254 EXPECT_EQ(0, stats.decoded_plc_cng);
251 } 255 }
252 256
253 // Insert some packets and pull audio. Check statistics are valid. Then, 257 // Insert some packets and pull audio. Check statistics are valid. Then,
254 // simulate packet loss and check if PLC and PLC-to-CNG statistics are 258 // simulate packet loss and check if PLC and PLC-to-CNG statistics are
255 // correctly updated. 259 // correctly updated.
256 TEST_F(AudioCodingModuleTestOldApi, DISABLED_ON_ANDROID(NetEqCalls)) { 260 #if defined(WEBRTC_ANDROID)
261 #define MAYBE_NetEqCalls DISABLED_NetEqCalls
262 #else
263 #define MAYBE_NetEqCalls NetEqCalls
264 #endif
265 TEST_F(AudioCodingModuleTestOldApi, MAYBE_NetEqCalls) {
257 RegisterCodec(); 266 RegisterCodec();
258 AudioDecodingCallStats stats; 267 AudioDecodingCallStats stats;
259 const int kNumNormalCalls = 10; 268 const int kNumNormalCalls = 10;
260 269
261 for (int num_calls = 0; num_calls < kNumNormalCalls; ++num_calls) { 270 for (int num_calls = 0; num_calls < kNumNormalCalls; ++num_calls) {
262 InsertPacketAndPullAudio(); 271 InsertPacketAndPullAudio();
263 } 272 }
264 acm_->GetDecodingCallStatistics(&stats); 273 acm_->GetDecodingCallStatistics(&stats);
265 EXPECT_EQ(kNumNormalCalls, stats.calls_to_neteq); 274 EXPECT_EQ(kNumNormalCalls, stats.calls_to_neteq);
266 EXPECT_EQ(0, stats.calls_to_silence_generator); 275 EXPECT_EQ(0, stats.calls_to_silence_generator);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 EXPECT_EQ(i / k10MsBlocksPerPacket, packet_cb_.num_calls()); 322 EXPECT_EQ(i / k10MsBlocksPerPacket, packet_cb_.num_calls());
314 if (packet_cb_.num_calls() > 0) 323 if (packet_cb_.num_calls() > 0)
315 EXPECT_EQ(kAudioFrameSpeech, packet_cb_.last_frame_type()); 324 EXPECT_EQ(kAudioFrameSpeech, packet_cb_.last_frame_type());
316 InsertAudioAndVerifyEncoding(); 325 InsertAudioAndVerifyEncoding();
317 } 326 }
318 EXPECT_EQ(kLoops / k10MsBlocksPerPacket, packet_cb_.num_calls()); 327 EXPECT_EQ(kLoops / k10MsBlocksPerPacket, packet_cb_.num_calls());
319 EXPECT_EQ(kAudioFrameSpeech, packet_cb_.last_frame_type()); 328 EXPECT_EQ(kAudioFrameSpeech, packet_cb_.last_frame_type());
320 } 329 }
321 330
322 #if defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX) 331 #if defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX)
323 #define IF_ISAC(x) x
324 #else
325 #define IF_ISAC(x) DISABLED_##x
326 #endif
327
328 // Verifies that the RTP timestamp series is not reset when the codec is 332 // Verifies that the RTP timestamp series is not reset when the codec is
329 // changed. 333 // changed.
330 TEST_F(AudioCodingModuleTestOldApi, 334 TEST_F(AudioCodingModuleTestOldApi, TimestampSeriesContinuesWhenCodecChanges) {
331 IF_ISAC(TimestampSeriesContinuesWhenCodecChanges)) {
332 RegisterCodec(); // This registers the default codec. 335 RegisterCodec(); // This registers the default codec.
333 uint32_t expected_ts = input_frame_.timestamp_; 336 uint32_t expected_ts = input_frame_.timestamp_;
334 int blocks_per_packet = codec_.pacsize / (kSampleRateHz / 100); 337 int blocks_per_packet = codec_.pacsize / (kSampleRateHz / 100);
335 // Encode 5 packets of the first codec type. 338 // Encode 5 packets of the first codec type.
336 const int kNumPackets1 = 5; 339 const int kNumPackets1 = 5;
337 for (int j = 0; j < kNumPackets1; ++j) { 340 for (int j = 0; j < kNumPackets1; ++j) {
338 for (int i = 0; i < blocks_per_packet; ++i) { 341 for (int i = 0; i < blocks_per_packet; ++i) {
339 EXPECT_EQ(j, packet_cb_.num_calls()); 342 EXPECT_EQ(j, packet_cb_.num_calls());
340 InsertAudio(); 343 InsertAudio();
341 } 344 }
(...skipping 11 matching lines...) Expand all
353 for (int j = 0; j < kNumPackets2; ++j) { 356 for (int j = 0; j < kNumPackets2; ++j) {
354 for (int i = 0; i < blocks_per_packet; ++i) { 357 for (int i = 0; i < blocks_per_packet; ++i) {
355 EXPECT_EQ(kNumPackets1 + j, packet_cb_.num_calls()); 358 EXPECT_EQ(kNumPackets1 + j, packet_cb_.num_calls());
356 InsertAudio(); 359 InsertAudio();
357 } 360 }
358 EXPECT_EQ(kNumPackets1 + j + 1, packet_cb_.num_calls()); 361 EXPECT_EQ(kNumPackets1 + j + 1, packet_cb_.num_calls());
359 EXPECT_EQ(expected_ts, packet_cb_.last_timestamp()); 362 EXPECT_EQ(expected_ts, packet_cb_.last_timestamp());
360 expected_ts += codec_.pacsize; 363 expected_ts += codec_.pacsize;
361 } 364 }
362 } 365 }
366 #endif
363 367
364 // Introduce this class to set different expectations on the number of encoded 368 // Introduce this class to set different expectations on the number of encoded
365 // bytes. This class expects all encoded packets to be 9 bytes (matching one 369 // bytes. This class expects all encoded packets to be 9 bytes (matching one
366 // CNG SID frame) or 0 bytes. This test depends on |input_frame_| containing 370 // CNG SID frame) or 0 bytes. This test depends on |input_frame_| containing
367 // (near-)zero values. It also introduces a way to register comfort noise with 371 // (near-)zero values. It also introduces a way to register comfort noise with
368 // a custom payload type. 372 // a custom payload type.
369 class AudioCodingModuleTestWithComfortNoiseOldApi 373 class AudioCodingModuleTestWithComfortNoiseOldApi
370 : public AudioCodingModuleTestOldApi { 374 : public AudioCodingModuleTestOldApi {
371 protected: 375 protected:
372 void RegisterCngCodec(int rtp_payload_type) { 376 void RegisterCngCodec(int rtp_payload_type) {
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 rtc::PlatformThread pull_audio_thread_; 579 rtc::PlatformThread pull_audio_thread_;
576 const rtc::scoped_ptr<EventWrapper> test_complete_; 580 const rtc::scoped_ptr<EventWrapper> test_complete_;
577 int send_count_; 581 int send_count_;
578 int insert_packet_count_; 582 int insert_packet_count_;
579 int pull_audio_count_ GUARDED_BY(crit_sect_); 583 int pull_audio_count_ GUARDED_BY(crit_sect_);
580 const rtc::scoped_ptr<CriticalSectionWrapper> crit_sect_; 584 const rtc::scoped_ptr<CriticalSectionWrapper> crit_sect_;
581 int64_t next_insert_packet_time_ms_ GUARDED_BY(crit_sect_); 585 int64_t next_insert_packet_time_ms_ GUARDED_BY(crit_sect_);
582 rtc::scoped_ptr<SimulatedClock> fake_clock_; 586 rtc::scoped_ptr<SimulatedClock> fake_clock_;
583 }; 587 };
584 588
585 TEST_F(AudioCodingModuleMtTestOldApi, DISABLED_ON_IOS(DoTest)) { 589 #if defined(WEBRTC_IOS)
590 #define MAYBE_DoTest DISABLED_DoTest
591 #else
592 #define MAYBE_DoTest DoTest
593 #endif
594 TEST_F(AudioCodingModuleMtTestOldApi, MAYBE_DoTest) {
586 EXPECT_EQ(kEventSignaled, RunTest()); 595 EXPECT_EQ(kEventSignaled, RunTest());
587 } 596 }
588 597
589 // This is a multi-threaded ACM test using iSAC. The test encodes audio 598 // This is a multi-threaded ACM test using iSAC. The test encodes audio
590 // from a PCM file. The most recent encoded frame is used as input to the 599 // from a PCM file. The most recent encoded frame is used as input to the
591 // receiving part. Depending on timing, it may happen that the same RTP packet 600 // receiving part. Depending on timing, it may happen that the same RTP packet
592 // is inserted into the receiver multiple times, but this is a valid use-case, 601 // is inserted into the receiver multiple times, but this is a valid use-case,
593 // and simplifies the test code a lot. 602 // and simplifies the test code a lot.
594 class AcmIsacMtTestOldApi : public AudioCodingModuleMtTestOldApi { 603 class AcmIsacMtTestOldApi : public AudioCodingModuleMtTestOldApi {
595 protected: 604 protected:
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 } 688 }
680 } 689 }
681 return false; 690 return false;
682 } 691 }
683 692
684 int last_packet_number_; 693 int last_packet_number_;
685 std::vector<uint8_t> last_payload_vec_; 694 std::vector<uint8_t> last_payload_vec_;
686 test::AudioLoop audio_loop_; 695 test::AudioLoop audio_loop_;
687 }; 696 };
688 697
689 TEST_F(AcmIsacMtTestOldApi, DISABLED_ON_IOS(IF_ISAC(DoTest))) { 698 #if defined(WEBRTC_IOS)
699 #define MAYBE_DoTest DISABLED_DoTest
700 #else
701 #define MAYBE_DoTest DoTest
702 #endif
703 #if defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX)
704 TEST_F(AcmIsacMtTestOldApi, MAYBE_DoTest) {
690 EXPECT_EQ(kEventSignaled, RunTest()); 705 EXPECT_EQ(kEventSignaled, RunTest());
691 } 706 }
707 #endif
692 708
693 class AcmReRegisterIsacMtTestOldApi : public AudioCodingModuleTestOldApi { 709 class AcmReRegisterIsacMtTestOldApi : public AudioCodingModuleTestOldApi {
694 protected: 710 protected:
695 static const int kRegisterAfterNumPackets = 5; 711 static const int kRegisterAfterNumPackets = 5;
696 static const int kNumPackets = 10; 712 static const int kNumPackets = 10;
697 static const int kPacketSizeMs = 30; 713 static const int kPacketSizeMs = 30;
698 static const int kPacketSizeSamples = kPacketSizeMs * 16; 714 static const int kPacketSizeSamples = kPacketSizeMs * 16;
699 715
700 AcmReRegisterIsacMtTestOldApi() 716 AcmReRegisterIsacMtTestOldApi()
701 : AudioCodingModuleTestOldApi(), 717 : AudioCodingModuleTestOldApi(),
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 const rtc::scoped_ptr<EventWrapper> test_complete_; 847 const rtc::scoped_ptr<EventWrapper> test_complete_;
832 const rtc::scoped_ptr<CriticalSectionWrapper> crit_sect_; 848 const rtc::scoped_ptr<CriticalSectionWrapper> crit_sect_;
833 bool codec_registered_ GUARDED_BY(crit_sect_); 849 bool codec_registered_ GUARDED_BY(crit_sect_);
834 int receive_packet_count_ GUARDED_BY(crit_sect_); 850 int receive_packet_count_ GUARDED_BY(crit_sect_);
835 int64_t next_insert_packet_time_ms_ GUARDED_BY(crit_sect_); 851 int64_t next_insert_packet_time_ms_ GUARDED_BY(crit_sect_);
836 rtc::scoped_ptr<AudioEncoderIsac> isac_encoder_; 852 rtc::scoped_ptr<AudioEncoderIsac> isac_encoder_;
837 rtc::scoped_ptr<SimulatedClock> fake_clock_; 853 rtc::scoped_ptr<SimulatedClock> fake_clock_;
838 test::AudioLoop audio_loop_; 854 test::AudioLoop audio_loop_;
839 }; 855 };
840 856
841 TEST_F(AcmReRegisterIsacMtTestOldApi, DISABLED_ON_IOS(IF_ISAC(DoTest))) { 857 #if defined(WEBRTC_IOS)
858 #define MAYBE_DoTest DISABLED_DoTest
859 #else
860 #define MAYBE_DoTest DoTest
861 #endif
862 #if defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX)
863 TEST_F(AcmReRegisterIsacMtTestOldApi, MAYBE_DoTest) {
842 EXPECT_EQ(kEventSignaled, RunTest()); 864 EXPECT_EQ(kEventSignaled, RunTest());
843 } 865 }
866 #endif
844 867
845 // Disabling all of these tests on iOS until file support has been added. 868 // Disabling all of these tests on iOS until file support has been added.
846 // See https://code.google.com/p/webrtc/issues/detail?id=4752 for details. 869 // See https://code.google.com/p/webrtc/issues/detail?id=4752 for details.
847 #if !defined(WEBRTC_IOS) 870 #if !defined(WEBRTC_IOS)
848 871
849 class AcmReceiverBitExactnessOldApi : public ::testing::Test { 872 class AcmReceiverBitExactnessOldApi : public ::testing::Test {
850 public: 873 public:
851 static std::string PlatformChecksum(std::string others, 874 static std::string PlatformChecksum(std::string others,
852 std::string win64, 875 std::string win64,
853 std::string android_arm32, 876 std::string android_arm32,
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
912 std::string checksum_string = checksum.Finish(); 935 std::string checksum_string = checksum.Finish();
913 EXPECT_EQ(checksum_ref, checksum_string); 936 EXPECT_EQ(checksum_ref, checksum_string);
914 937
915 // Delete the output file. 938 // Delete the output file.
916 remove(output_file_name.c_str()); 939 remove(output_file_name.c_str());
917 } 940 }
918 }; 941 };
919 942
920 #if (defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX)) && \ 943 #if (defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX)) && \
921 defined(WEBRTC_CODEC_ILBC) && defined(WEBRTC_CODEC_G722) 944 defined(WEBRTC_CODEC_ILBC) && defined(WEBRTC_CODEC_G722)
922 #define IF_ALL_CODECS(x) x 945 TEST_F(AcmReceiverBitExactnessOldApi, 8kHzOutput) {
923 #else
924 #define IF_ALL_CODECS(x) DISABLED_##x
925 #endif
926
927 TEST_F(AcmReceiverBitExactnessOldApi, IF_ALL_CODECS(8kHzOutput)) {
928 Run(8000, PlatformChecksum("908002dc01fc4eb1d2be24eb1d3f354b", 946 Run(8000, PlatformChecksum("908002dc01fc4eb1d2be24eb1d3f354b",
929 "dcee98c623b147ebe1b40dd30efa896e", 947 "dcee98c623b147ebe1b40dd30efa896e",
930 "adc92e173f908f93b96ba5844209815a", 948 "adc92e173f908f93b96ba5844209815a",
931 "ba16137d3a5a1e637252289c57522bfe"), 949 "ba16137d3a5a1e637252289c57522bfe"),
932 std::vector<ExternalDecoder>()); 950 std::vector<ExternalDecoder>());
933 } 951 }
934 952
935 TEST_F(AcmReceiverBitExactnessOldApi, IF_ALL_CODECS(16kHzOutput)) { 953 TEST_F(AcmReceiverBitExactnessOldApi, 16kHzOutput) {
936 Run(16000, PlatformChecksum("a909560b5ca49fa472b17b7b277195e9", 954 Run(16000, PlatformChecksum("a909560b5ca49fa472b17b7b277195e9",
937 "f790e7a8cce4e2c8b7bb5e0e4c5dac0d", 955 "f790e7a8cce4e2c8b7bb5e0e4c5dac0d",
938 "8cffa6abcb3e18e33b9d857666dff66a", 956 "8cffa6abcb3e18e33b9d857666dff66a",
939 "66ee001e23534d4dcf5d0f81f916c93b"), 957 "66ee001e23534d4dcf5d0f81f916c93b"),
940 std::vector<ExternalDecoder>()); 958 std::vector<ExternalDecoder>());
941 } 959 }
942 960
943 TEST_F(AcmReceiverBitExactnessOldApi, IF_ALL_CODECS(32kHzOutput)) { 961 TEST_F(AcmReceiverBitExactnessOldApi, 32kHzOutput) {
944 Run(32000, PlatformChecksum("441aab4b347fb3db4e9244337aca8d8e", 962 Run(32000, PlatformChecksum("441aab4b347fb3db4e9244337aca8d8e",
945 "306e0d990ee6e92de3fbecc0123ece37", 963 "306e0d990ee6e92de3fbecc0123ece37",
946 "3e126fe894720c3f85edadcc91964ba5", 964 "3e126fe894720c3f85edadcc91964ba5",
947 "9c6ff204b14152c48fe41d5ab757943b"), 965 "9c6ff204b14152c48fe41d5ab757943b"),
948 std::vector<ExternalDecoder>()); 966 std::vector<ExternalDecoder>());
949 } 967 }
950 968
951 TEST_F(AcmReceiverBitExactnessOldApi, IF_ALL_CODECS(48kHzOutput)) { 969 TEST_F(AcmReceiverBitExactnessOldApi, 48kHzOutput) {
952 Run(48000, PlatformChecksum("4ee2730fa1daae755e8a8fd3abd779ec", 970 Run(48000, PlatformChecksum("4ee2730fa1daae755e8a8fd3abd779ec",
953 "aa7c232f63a67b2a72703593bdd172e0", 971 "aa7c232f63a67b2a72703593bdd172e0",
954 "0155665e93067c4e89256b944dd11999", 972 "0155665e93067c4e89256b944dd11999",
955 "fc4f0da8844cd808d822bbddf3b9c285"), 973 "fc4f0da8844cd808d822bbddf3b9c285"),
956 std::vector<ExternalDecoder>()); 974 std::vector<ExternalDecoder>());
957 } 975 }
958 976
959 TEST_F(AcmReceiverBitExactnessOldApi, 977 TEST_F(AcmReceiverBitExactnessOldApi, 48kHzOutputExternalDecoder) {
960 IF_ALL_CODECS(48kHzOutputExternalDecoder)) {
961 // Class intended to forward a call from a mock DecodeInternal to Decode on 978 // Class intended to forward a call from a mock DecodeInternal to Decode on
962 // the real decoder's Decode. DecodeInternal for the real decoder isn't 979 // the real decoder's Decode. DecodeInternal for the real decoder isn't
963 // public. 980 // public.
964 class DecodeForwarder { 981 class DecodeForwarder {
965 public: 982 public:
966 DecodeForwarder(AudioDecoder* decoder) : decoder_(decoder) {} 983 DecodeForwarder(AudioDecoder* decoder) : decoder_(decoder) {}
967 int Decode(const uint8_t* encoded, 984 int Decode(const uint8_t* encoded,
968 size_t encoded_len, 985 size_t encoded_len,
969 int sample_rate_hz, 986 int sample_rate_hz,
970 int16_t* decoded, 987 int16_t* decoded,
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1009 external_decoders.push_back(ed); 1026 external_decoders.push_back(ed);
1010 1027
1011 Run(48000, PlatformChecksum("4ee2730fa1daae755e8a8fd3abd779ec", 1028 Run(48000, PlatformChecksum("4ee2730fa1daae755e8a8fd3abd779ec",
1012 "aa7c232f63a67b2a72703593bdd172e0", 1029 "aa7c232f63a67b2a72703593bdd172e0",
1013 "0155665e93067c4e89256b944dd11999", 1030 "0155665e93067c4e89256b944dd11999",
1014 "fc4f0da8844cd808d822bbddf3b9c285"), 1031 "fc4f0da8844cd808d822bbddf3b9c285"),
1015 external_decoders); 1032 external_decoders);
1016 1033
1017 EXPECT_CALL(mock_decoder, Die()); 1034 EXPECT_CALL(mock_decoder, Die());
1018 } 1035 }
1036 #endif
1019 1037
1020 // This test verifies bit exactness for the send-side of ACM. The test setup is 1038 // This test verifies bit exactness for the send-side of ACM. The test setup is
1021 // a chain of three different test classes: 1039 // a chain of three different test classes:
1022 // 1040 //
1023 // test::AcmSendTest -> AcmSenderBitExactness -> test::AcmReceiveTest 1041 // test::AcmSendTest -> AcmSenderBitExactness -> test::AcmReceiveTest
1024 // 1042 //
1025 // The receiver side is driving the test by requesting new packets from 1043 // The receiver side is driving the test by requesting new packets from
1026 // AcmSenderBitExactness::NextPacket(). This method, in turn, asks for the 1044 // AcmSenderBitExactness::NextPacket(). This method, in turn, asks for the
1027 // packet from test::AcmSendTest::NextPacket, which inserts audio from the 1045 // packet from test::AcmSendTest::NextPacket, which inserts audio from the
1028 // input file until one packet is produced. (The input file loops indefinitely.) 1046 // input file until one packet is produced. (The input file loops indefinitely.)
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
1187 rtc::scoped_ptr<test::AcmSendTestOldApi> send_test_; 1205 rtc::scoped_ptr<test::AcmSendTestOldApi> send_test_;
1188 rtc::scoped_ptr<test::InputAudioFile> audio_source_; 1206 rtc::scoped_ptr<test::InputAudioFile> audio_source_;
1189 uint32_t frame_size_rtp_timestamps_; 1207 uint32_t frame_size_rtp_timestamps_;
1190 int packet_count_; 1208 int packet_count_;
1191 uint8_t payload_type_; 1209 uint8_t payload_type_;
1192 uint16_t last_sequence_number_; 1210 uint16_t last_sequence_number_;
1193 uint32_t last_timestamp_; 1211 uint32_t last_timestamp_;
1194 rtc::Md5Digest payload_checksum_; 1212 rtc::Md5Digest payload_checksum_;
1195 }; 1213 };
1196 1214
1197 TEST_F(AcmSenderBitExactnessOldApi, IF_ISAC(IsacWb30ms)) { 1215 #if defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX)
1216 TEST_F(AcmSenderBitExactnessOldApi, IsacWb30ms) {
1198 ASSERT_NO_FATAL_FAILURE(SetUpTest("ISAC", 16000, 1, 103, 480, 480)); 1217 ASSERT_NO_FATAL_FAILURE(SetUpTest("ISAC", 16000, 1, 103, 480, 480));
1199 Run(AcmReceiverBitExactnessOldApi::PlatformChecksum( 1218 Run(AcmReceiverBitExactnessOldApi::PlatformChecksum(
1200 "0b58f9eeee43d5891f5f6c75e77984a3", 1219 "0b58f9eeee43d5891f5f6c75e77984a3",
1201 "c7e5bdadfa2871df95639fcc297cf23d", 1220 "c7e5bdadfa2871df95639fcc297cf23d",
1202 "0499ca260390769b3172136faad925b9", 1221 "0499ca260390769b3172136faad925b9",
1203 "866abf524acd2807efbe65e133c23f95"), 1222 "866abf524acd2807efbe65e133c23f95"),
1204 AcmReceiverBitExactnessOldApi::PlatformChecksum( 1223 AcmReceiverBitExactnessOldApi::PlatformChecksum(
1205 "3c79f16f34218271f3dca4e2b1dfe1bb", 1224 "3c79f16f34218271f3dca4e2b1dfe1bb",
1206 "d42cb5195463da26c8129bbfe73a22e6", 1225 "d42cb5195463da26c8129bbfe73a22e6",
1207 "83de248aea9c3c2bd680b6952401b4ca", 1226 "83de248aea9c3c2bd680b6952401b4ca",
1208 "3c79f16f34218271f3dca4e2b1dfe1bb"), 1227 "3c79f16f34218271f3dca4e2b1dfe1bb"),
1209 33, test::AcmReceiveTestOldApi::kMonoOutput); 1228 33, test::AcmReceiveTestOldApi::kMonoOutput);
1210 } 1229 }
1211 1230
1212 TEST_F(AcmSenderBitExactnessOldApi, IF_ISAC(IsacWb60ms)) { 1231 TEST_F(AcmSenderBitExactnessOldApi, IsacWb60ms) {
1213 ASSERT_NO_FATAL_FAILURE(SetUpTest("ISAC", 16000, 1, 103, 960, 960)); 1232 ASSERT_NO_FATAL_FAILURE(SetUpTest("ISAC", 16000, 1, 103, 960, 960));
1214 Run(AcmReceiverBitExactnessOldApi::PlatformChecksum( 1233 Run(AcmReceiverBitExactnessOldApi::PlatformChecksum(
1215 "1ad29139a04782a33daad8c2b9b35875", 1234 "1ad29139a04782a33daad8c2b9b35875",
1216 "14d63c5f08127d280e722e3191b73bdd", 1235 "14d63c5f08127d280e722e3191b73bdd",
1217 "8da003e16c5371af2dc2be79a50f9076", 1236 "8da003e16c5371af2dc2be79a50f9076",
1218 "ef75e900e6f375e3061163c53fd09a63"), 1237 "ef75e900e6f375e3061163c53fd09a63"),
1219 AcmReceiverBitExactnessOldApi::PlatformChecksum( 1238 AcmReceiverBitExactnessOldApi::PlatformChecksum(
1220 "9e0a0ab743ad987b55b8e14802769c56", 1239 "9e0a0ab743ad987b55b8e14802769c56",
1221 "ebe04a819d3a9d83a83a17f271e1139a", 1240 "ebe04a819d3a9d83a83a17f271e1139a",
1222 "97aeef98553b5a4b5a68f8b716e8eaf0", 1241 "97aeef98553b5a4b5a68f8b716e8eaf0",
1223 "9e0a0ab743ad987b55b8e14802769c56"), 1242 "9e0a0ab743ad987b55b8e14802769c56"),
1224 16, test::AcmReceiveTestOldApi::kMonoOutput); 1243 16, test::AcmReceiveTestOldApi::kMonoOutput);
1225 } 1244 }
1226
1227 #ifdef WEBRTC_CODEC_ISAC
1228 #define IF_ISAC_FLOAT(x) x
1229 #else
1230 #define IF_ISAC_FLOAT(x) DISABLED_##x
1231 #endif 1245 #endif
1232 1246
1233 TEST_F(AcmSenderBitExactnessOldApi, 1247 #if defined(WEBRTC_ANDROID)
1234 DISABLED_ON_ANDROID(IF_ISAC_FLOAT(IsacSwb30ms))) { 1248 #define MAYBE_IsacSwb30ms DISABLED_IsacSwb30ms
1249 #else
1250 #define MAYBE_IsacSwb30ms IsacSwb30ms
1251 #endif
1252 #if defined(WEBRTC_CODEC_ISAC)
1253 TEST_F(AcmSenderBitExactnessOldApi, MAYBE_IsacSwb30ms) {
1235 ASSERT_NO_FATAL_FAILURE(SetUpTest("ISAC", 32000, 1, 104, 960, 960)); 1254 ASSERT_NO_FATAL_FAILURE(SetUpTest("ISAC", 32000, 1, 104, 960, 960));
1236 Run(AcmReceiverBitExactnessOldApi::PlatformChecksum( 1255 Run(AcmReceiverBitExactnessOldApi::PlatformChecksum(
1237 "5683b58da0fbf2063c7adc2e6bfb3fb8", 1256 "5683b58da0fbf2063c7adc2e6bfb3fb8",
1238 "2b3c387d06f00b7b7aad4c9be56fb83d", "android_arm32_audio", 1257 "2b3c387d06f00b7b7aad4c9be56fb83d", "android_arm32_audio",
1239 "android_arm64_audio"), 1258 "android_arm64_audio"),
1240 AcmReceiverBitExactnessOldApi::PlatformChecksum( 1259 AcmReceiverBitExactnessOldApi::PlatformChecksum(
1241 "ce86106a93419aefb063097108ec94ab", 1260 "ce86106a93419aefb063097108ec94ab",
1242 "bcc2041e7744c7ebd9f701866856849c", "android_arm32_payload", 1261 "bcc2041e7744c7ebd9f701866856849c", "android_arm32_payload",
1243 "android_arm64_payload"), 1262 "android_arm64_payload"),
1244 33, test::AcmReceiveTestOldApi::kMonoOutput); 1263 33, test::AcmReceiveTestOldApi::kMonoOutput);
1245 } 1264 }
1265 #endif
1246 1266
1247 TEST_F(AcmSenderBitExactnessOldApi, Pcm16_8000khz_10ms) { 1267 TEST_F(AcmSenderBitExactnessOldApi, Pcm16_8000khz_10ms) {
1248 ASSERT_NO_FATAL_FAILURE(SetUpTest("L16", 8000, 1, 107, 80, 80)); 1268 ASSERT_NO_FATAL_FAILURE(SetUpTest("L16", 8000, 1, 107, 80, 80));
1249 Run("de4a98e1406f8b798d99cd0704e862e2", 1269 Run("de4a98e1406f8b798d99cd0704e862e2",
1250 "c1edd36339ce0326cc4550041ad719a0", 1270 "c1edd36339ce0326cc4550041ad719a0",
1251 100, 1271 100,
1252 test::AcmReceiveTestOldApi::kMonoOutput); 1272 test::AcmReceiveTestOldApi::kMonoOutput);
1253 } 1273 }
1254 1274
1255 TEST_F(AcmSenderBitExactnessOldApi, Pcm16_16000khz_10ms) { 1275 TEST_F(AcmSenderBitExactnessOldApi, Pcm16_16000khz_10ms) {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
1317 } 1337 }
1318 1338
1319 TEST_F(AcmSenderBitExactnessOldApi, Pcma_stereo_20ms) { 1339 TEST_F(AcmSenderBitExactnessOldApi, Pcma_stereo_20ms) {
1320 ASSERT_NO_FATAL_FAILURE(SetUpTest("PCMA", 8000, 2, 118, 160, 160)); 1340 ASSERT_NO_FATAL_FAILURE(SetUpTest("PCMA", 8000, 2, 118, 160, 160));
1321 Run("a5c6d83c5b7cedbeff734238220a4b0c", 1341 Run("a5c6d83c5b7cedbeff734238220a4b0c",
1322 "92b282c83efd20e7eeef52ba40842cf7", 1342 "92b282c83efd20e7eeef52ba40842cf7",
1323 50, 1343 50,
1324 test::AcmReceiveTestOldApi::kStereoOutput); 1344 test::AcmReceiveTestOldApi::kStereoOutput);
1325 } 1345 }
1326 1346
1327 #ifdef WEBRTC_CODEC_ILBC 1347 #if defined(WEBRTC_ANDROID)
1328 #define IF_ILBC(x) x 1348 #define MAYBE_Ilbc_30ms DISABLED_Ilbc_30ms
1329 #else 1349 #else
1330 #define IF_ILBC(x) DISABLED_##x 1350 #define MAYBE_Ilbc_30ms Ilbc_30ms
1331 #endif 1351 #endif
1332 1352 #if defined(WEBRTC_CODEC_ILBC)
1333 TEST_F(AcmSenderBitExactnessOldApi, DISABLED_ON_ANDROID(IF_ILBC(Ilbc_30ms))) { 1353 TEST_F(AcmSenderBitExactnessOldApi, MAYBE_Ilbc_30ms) {
1334 ASSERT_NO_FATAL_FAILURE(SetUpTest("ILBC", 8000, 1, 102, 240, 240)); 1354 ASSERT_NO_FATAL_FAILURE(SetUpTest("ILBC", 8000, 1, 102, 240, 240));
1335 Run(AcmReceiverBitExactnessOldApi::PlatformChecksum( 1355 Run(AcmReceiverBitExactnessOldApi::PlatformChecksum(
1336 "7b6ec10910debd9af08011d3ed5249f7", 1356 "7b6ec10910debd9af08011d3ed5249f7",
1337 "7b6ec10910debd9af08011d3ed5249f7", "android_arm32_audio", 1357 "7b6ec10910debd9af08011d3ed5249f7", "android_arm32_audio",
1338 "android_arm64_audio"), 1358 "android_arm64_audio"),
1339 AcmReceiverBitExactnessOldApi::PlatformChecksum( 1359 AcmReceiverBitExactnessOldApi::PlatformChecksum(
1340 "cfae2e9f6aba96e145f2bcdd5050ce78", 1360 "cfae2e9f6aba96e145f2bcdd5050ce78",
1341 "cfae2e9f6aba96e145f2bcdd5050ce78", "android_arm32_payload", 1361 "cfae2e9f6aba96e145f2bcdd5050ce78", "android_arm32_payload",
1342 "android_arm64_payload"), 1362 "android_arm64_payload"),
1343 33, test::AcmReceiveTestOldApi::kMonoOutput); 1363 33, test::AcmReceiveTestOldApi::kMonoOutput);
1344 } 1364 }
1345
1346 #ifdef WEBRTC_CODEC_G722
1347 #define IF_G722(x) x
1348 #else
1349 #define IF_G722(x) DISABLED_##x
1350 #endif 1365 #endif
1351 1366
1352 TEST_F(AcmSenderBitExactnessOldApi, DISABLED_ON_ANDROID(IF_G722(G722_20ms))) { 1367 #if defined(WEBRTC_ANDROID)
1368 #define MAYBE_G722_20ms DISABLED_G722_20ms
1369 #else
1370 #define MAYBE_G722_20ms G722_20ms
1371 #endif
1372 #if defined(WEBRTC_CODEC_G722)
1373 TEST_F(AcmSenderBitExactnessOldApi, MAYBE_G722_20ms) {
1353 ASSERT_NO_FATAL_FAILURE(SetUpTest("G722", 16000, 1, 9, 320, 160)); 1374 ASSERT_NO_FATAL_FAILURE(SetUpTest("G722", 16000, 1, 9, 320, 160));
1354 Run(AcmReceiverBitExactnessOldApi::PlatformChecksum( 1375 Run(AcmReceiverBitExactnessOldApi::PlatformChecksum(
1355 "7d759436f2533582950d148b5161a36c", 1376 "7d759436f2533582950d148b5161a36c",
1356 "7d759436f2533582950d148b5161a36c", "android_arm32_audio", 1377 "7d759436f2533582950d148b5161a36c", "android_arm32_audio",
1357 "android_arm64_audio"), 1378 "android_arm64_audio"),
1358 AcmReceiverBitExactnessOldApi::PlatformChecksum( 1379 AcmReceiverBitExactnessOldApi::PlatformChecksum(
1359 "fc68a87e1380614e658087cb35d5ca10", 1380 "fc68a87e1380614e658087cb35d5ca10",
1360 "fc68a87e1380614e658087cb35d5ca10", "android_arm32_payload", 1381 "fc68a87e1380614e658087cb35d5ca10", "android_arm32_payload",
1361 "android_arm64_payload"), 1382 "android_arm64_payload"),
1362 50, test::AcmReceiveTestOldApi::kMonoOutput); 1383 50, test::AcmReceiveTestOldApi::kMonoOutput);
1363 } 1384 }
1385 #endif
1364 1386
1365 TEST_F(AcmSenderBitExactnessOldApi, 1387 #if defined(WEBRTC_ANDROID)
1366 DISABLED_ON_ANDROID(IF_G722(G722_stereo_20ms))) { 1388 #define MAYBE_G722_stereo_20ms DISABLED_G722_stereo_20ms
1389 #else
1390 #define MAYBE_G722_stereo_20ms G722_stereo_20ms
1391 #endif
1392 #if defined(WEBRTC_CODEC_G722)
1393 TEST_F(AcmSenderBitExactnessOldApi, MAYBE_G722_stereo_20ms) {
1367 ASSERT_NO_FATAL_FAILURE(SetUpTest("G722", 16000, 2, 119, 320, 160)); 1394 ASSERT_NO_FATAL_FAILURE(SetUpTest("G722", 16000, 2, 119, 320, 160));
1368 Run(AcmReceiverBitExactnessOldApi::PlatformChecksum( 1395 Run(AcmReceiverBitExactnessOldApi::PlatformChecksum(
1369 "7190ee718ab3d80eca181e5f7140c210", 1396 "7190ee718ab3d80eca181e5f7140c210",
1370 "7190ee718ab3d80eca181e5f7140c210", "android_arm32_audio", 1397 "7190ee718ab3d80eca181e5f7140c210", "android_arm32_audio",
1371 "android_arm64_audio"), 1398 "android_arm64_audio"),
1372 AcmReceiverBitExactnessOldApi::PlatformChecksum( 1399 AcmReceiverBitExactnessOldApi::PlatformChecksum(
1373 "66516152eeaa1e650ad94ff85f668dac", 1400 "66516152eeaa1e650ad94ff85f668dac",
1374 "66516152eeaa1e650ad94ff85f668dac", "android_arm32_payload", 1401 "66516152eeaa1e650ad94ff85f668dac", "android_arm32_payload",
1375 "android_arm64_payload"), 1402 "android_arm64_payload"),
1376 50, test::AcmReceiveTestOldApi::kStereoOutput); 1403 50, test::AcmReceiveTestOldApi::kStereoOutput);
1377 } 1404 }
1405 #endif
1378 1406
1379 TEST_F(AcmSenderBitExactnessOldApi, Opus_stereo_20ms) { 1407 TEST_F(AcmSenderBitExactnessOldApi, Opus_stereo_20ms) {
1380 ASSERT_NO_FATAL_FAILURE(SetUpTest("opus", 48000, 2, 120, 960, 960)); 1408 ASSERT_NO_FATAL_FAILURE(SetUpTest("opus", 48000, 2, 120, 960, 960));
1381 Run(AcmReceiverBitExactnessOldApi::PlatformChecksum( 1409 Run(AcmReceiverBitExactnessOldApi::PlatformChecksum(
1382 "855041f2490b887302bce9d544731849", 1410 "855041f2490b887302bce9d544731849",
1383 "855041f2490b887302bce9d544731849", 1411 "855041f2490b887302bce9d544731849",
1384 "1e1a0fce893fef2d66886a7f09e2ebce", 1412 "1e1a0fce893fef2d66886a7f09e2ebce",
1385 "7417a66c28be42d5d9b2d64e0c191585"), 1413 "7417a66c28be42d5d9b2d64e0c191585"),
1386 AcmReceiverBitExactnessOldApi::PlatformChecksum( 1414 AcmReceiverBitExactnessOldApi::PlatformChecksum(
1387 "d781cce1ab986b618d0da87226cdde30", 1415 "d781cce1ab986b618d0da87226cdde30",
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
1483 ASSERT_NO_FATAL_FAILURE(SetUpTest("opus", 48000, 1, 107, 960, 960)); 1511 ASSERT_NO_FATAL_FAILURE(SetUpTest("opus", 48000, 1, 107, 960, 960));
1484 #if defined(WEBRTC_ANDROID) 1512 #if defined(WEBRTC_ANDROID)
1485 Run(50000, 47952); 1513 Run(50000, 47952);
1486 #else 1514 #else
1487 Run(50000, 49600); 1515 Run(50000, 49600);
1488 #endif // WEBRTC_ANDROID 1516 #endif // WEBRTC_ANDROID
1489 } 1517 }
1490 1518
1491 // The result on the Android platforms is inconsistent for this test case. 1519 // The result on the Android platforms is inconsistent for this test case.
1492 // On android_rel the result is different from android and android arm64 rel. 1520 // On android_rel the result is different from android and android arm64 rel.
1493 TEST_F(AcmSetBitRateOldApi, DISABLED_ON_ANDROID(Opus_48khz_20ms_100kbps)) { 1521 #if defined(WEBRTC_ANDROID)
1522 #define MAYBE_Opus_48khz_20ms_100kbps DISABLED_Opus_48khz_20ms_100kbps
1523 #else
1524 #define MAYBE_Opus_48khz_20ms_100kbps Opus_48khz_20ms_100kbps
1525 #endif
1526 TEST_F(AcmSetBitRateOldApi, MAYBE_Opus_48khz_20ms_100kbps) {
1494 ASSERT_NO_FATAL_FAILURE(SetUpTest("opus", 48000, 1, 107, 960, 960)); 1527 ASSERT_NO_FATAL_FAILURE(SetUpTest("opus", 48000, 1, 107, 960, 960));
1495 Run(100000, 100888); 1528 Run(100000, 100888);
1496 } 1529 }
1497 1530
1498 // These next 2 tests ensure that the SetBitRate function has no effect on PCM 1531 // These next 2 tests ensure that the SetBitRate function has no effect on PCM
1499 TEST_F(AcmSetBitRateOldApi, Pcm16_8khz_10ms_8kbps) { 1532 TEST_F(AcmSetBitRateOldApi, Pcm16_8khz_10ms_8kbps) {
1500 ASSERT_NO_FATAL_FAILURE(SetUpTest("L16", 8000, 1, 107, 80, 80)); 1533 ASSERT_NO_FATAL_FAILURE(SetUpTest("L16", 8000, 1, 107, 80, 80));
1501 Run(8000, 128000); 1534 Run(8000, 128000);
1502 } 1535 }
1503 1536
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
1747 Run(16000, 8000, 1000); 1780 Run(16000, 8000, 1000);
1748 } 1781 }
1749 1782
1750 TEST_F(AcmSwitchingOutputFrequencyOldApi, Toggle8KhzTo16Khz) { 1783 TEST_F(AcmSwitchingOutputFrequencyOldApi, Toggle8KhzTo16Khz) {
1751 Run(8000, 16000, 1000); 1784 Run(8000, 16000, 1000);
1752 } 1785 }
1753 1786
1754 #endif 1787 #endif
1755 1788
1756 } // namespace webrtc 1789 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698