Remove mixing tests from voe_extended_test.cc
These have been moved to: src/voice_engine/main/test/auto_test/standard/mixing_test.cc BUG= TEST=build voe_auto_test Review URL: https://webrtc-codereview.appspot.com/588005 git-svn-id: http://webrtc.googlecode.com/svn/trunk@2296 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
51b4f3e6a8
commit
f45d47ad7d
@ -4776,176 +4776,6 @@ int VoEExtendedTest::TestFile() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// VoEExtendedTest::TestMixing
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// Creates and mixes |num_remote_channels| which play a file "as microphone"
|
||||
// with |num_local_channels| which play a file "locally", using a constant
|
||||
// amplitude of |input_value|.
|
||||
//
|
||||
// The mixed output is verified to always fall between |max_output_value| and
|
||||
// |min_output_value|, after a startup phase.
|
||||
int VoEExtendedTest::RunMixingTest(int num_remote_channels,
|
||||
int num_local_channels,
|
||||
int16_t input_value,
|
||||
int16_t max_output_value,
|
||||
int16_t min_output_value) {
|
||||
VoEBase* voe_base_ = _mgr.BasePtr();
|
||||
VoEFile* file = _mgr.FilePtr();
|
||||
VoECodec* codec = _mgr.CodecPtr();
|
||||
VoEAudioProcessing* apm = _mgr.APMPtr();
|
||||
|
||||
// Use L16 at 16kHz to minimize distortion (file recording is 16kHz
|
||||
// and resampling will cause large distortions).
|
||||
CodecInst codec_inst;
|
||||
strcpy(codec_inst.plname, "L16");
|
||||
codec_inst.channels = 1;
|
||||
codec_inst.rate = 256000;
|
||||
codec_inst.plfreq = 16000;
|
||||
codec_inst.pltype = 105;
|
||||
codec_inst.pacsize = 160;
|
||||
|
||||
apm->SetNsStatus(false);
|
||||
apm->SetAgcStatus(false);
|
||||
apm->SetEcStatus(false);
|
||||
|
||||
const char file_to_generate_name[] = "dc_file.pcm";
|
||||
const char* input_filename = file_to_generate_name;
|
||||
FILE* file_to_generate = fopen(file_to_generate_name, "wb");
|
||||
ASSERT_TRUE(file_to_generate != NULL);
|
||||
for (int i = 0; i < 160 * 100 * 5; i++) {
|
||||
fwrite(&input_value, sizeof(input_value), 1, file_to_generate);
|
||||
}
|
||||
fclose(file_to_generate);
|
||||
|
||||
TEST_MUSTPASS(voe_base_->Init());
|
||||
|
||||
std::vector<int> local_channels(num_local_channels);
|
||||
for (int i = 0; i < num_local_channels; ++i) {
|
||||
local_channels[i] = voe_base_->CreateChannel();
|
||||
ASSERT_TRUE(local_channels[i] != -1);
|
||||
TEST_MUSTPASS(voe_base_->StartPlayout(local_channels[i]));
|
||||
TEST_MUSTPASS(file->StartPlayingFileLocally(local_channels[i],
|
||||
input_filename,
|
||||
true));
|
||||
}
|
||||
|
||||
std::vector<int> remote_channels(num_remote_channels);
|
||||
for (int i = 0; i < num_remote_channels; ++i) {
|
||||
remote_channels[i] = voe_base_->CreateChannel();
|
||||
ASSERT_TRUE(remote_channels[i] != -1);
|
||||
TEST_MUSTPASS(codec->SetRecPayloadType(remote_channels[i], codec_inst));
|
||||
TEST_MUSTPASS(voe_base_->SetLocalReceiver(remote_channels[i],
|
||||
1234 + 2 * i));
|
||||
TEST_MUSTPASS(voe_base_->SetSendDestination(remote_channels[i],
|
||||
1234 + 2 * i,
|
||||
"127.0.0.1"));
|
||||
TEST_MUSTPASS(voe_base_->StartReceive(remote_channels[i]));
|
||||
TEST_MUSTPASS(voe_base_->StartPlayout(remote_channels[i]));
|
||||
TEST_MUSTPASS(codec->SetSendCodec(remote_channels[i], codec_inst));
|
||||
TEST_MUSTPASS(voe_base_->StartSend(remote_channels[i]));
|
||||
TEST_MUSTPASS(file->StartPlayingFileAsMicrophone(remote_channels[i],
|
||||
input_filename,
|
||||
true));
|
||||
}
|
||||
|
||||
const char mix_result[] = "mix_result.pcm";
|
||||
TEST_MUSTPASS(file->StartRecordingPlayout(-1/*record meeting*/,
|
||||
mix_result));
|
||||
TEST_LOG("Playing %d remote channels.\n", num_remote_channels);
|
||||
TEST_LOG("Playing %d local channels.\n", num_local_channels);
|
||||
SLEEP(5000);
|
||||
TEST_MUSTPASS(file->StopRecordingPlayout(-1));
|
||||
TEST_LOG("Stopping\n");
|
||||
|
||||
for (int i = 0; i < num_local_channels; ++i) {
|
||||
TEST_MUSTPASS(voe_base_->StopPlayout(local_channels[i]));
|
||||
TEST_MUSTPASS(voe_base_->DeleteChannel(local_channels[i]));
|
||||
}
|
||||
|
||||
for (int i = 0; i < num_remote_channels; ++i) {
|
||||
TEST_MUSTPASS(voe_base_->StopSend(remote_channels[i]));
|
||||
TEST_MUSTPASS(voe_base_->StopPlayout(remote_channels[i]));
|
||||
TEST_MUSTPASS(voe_base_->StopReceive(remote_channels[i]));
|
||||
TEST_MUSTPASS(voe_base_->DeleteChannel(remote_channels[i]));
|
||||
}
|
||||
|
||||
FILE* verification_file = fopen(mix_result, "rb");
|
||||
ASSERT_TRUE(verification_file != NULL);
|
||||
int16_t mix_value = 0;
|
||||
// Skip the first 100 ms to avoid initialization and ramping-in effects.
|
||||
ASSERT_TRUE(fseek(verification_file, sizeof(int16_t) * 1600, SEEK_SET) == 0);
|
||||
while (fread(&mix_value, sizeof(mix_value), 1, verification_file)) {
|
||||
ASSERT_TRUE(mix_value <= max_output_value)
|
||||
ASSERT_TRUE(mix_value >= min_output_value);
|
||||
}
|
||||
fclose(verification_file);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// TODO(andrew): move or copy these to the mixer module test when possible.
|
||||
int VoEExtendedTest::TestMixing() {
|
||||
// These tests assume a maxmium of three mixed participants. We allow a
|
||||
// +/- 10% range around the expected output level to accout for distortion
|
||||
// from coding and processing in the loopback chain.
|
||||
|
||||
// Create four channels and make sure that only three are mixed.
|
||||
TEST_LOG("Test max-three-participant mixing.\n");
|
||||
int16_t input_value = 1000;
|
||||
int16_t expected_output = input_value * 3;
|
||||
if (RunMixingTest(4, 0, input_value, 1.1 * expected_output,
|
||||
0.9 * expected_output) != 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Ensure the mixing saturation protection is working. We can do this because
|
||||
// the mixing limiter is given some headroom, so the expected output is less
|
||||
// than full scale.
|
||||
TEST_LOG("Test mixing saturation protection.\n");
|
||||
input_value = 20000;
|
||||
expected_output = 29204; // = -1 dBFS, the limiter headroom.
|
||||
// If this isn't satisfied, we're not testing anything.
|
||||
assert(input_value * 3 > 32767);
|
||||
assert(1.1 * expected_output < 32767);
|
||||
if (RunMixingTest(3, 0, input_value, 1.1 * expected_output,
|
||||
0.9 * expected_output) != 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Ensure the mixing saturation protection is not applied when only using a
|
||||
// single channel.
|
||||
TEST_LOG("Test saturation protection has no effect on one channel.\n");
|
||||
input_value = 32767;
|
||||
expected_output = 32767;
|
||||
// If this isn't satisfied, we're not testing anything.
|
||||
assert(0.95 * expected_output > 29204); // = -1 dBFS, the limiter headroom.
|
||||
if (RunMixingTest(1, 0, input_value, expected_output,
|
||||
0.95 * expected_output) != 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
TEST_LOG("Test combinations of 'anonymous' participants and regular "
|
||||
"participants.\n");
|
||||
input_value = 1000;
|
||||
expected_output = input_value * 2;
|
||||
if (RunMixingTest(1, 1, input_value, 1.1 * expected_output,
|
||||
0.9 * expected_output) != 0) {
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
expected_output = input_value * 4;
|
||||
if (RunMixingTest(3, 1, input_value, 1.1 * expected_output,
|
||||
0.9 * expected_output) != 0) {
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// VoEExtendedTest::TestHardware
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@ -149,42 +149,37 @@ bool SubAPIManager::GetExtendedMenuSelection(ExtendedSelection& sel) {
|
||||
printf("\n");
|
||||
else
|
||||
printf(" (NA)\n");
|
||||
printf(" (8) Mixing");
|
||||
if (_file)
|
||||
printf("\n");
|
||||
else
|
||||
printf(" (NA)\n");
|
||||
printf(" (9) Hardware");
|
||||
printf(" (8) Hardware");
|
||||
if (_hardware)
|
||||
printf("\n");
|
||||
else
|
||||
printf(" (NA)\n");
|
||||
printf(" (10) NetEqStats");
|
||||
printf(" (9) NetEqStats");
|
||||
if (_netEqStats)
|
||||
printf("\n");
|
||||
else
|
||||
printf(" (NA)\n");
|
||||
printf(" (11) Network");
|
||||
printf(" (10) Network");
|
||||
if (_network)
|
||||
printf("\n");
|
||||
else
|
||||
printf(" (NA)\n");
|
||||
printf(" (12) RTP_RTCP");
|
||||
printf(" (11) RTP_RTCP");
|
||||
if (_rtp_rtcp)
|
||||
printf("\n");
|
||||
else
|
||||
printf(" (NA)\n");
|
||||
printf(" (13) VideoSync");
|
||||
printf(" (12) VideoSync");
|
||||
if (_videoSync)
|
||||
printf("\n");
|
||||
else
|
||||
printf(" (NA)\n");
|
||||
printf(" (14) VolumeControl");
|
||||
printf(" (13) VolumeControl");
|
||||
if (_volumeControl)
|
||||
printf("\n");
|
||||
else
|
||||
printf(" (NA)\n");
|
||||
printf(" (15) AudioProcessing");
|
||||
printf(" (14) AudioProcessing");
|
||||
if (_apm)
|
||||
printf("\n");
|
||||
else
|
||||
@ -228,34 +223,30 @@ bool SubAPIManager::GetExtendedMenuSelection(ExtendedSelection& sel) {
|
||||
xsel = XSEL_File;
|
||||
break;
|
||||
case 8:
|
||||
if (_file)
|
||||
xsel = XSEL_Mixing;
|
||||
break;
|
||||
case 9:
|
||||
if (_hardware)
|
||||
xsel = XSEL_Hardware;
|
||||
break;
|
||||
case 10:
|
||||
case 9:
|
||||
if (_netEqStats)
|
||||
xsel = XSEL_NetEqStats;
|
||||
break;
|
||||
case 11:
|
||||
case 10:
|
||||
if (_network)
|
||||
xsel = XSEL_Network;
|
||||
break;
|
||||
case 12:
|
||||
case 11:
|
||||
if (_rtp_rtcp)
|
||||
xsel = XSEL_RTP_RTCP;
|
||||
break;
|
||||
case 13:
|
||||
case 12:
|
||||
if (_videoSync)
|
||||
xsel = XSEL_VideoSync;
|
||||
break;
|
||||
case 14:
|
||||
case 13:
|
||||
if (_volumeControl)
|
||||
xsel = XSEL_VolumeControl;
|
||||
break;
|
||||
case 15:
|
||||
case 14:
|
||||
if (_apm)
|
||||
xsel = XSEL_AudioProcessing;
|
||||
break;
|
||||
@ -492,11 +483,6 @@ int run_auto_test(TestType test_type, ExtendedSelection ext_selection) {
|
||||
break;
|
||||
xtend.TestPassed("File");
|
||||
}
|
||||
if (ext_selection == XSEL_Mixing || ext_selection == XSEL_All) {
|
||||
if ((result = xtend.TestMixing()) == -1)
|
||||
break;
|
||||
xtend.TestPassed("Mixing");
|
||||
}
|
||||
if (ext_selection == XSEL_Hardware || ext_selection == XSEL_All) {
|
||||
if ((result = xtend.TestHardware()) == -1)
|
||||
break;
|
||||
|
@ -38,7 +38,6 @@ enum ExtendedSelection {
|
||||
XSEL_Encryption,
|
||||
XSEL_ExternalMedia,
|
||||
XSEL_File,
|
||||
XSEL_Mixing,
|
||||
XSEL_Hardware,
|
||||
XSEL_NetEqStats,
|
||||
XSEL_Network,
|
||||
|
Loading…
x
Reference in New Issue
Block a user