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

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

Issue 1512483003: Add encode/decode time tracing to audio_coding. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: add comment Created 5 years 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
« no previous file with comments | « no previous file | webrtc/modules/audio_coding/codecs/audio_decoder.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 958 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 intended to forward a call from a mock DecodeInternal to Decode on
980 // the real decoder's Decode. DecodeInternal for the real decoder isn't
981 // public.
982 class DecodeForwarder {
983 public:
984 DecodeForwarder(AudioDecoder* decoder) : decoder_(decoder) {}
985 int Decode(const uint8_t* encoded,
986 size_t encoded_len,
987 int sample_rate_hz,
988 int16_t* decoded,
989 AudioDecoder::SpeechType* speech_type) {
990 return decoder_->Decode(encoded, encoded_len, sample_rate_hz,
991 decoder_->PacketDuration(encoded, encoded_len) *
992 decoder_->Channels() * sizeof(int16_t),
993 decoded, speech_type);
994 }
995
996 private:
997 AudioDecoder* const decoder_;
998 };
999
979 AudioDecoderPcmU decoder(1); 1000 AudioDecoderPcmU decoder(1);
1001 DecodeForwarder decode_forwarder(&decoder);
980 MockAudioDecoder mock_decoder; 1002 MockAudioDecoder mock_decoder;
981 // Set expectations on the mock decoder and also delegate the calls to the 1003 // Set expectations on the mock decoder and also delegate the calls to the
982 // real decoder. 1004 // real decoder.
983 EXPECT_CALL(mock_decoder, IncomingPacket(_, _, _, _, _)) 1005 EXPECT_CALL(mock_decoder, IncomingPacket(_, _, _, _, _))
984 .Times(AtLeast(1)) 1006 .Times(AtLeast(1))
985 .WillRepeatedly(Invoke(&decoder, &AudioDecoderPcmU::IncomingPacket)); 1007 .WillRepeatedly(Invoke(&decoder, &AudioDecoderPcmU::IncomingPacket));
986 EXPECT_CALL(mock_decoder, Channels()) 1008 EXPECT_CALL(mock_decoder, Channels())
987 .Times(AtLeast(1)) 1009 .Times(AtLeast(1))
988 .WillRepeatedly(Invoke(&decoder, &AudioDecoderPcmU::Channels)); 1010 .WillRepeatedly(Invoke(&decoder, &AudioDecoderPcmU::Channels));
989 EXPECT_CALL(mock_decoder, Decode(_, _, _, _, _, _)) 1011 EXPECT_CALL(mock_decoder, DecodeInternal(_, _, _, _, _))
990 .Times(AtLeast(1)) 1012 .Times(AtLeast(1))
991 .WillRepeatedly(Invoke(&decoder, &AudioDecoderPcmU::Decode)); 1013 .WillRepeatedly(Invoke(&decode_forwarder, &DecodeForwarder::Decode));
992 EXPECT_CALL(mock_decoder, HasDecodePlc()) 1014 EXPECT_CALL(mock_decoder, HasDecodePlc())
993 .Times(AtLeast(1)) 1015 .Times(AtLeast(1))
994 .WillRepeatedly(Invoke(&decoder, &AudioDecoderPcmU::HasDecodePlc)); 1016 .WillRepeatedly(Invoke(&decoder, &AudioDecoderPcmU::HasDecodePlc));
995 EXPECT_CALL(mock_decoder, PacketDuration(_, _)) 1017 EXPECT_CALL(mock_decoder, PacketDuration(_, _))
996 .Times(AtLeast(1)) 1018 .Times(AtLeast(1))
997 .WillRepeatedly(Invoke(&decoder, &AudioDecoderPcmU::PacketDuration)); 1019 .WillRepeatedly(Invoke(&decoder, &AudioDecoderPcmU::PacketDuration));
998 ExternalDecoder ed; 1020 ExternalDecoder ed;
999 ed.rtp_payload_type = 0; 1021 ed.rtp_payload_type = 0;
1000 ed.external_decoder = &mock_decoder; 1022 ed.external_decoder = &mock_decoder;
1001 ed.sample_rate_hz = 8000; 1023 ed.sample_rate_hz = 8000;
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after
1762 Run(16000, 8000, 1000); 1784 Run(16000, 8000, 1000);
1763 } 1785 }
1764 1786
1765 TEST_F(AcmSwitchingOutputFrequencyOldApi, Toggle8KhzTo16Khz) { 1787 TEST_F(AcmSwitchingOutputFrequencyOldApi, Toggle8KhzTo16Khz) {
1766 Run(8000, 16000, 1000); 1788 Run(8000, 16000, 1000);
1767 } 1789 }
1768 1790
1769 #endif 1791 #endif
1770 1792
1771 } // namespace webrtc 1793 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/audio_coding/codecs/audio_decoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698