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

Unified Diff: webrtc/modules/audio_coding/neteq/neteq_network_stats_unittest.cc

Issue 1353803002: Simple cleanups of AudioDecoder and AudioEncoder classes (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@dmove-isac
Patch Set: rebase Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/modules/audio_coding/neteq/audio_decoder_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/audio_coding/neteq/neteq_network_stats_unittest.cc
diff --git a/webrtc/modules/audio_coding/neteq/neteq_network_stats_unittest.cc b/webrtc/modules/audio_coding/neteq/neteq_network_stats_unittest.cc
index e3a0cc17af5ca83f6ac0ac95a2b6aa04a00cda65..e9ebe064eb7f92b98a5f162b07c195d26d9833d3 100644
--- a/webrtc/modules/audio_coding/neteq/neteq_network_stats_unittest.cc
+++ b/webrtc/modules/audio_coding/neteq/neteq_network_stats_unittest.cc
@@ -10,7 +10,6 @@
#include "testing/gmock/include/gmock/gmock.h"
#include "webrtc/base/scoped_ptr.h"
-#include "webrtc/modules/audio_coding/codecs/opus/interface/audio_decoder_opus.h"
#include "webrtc/modules/audio_coding/neteq/tools/neteq_external_decoder_test.h"
#include "webrtc/modules/audio_coding/neteq/tools/rtp_generator.h"
@@ -21,16 +20,14 @@ using ::testing::_;
using ::testing::SetArgPointee;
using ::testing::Return;
-
-class MockAudioDecoderOpus : public AudioDecoderOpus {
+class MockAudioDecoder final : public AudioDecoder {
public:
static const int kPacketDuration = 960; // 48 kHz * 20 ms
- explicit MockAudioDecoderOpus(int num_channels)
- : AudioDecoderOpus(num_channels),
- fec_enabled_(false) {
+ explicit MockAudioDecoder(size_t num_channels)
+ : num_channels_(num_channels), fec_enabled_(false) {
}
- virtual ~MockAudioDecoderOpus() { Die(); }
+ ~MockAudioDecoder() override { Die(); }
MOCK_METHOD0(Die, void());
MOCK_METHOD0(Reset, void());
@@ -49,6 +46,8 @@ class MockAudioDecoderOpus : public AudioDecoderOpus {
return fec_enabled_;
}
+ size_t Channels() const override { return num_channels_; }
+
void set_fec_enabled(bool enable_fec) { fec_enabled_ = enable_fec; }
bool fec_enabled() const { return fec_enabled_; }
@@ -75,13 +74,14 @@ class MockAudioDecoderOpus : public AudioDecoderOpus {
}
private:
+ const size_t num_channels_;
bool fec_enabled_;
};
class NetEqNetworkStatsTest : public NetEqExternalDecoderTest {
public:
static const int kPayloadSizeByte = 30;
- static const int kFrameSizeMs = 20; // frame size of Opus
+ static const int kFrameSizeMs = 20;
static const int kMaxOutputSize = 960; // 10 ms * 48 kHz * 2 channels.
enum logic {
@@ -108,7 +108,7 @@ struct NetEqNetworkStatsCheck {
};
NetEqNetworkStatsTest(NetEqDecoder codec,
- MockAudioDecoderOpus* decoder)
+ MockAudioDecoder* decoder)
: NetEqExternalDecoderTest(codec, decoder),
external_decoder_(decoder),
samples_per_ms_(CodecSampleRateHz(codec) / 1000),
@@ -227,7 +227,7 @@ struct NetEqNetworkStatsCheck {
expects.stats_ref.expand_rate = expects.stats_ref.speech_expand_rate = 1065;
RunTest(50, expects);
- // Next we enable Opus FEC.
+ // Next we enable FEC.
external_decoder_->set_fec_enabled(true);
// If FEC fills in the lost packets, no packet loss will be counted.
expects.stats_ref.packet_loss_rate = 0;
@@ -261,7 +261,7 @@ struct NetEqNetworkStatsCheck {
}
private:
- MockAudioDecoderOpus* external_decoder_;
+ MockAudioDecoder* external_decoder_;
const int samples_per_ms_;
const size_t frame_size_samples_;
rtc::scoped_ptr<test::RtpGenerator> rtp_generator_;
@@ -272,22 +272,22 @@ struct NetEqNetworkStatsCheck {
int16_t output_[kMaxOutputSize];
};
-TEST(NetEqNetworkStatsTest, OpusDecodeFec) {
- MockAudioDecoderOpus decoder(1);
+TEST(NetEqNetworkStatsTest, DecodeFec) {
+ MockAudioDecoder decoder(1);
NetEqNetworkStatsTest test(kDecoderOpus, &decoder);
test.DecodeFecTest();
EXPECT_CALL(decoder, Die()).Times(1);
}
-TEST(NetEqNetworkStatsTest, StereoOpusDecodeFec) {
- MockAudioDecoderOpus decoder(2);
+TEST(NetEqNetworkStatsTest, StereoDecodeFec) {
+ MockAudioDecoder decoder(2);
NetEqNetworkStatsTest test(kDecoderOpus, &decoder);
test.DecodeFecTest();
EXPECT_CALL(decoder, Die()).Times(1);
}
TEST(NetEqNetworkStatsTest, NoiseExpansionTest) {
- MockAudioDecoderOpus decoder(1);
+ MockAudioDecoder decoder(1);
NetEqNetworkStatsTest test(kDecoderOpus, &decoder);
test.NoiseExpansionTest();
EXPECT_CALL(decoder, Die()).Times(1);
« no previous file with comments | « webrtc/modules/audio_coding/neteq/audio_decoder_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698