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 |
| (...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 969 } | 969 } |
| 970 | 970 |
| 971 // Fails Android ARM64. https://code.google.com/p/webrtc/issues/detail?id=4199 | 971 // Fails Android ARM64. https://code.google.com/p/webrtc/issues/detail?id=4199 |
| 972 #if defined(WEBRTC_ANDROID) && defined(__aarch64__) | 972 #if defined(WEBRTC_ANDROID) && defined(__aarch64__) |
| 973 #define MAYBE_48kHzOutputExternalDecoder DISABLED_48kHzOutputExternalDecoder | 973 #define MAYBE_48kHzOutputExternalDecoder DISABLED_48kHzOutputExternalDecoder |
| 974 #else | 974 #else |
| 975 #define MAYBE_48kHzOutputExternalDecoder 48kHzOutputExternalDecoder | 975 #define MAYBE_48kHzOutputExternalDecoder 48kHzOutputExternalDecoder |
| 976 #endif | 976 #endif |
| 977 TEST_F(AcmReceiverBitExactnessOldApi, | 977 TEST_F(AcmReceiverBitExactnessOldApi, |
| 978 IF_ALL_CODECS(MAYBE_48kHzOutputExternalDecoder)) { | 978 IF_ALL_CODECS(MAYBE_48kHzOutputExternalDecoder)) { |
| 979 class DecodeForwarder { | |
|
hlundin-webrtc
2015/12/08 10:44:52
Comment on the intended use: forward a call from D
pbos-webrtc
2015/12/08 12:28:27
Done.
| |
| 980 public: | |
| 981 DecodeForwarder(AudioDecoder* decoder) : decoder_(decoder) {} | |
| 982 int Decode(const uint8_t* encoded, | |
| 983 size_t encoded_len, | |
| 984 int sample_rate_hz, | |
| 985 int16_t* decoded, | |
| 986 AudioDecoder::SpeechType* speech_type) { | |
| 987 return decoder_->Decode(encoded, encoded_len, sample_rate_hz, | |
| 988 decoder_->PacketDuration(encoded, encoded_len) * | |
| 989 decoder_->Channels() * sizeof(int16_t), | |
| 990 decoded, speech_type); | |
| 991 } | |
| 992 | |
| 993 private: | |
| 994 AudioDecoder* const decoder_; | |
| 995 }; | |
| 996 | |
| 979 AudioDecoderPcmU decoder(1); | 997 AudioDecoderPcmU decoder(1); |
| 998 DecodeForwarder decode_forwarder(&decoder); | |
| 980 MockAudioDecoder mock_decoder; | 999 MockAudioDecoder mock_decoder; |
| 981 // Set expectations on the mock decoder and also delegate the calls to the | 1000 // Set expectations on the mock decoder and also delegate the calls to the |
| 982 // real decoder. | 1001 // real decoder. |
| 983 EXPECT_CALL(mock_decoder, IncomingPacket(_, _, _, _, _)) | 1002 EXPECT_CALL(mock_decoder, IncomingPacket(_, _, _, _, _)) |
| 984 .Times(AtLeast(1)) | 1003 .Times(AtLeast(1)) |
| 985 .WillRepeatedly(Invoke(&decoder, &AudioDecoderPcmU::IncomingPacket)); | 1004 .WillRepeatedly(Invoke(&decoder, &AudioDecoderPcmU::IncomingPacket)); |
| 986 EXPECT_CALL(mock_decoder, Channels()) | 1005 EXPECT_CALL(mock_decoder, Channels()) |
| 987 .Times(AtLeast(1)) | 1006 .Times(AtLeast(1)) |
| 988 .WillRepeatedly(Invoke(&decoder, &AudioDecoderPcmU::Channels)); | 1007 .WillRepeatedly(Invoke(&decoder, &AudioDecoderPcmU::Channels)); |
| 989 EXPECT_CALL(mock_decoder, Decode(_, _, _, _, _, _)) | 1008 EXPECT_CALL(mock_decoder, DecodeInternal(_, _, _, _, _)) |
| 990 .Times(AtLeast(1)) | 1009 .Times(AtLeast(1)) |
| 991 .WillRepeatedly(Invoke(&decoder, &AudioDecoderPcmU::Decode)); | 1010 .WillRepeatedly(Invoke(&decode_forwarder, &DecodeForwarder::Decode)); |
| 992 EXPECT_CALL(mock_decoder, HasDecodePlc()) | 1011 EXPECT_CALL(mock_decoder, HasDecodePlc()) |
| 993 .Times(AtLeast(1)) | 1012 .Times(AtLeast(1)) |
| 994 .WillRepeatedly(Invoke(&decoder, &AudioDecoderPcmU::HasDecodePlc)); | 1013 .WillRepeatedly(Invoke(&decoder, &AudioDecoderPcmU::HasDecodePlc)); |
| 995 EXPECT_CALL(mock_decoder, PacketDuration(_, _)) | 1014 EXPECT_CALL(mock_decoder, PacketDuration(_, _)) |
| 996 .Times(AtLeast(1)) | 1015 .Times(AtLeast(1)) |
| 997 .WillRepeatedly(Invoke(&decoder, &AudioDecoderPcmU::PacketDuration)); | 1016 .WillRepeatedly(Invoke(&decoder, &AudioDecoderPcmU::PacketDuration)); |
| 998 ExternalDecoder ed; | 1017 ExternalDecoder ed; |
| 999 ed.rtp_payload_type = 0; | 1018 ed.rtp_payload_type = 0; |
| 1000 ed.external_decoder = &mock_decoder; | 1019 ed.external_decoder = &mock_decoder; |
| 1001 ed.sample_rate_hz = 8000; | 1020 ed.sample_rate_hz = 8000; |
| (...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1762 Run(16000, 8000, 1000); | 1781 Run(16000, 8000, 1000); |
| 1763 } | 1782 } |
| 1764 | 1783 |
| 1765 TEST_F(AcmSwitchingOutputFrequencyOldApi, Toggle8KhzTo16Khz) { | 1784 TEST_F(AcmSwitchingOutputFrequencyOldApi, Toggle8KhzTo16Khz) { |
| 1766 Run(8000, 16000, 1000); | 1785 Run(8000, 16000, 1000); |
| 1767 } | 1786 } |
| 1768 | 1787 |
| 1769 #endif | 1788 #endif |
| 1770 | 1789 |
| 1771 } // namespace webrtc | 1790 } // namespace webrtc |
| OLD | NEW |