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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | webrtc/modules/audio_coding/codecs/audio_decoder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/audio_coding/acm2/audio_coding_module_unittest_oldapi.cc
diff --git a/webrtc/modules/audio_coding/acm2/audio_coding_module_unittest_oldapi.cc b/webrtc/modules/audio_coding/acm2/audio_coding_module_unittest_oldapi.cc
index 1045e7e2d0fbd111f4c6c8c341a852290e78500f..c98c265d6c9db3ba770c59e27fb86bf7c7941758 100644
--- a/webrtc/modules/audio_coding/acm2/audio_coding_module_unittest_oldapi.cc
+++ b/webrtc/modules/audio_coding/acm2/audio_coding_module_unittest_oldapi.cc
@@ -976,7 +976,29 @@ TEST_F(AcmReceiverBitExactnessOldApi, IF_ALL_CODECS(MAYBE_48kHzOutput)) {
#endif
TEST_F(AcmReceiverBitExactnessOldApi,
IF_ALL_CODECS(MAYBE_48kHzOutputExternalDecoder)) {
+ // Class intended to forward a call from a mock DecodeInternal to Decode on
+ // the real decoder's Decode. DecodeInternal for the real decoder isn't
+ // public.
+ class DecodeForwarder {
+ public:
+ DecodeForwarder(AudioDecoder* decoder) : decoder_(decoder) {}
+ int Decode(const uint8_t* encoded,
+ size_t encoded_len,
+ int sample_rate_hz,
+ int16_t* decoded,
+ AudioDecoder::SpeechType* speech_type) {
+ return decoder_->Decode(encoded, encoded_len, sample_rate_hz,
+ decoder_->PacketDuration(encoded, encoded_len) *
+ decoder_->Channels() * sizeof(int16_t),
+ decoded, speech_type);
+ }
+
+ private:
+ AudioDecoder* const decoder_;
+ };
+
AudioDecoderPcmU decoder(1);
+ DecodeForwarder decode_forwarder(&decoder);
MockAudioDecoder mock_decoder;
// Set expectations on the mock decoder and also delegate the calls to the
// real decoder.
@@ -986,9 +1008,9 @@ TEST_F(AcmReceiverBitExactnessOldApi,
EXPECT_CALL(mock_decoder, Channels())
.Times(AtLeast(1))
.WillRepeatedly(Invoke(&decoder, &AudioDecoderPcmU::Channels));
- EXPECT_CALL(mock_decoder, Decode(_, _, _, _, _, _))
+ EXPECT_CALL(mock_decoder, DecodeInternal(_, _, _, _, _))
.Times(AtLeast(1))
- .WillRepeatedly(Invoke(&decoder, &AudioDecoderPcmU::Decode));
+ .WillRepeatedly(Invoke(&decode_forwarder, &DecodeForwarder::Decode));
EXPECT_CALL(mock_decoder, HasDecodePlc())
.Times(AtLeast(1))
.WillRepeatedly(Invoke(&decoder, &AudioDecoderPcmU::HasDecodePlc));
« 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