Extend AcmSwitchingOutputFrequencyOldApi with more frequencies

Also reducing test duration, since the issue is triggered anyway.
The tests that are not failing are now enabled.

BUG=3919
R=kwiberg@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/29749004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7453 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
henrik.lundin@webrtc.org 2014-10-15 08:50:00 +00:00
parent 64f5611b3d
commit 99e561f6a6

View File

@ -946,7 +946,7 @@ class AcmSwitchingOutputFrequencyOldApi : public ::testing::Test,
public test::PacketSource,
public test::AudioSink {
protected:
static const size_t kTestNumPackets = 100;
static const size_t kTestNumPackets = 50;
static const int kEncodedSampleRateHz = 16000;
static const size_t kPayloadLenSamples = 30 * kEncodedSampleRateHz / 1000;
static const int kPayloadType = 108; // Default payload type for PCM16b-wb.
@ -958,10 +958,10 @@ class AcmSwitchingOutputFrequencyOldApi : public ::testing::Test,
kSampleValue,
kEncodedSampleRateHz,
kPayloadType),
high_output_freq_(0),
output_freq_2_(0),
has_toggled_(false) {}
void Run(int low_output_freq, int high_output_freq, int toggle_period_ms) {
void Run(int output_freq_1, int output_freq_2, int toggle_period_ms) {
// Set up the receiver used to decode the packets and verify the decoded
// output.
const std::string output_file_name =
@ -978,12 +978,12 @@ class AcmSwitchingOutputFrequencyOldApi : public ::testing::Test,
test::AcmReceiveTestToggleOutputFreqOldApi receive_test(
this,
&output,
low_output_freq,
high_output_freq,
output_freq_1,
output_freq_2,
toggle_period_ms,
test::AcmReceiveTestOldApi::kMonoOutput);
ASSERT_NO_FATAL_FAILURE(receive_test.RegisterDefaultCodecs());
high_output_freq_ = high_output_freq;
output_freq_2_ = output_freq_2;
// This is where the actual test is executed.
receive_test.Run();
@ -1015,7 +1015,7 @@ class AcmSwitchingOutputFrequencyOldApi : public ::testing::Test,
EXPECT_EQ(kSampleValue, audio[i]);
}
if (num_samples ==
static_cast<size_t>(high_output_freq_ / 100)) // Size of 10 ms frame.
static_cast<size_t>(output_freq_2_ / 100)) // Size of 10 ms frame.
has_toggled_ = true;
// The return value does not say if the values match the expectation, just
// that the method could process the samples.
@ -1026,7 +1026,7 @@ class AcmSwitchingOutputFrequencyOldApi : public ::testing::Test,
bool first_output_;
size_t num_packets_;
test::ConstantPcmPacketSource packet_source_;
int high_output_freq_;
int output_freq_2_;
bool has_toggled_;
};
@ -1034,7 +1034,19 @@ TEST_F(AcmSwitchingOutputFrequencyOldApi, TestWithoutToggling) {
Run(16000, 16000, 1000);
}
TEST_F(AcmSwitchingOutputFrequencyOldApi, DISABLED_TestWithToggling) {
TEST_F(AcmSwitchingOutputFrequencyOldApi, DISABLED_Toggle16KhzTo32Khz) {
Run(16000, 32000, 1000);
}
TEST_F(AcmSwitchingOutputFrequencyOldApi, Toggle32KhzTo16Khz) {
Run(32000, 16000, 1000);
}
TEST_F(AcmSwitchingOutputFrequencyOldApi, DISABLED_Toggle16KhzTo8Khz) {
Run(16000, 8000, 1000);
}
TEST_F(AcmSwitchingOutputFrequencyOldApi, Toggle8KhzTo16Khz) {
Run(8000, 16000, 1000);
}
} // namespace webrtc