Remove unused audio_e2e_harness.cc and infrastructure.
BUG=webrtc:4690 Review-Url: https://codereview.webrtc.org/2295283004 Cr-Commit-Position: refs/heads/master@{#14165}
This commit is contained in:
parent
467bc84dc9
commit
96f2c4df31
@ -219,28 +219,6 @@ if (rtc_include_tests) {
|
||||
]
|
||||
}
|
||||
|
||||
rtc_executable("audio_e2e_harness") {
|
||||
testonly = true
|
||||
sources = [
|
||||
"e2e_quality/audio/audio_e2e_harness.cc",
|
||||
]
|
||||
|
||||
if (is_clang) {
|
||||
# Suppress warnings from the Chromium Clang plugin.
|
||||
# See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
|
||||
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
|
||||
}
|
||||
|
||||
deps = [
|
||||
"../system_wrappers:system_wrappers_default",
|
||||
"../test:channel_transport",
|
||||
"../voice_engine",
|
||||
"//build/win:default_exe_manifest",
|
||||
"//testing/gtest",
|
||||
"//third_party/gflags",
|
||||
]
|
||||
}
|
||||
|
||||
if (is_android || is_ios) {
|
||||
tools_unittests_resources = [ "//resources/foreman_cif.yuv" ]
|
||||
}
|
||||
|
||||
@ -6,6 +6,5 @@ include_rules = [
|
||||
"+webrtc/modules/congestion_controller",
|
||||
"+webrtc/modules/rtp_rtcp",
|
||||
"+webrtc/system_wrappers",
|
||||
"+webrtc/voice_engine",
|
||||
]
|
||||
|
||||
|
||||
@ -1,27 +0,0 @@
|
||||
The tools here run an end-to-end audio quality test on Linux using PulseAudio.
|
||||
|
||||
INSTALLATION
|
||||
The test depends on PulseAudio virtual devices (null sinks). Without additional
|
||||
arguments, run_audio_test.py expects a pair of sinks named "capture" and
|
||||
"render". To create these devices at machine startup, place the provided
|
||||
default.pa file in ~/.pulse. Alternately, the "pacmd" commands therein can be
|
||||
run on the command-line to create the devices.
|
||||
|
||||
Similarly, place the provided daemon.conf file in ~/.pulse to use high quality
|
||||
resampling in PulseAudio. This will reduce the resampling impact on the outcome
|
||||
of the test.
|
||||
|
||||
Build all WebRTC targets as usual (or just the audio_e2e_harness target) to
|
||||
generate the VoiceEngine harness.
|
||||
|
||||
USAGE
|
||||
Run run_audio_test.py to start. The script has reasonable defaults and will
|
||||
use the expected location of audio_e2e_harness. Some settings will usually
|
||||
be provided by the user, particularly the comparison tool command-line and
|
||||
regular expression to extract the quality metric.
|
||||
|
||||
An example command-line, run from trunk/
|
||||
|
||||
webrtc/tools/e2e_quality/audio/run_audio_test.py \
|
||||
--input=data/voice_engine/audio_short16.pcm --output=e2e_audio_out.pcm \
|
||||
--codec=L16 --compare="comparison-tool" --regexp="(\d\.\d{3})"
|
||||
@ -1,109 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
// Sets up a simple VoiceEngine loopback call with the default audio devices
|
||||
// and runs forever. Some parameters can be configured through command-line
|
||||
// flags.
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "gflags/gflags.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
||||
#include "webrtc/test/channel_transport/channel_transport.h"
|
||||
#include "webrtc/voice_engine/include/voe_audio_processing.h"
|
||||
#include "webrtc/voice_engine/include/voe_base.h"
|
||||
#include "webrtc/voice_engine/include/voe_codec.h"
|
||||
#include "webrtc/voice_engine/include/voe_hardware.h"
|
||||
#include "webrtc/voice_engine/include/voe_network.h"
|
||||
|
||||
DEFINE_string(render, "render", "render device name");
|
||||
DEFINE_string(codec, "ISAC", "codec name");
|
||||
DEFINE_int32(rate, 16000, "codec sample rate in Hz");
|
||||
|
||||
namespace webrtc {
|
||||
namespace test {
|
||||
|
||||
void RunHarness() {
|
||||
VoiceEngine* voe = VoiceEngine::Create();
|
||||
ASSERT_TRUE(voe != NULL);
|
||||
VoEAudioProcessing* audio = VoEAudioProcessing::GetInterface(voe);
|
||||
ASSERT_TRUE(audio != NULL);
|
||||
VoEBase* base = VoEBase::GetInterface(voe);
|
||||
ASSERT_TRUE(base != NULL);
|
||||
VoECodec* codec = VoECodec::GetInterface(voe);
|
||||
ASSERT_TRUE(codec != NULL);
|
||||
VoEHardware* hardware = VoEHardware::GetInterface(voe);
|
||||
ASSERT_TRUE(hardware != NULL);
|
||||
VoENetwork* network = VoENetwork::GetInterface(voe);
|
||||
ASSERT_TRUE(network != NULL);
|
||||
|
||||
ASSERT_EQ(0, base->Init());
|
||||
int channel = base->CreateChannel();
|
||||
ASSERT_NE(-1, channel);
|
||||
|
||||
std::unique_ptr<VoiceChannelTransport> voice_channel_transport(
|
||||
new VoiceChannelTransport(network, channel));
|
||||
|
||||
ASSERT_EQ(0, voice_channel_transport->SetSendDestination("127.0.0.1", 1234));
|
||||
ASSERT_EQ(0, voice_channel_transport->SetLocalReceiver(1234));
|
||||
|
||||
CodecInst codec_params = {0};
|
||||
bool codec_found = false;
|
||||
for (int i = 0; i < codec->NumOfCodecs(); i++) {
|
||||
ASSERT_EQ(0, codec->GetCodec(i, codec_params));
|
||||
if (FLAGS_codec.compare(codec_params.plname) == 0 &&
|
||||
FLAGS_rate == codec_params.plfreq) {
|
||||
codec_found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
ASSERT_TRUE(codec_found);
|
||||
ASSERT_EQ(0, codec->SetSendCodec(channel, codec_params));
|
||||
|
||||
int num_devices = 0;
|
||||
ASSERT_EQ(0, hardware->GetNumOfPlayoutDevices(num_devices));
|
||||
char device_name[128] = {0};
|
||||
char guid[128] = {0};
|
||||
bool device_found = false;
|
||||
int device_index;
|
||||
for (device_index = 0; device_index < num_devices; device_index++) {
|
||||
ASSERT_EQ(0, hardware->GetPlayoutDeviceName(device_index, device_name,
|
||||
guid));
|
||||
if (FLAGS_render.compare(device_name) == 0) {
|
||||
device_found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
ASSERT_TRUE(device_found);
|
||||
ASSERT_EQ(0, hardware->SetPlayoutDevice(device_index));
|
||||
|
||||
// Disable all audio processing.
|
||||
ASSERT_EQ(0, audio->SetAgcStatus(false));
|
||||
ASSERT_EQ(0, audio->SetEcStatus(false));
|
||||
ASSERT_EQ(0, audio->EnableHighPassFilter(false));
|
||||
ASSERT_EQ(0, audio->SetNsStatus(false));
|
||||
|
||||
ASSERT_EQ(0, base->StartReceive(channel));
|
||||
ASSERT_EQ(0, base->StartPlayout(channel));
|
||||
ASSERT_EQ(0, base->StartSend(channel));
|
||||
|
||||
// Run forever...
|
||||
while (1) {
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace test
|
||||
} // namespace webrtc
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
google::ParseCommandLineFlags(&argc, &argv, true);
|
||||
webrtc::test::RunHarness();
|
||||
}
|
||||
@ -1 +0,0 @@
|
||||
resample-method = speex-float-9
|
||||
@ -1,6 +0,0 @@
|
||||
# Place in ~/.pulse/ to add null sinks for the audio end-to-end quality test.
|
||||
|
||||
.include /etc/pulse/default.pa
|
||||
|
||||
load-module module-null-sink sink_name=render sink_properties=device.description=render format=s16 rate=48000 channels=1
|
||||
load-module module-null-sink sink_name=capture sink_properties=device.description=capture format=s16 rate=48000 channels=1
|
||||
@ -1 +0,0 @@
|
||||
../../../../tools/perf
|
||||
@ -1,131 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
||||
#
|
||||
# Use of this source code is governed by a BSD-style license
|
||||
# that can be found in the LICENSE file in the root of the source
|
||||
# tree. An additional intellectual property rights grant can be found
|
||||
# in the file PATENTS. All contributing project authors may
|
||||
# be found in the AUTHORS file in the root of the source tree.
|
||||
|
||||
"""Runs an end-to-end audio quality test on Linux.
|
||||
|
||||
Expects the presence of PulseAudio virtual devices (null sinks). These are
|
||||
configured as default devices for a VoiceEngine audio call. A PulseAudio
|
||||
utility (pacat) is used to play to and record from the virtual devices.
|
||||
|
||||
The input reference file is then compared to the output file.
|
||||
"""
|
||||
|
||||
import optparse
|
||||
import os
|
||||
import re
|
||||
import shlex
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
|
||||
import perf.perf_utils
|
||||
|
||||
def main(argv):
|
||||
parser = optparse.OptionParser()
|
||||
usage = 'Usage: %prog [options]'
|
||||
parser.set_usage(usage)
|
||||
parser.add_option('--input', default='input.pcm', help='input PCM file')
|
||||
parser.add_option('--output', default='output.pcm', help='output PCM file')
|
||||
parser.add_option('--codec', default='ISAC', help='codec name')
|
||||
parser.add_option('--rate', default='16000', help='sample rate in Hz')
|
||||
parser.add_option('--channels', default='1', help='number of channels')
|
||||
parser.add_option('--play_sink', default='capture',
|
||||
help='name of PulseAudio sink to which to play audio')
|
||||
parser.add_option('--rec_sink', default='render',
|
||||
help='name of PulseAudio sink whose monitor will be recorded')
|
||||
parser.add_option('--harness',
|
||||
default=os.path.abspath(os.path.dirname(sys.argv[0]) +
|
||||
'/../../../out/Debug/audio_e2e_harness'),
|
||||
help='path to audio harness executable')
|
||||
parser.add_option('--compare',
|
||||
help='command-line arguments for comparison tool')
|
||||
parser.add_option('--regexp',
|
||||
help='regular expression to extract the comparison metric')
|
||||
options, _ = parser.parse_args(argv[1:])
|
||||
|
||||
# Get the initial default capture device, to restore later.
|
||||
command = ['pacmd', 'list-sources']
|
||||
print ' '.join(command)
|
||||
proc = subprocess.Popen(command, stdout=subprocess.PIPE)
|
||||
output = proc.communicate()[0]
|
||||
if proc.returncode != 0:
|
||||
return proc.returncode
|
||||
default_source = re.search(r'(^ \* index: )([0-9]+$)', output,
|
||||
re.MULTILINE).group(2)
|
||||
|
||||
# Set the default capture device to be used by VoiceEngine. We unfortunately
|
||||
# need to do this rather than select the devices directly through the harness
|
||||
# because monitor sources don't appear in VoiceEngine except as defaults.
|
||||
#
|
||||
# We pass the render device for VoiceEngine to select because (for unknown
|
||||
# reasons) the virtual device is sometimes not used when the default.
|
||||
command = ['pacmd', 'set-default-source', options.play_sink + '.monitor']
|
||||
print ' '.join(command)
|
||||
retcode = subprocess.call(command, stdout=subprocess.PIPE)
|
||||
if retcode != 0:
|
||||
return retcode
|
||||
|
||||
command = [options.harness, '--render=' + options.rec_sink,
|
||||
'--codec=' + options.codec, '--rate=' + options.rate]
|
||||
print ' '.join(command)
|
||||
voe_proc = subprocess.Popen(command)
|
||||
|
||||
# If recording starts before there is data available, pacat sometimes
|
||||
# inexplicably adds a large delay to the start of the file. We wait here in
|
||||
# an attempt to prevent that, because VoE often takes some time to startup a
|
||||
# call.
|
||||
time.sleep(5)
|
||||
|
||||
format_args = ['--format=s16le', '--rate=' + options.rate,
|
||||
'--channels=' + options.channels, '--raw']
|
||||
command = (['pacat', '-p', '-d', options.play_sink] + format_args +
|
||||
[options.input])
|
||||
print ' '.join(command)
|
||||
play_proc = subprocess.Popen(command)
|
||||
|
||||
command = (['pacat', '-r', '-d', options.rec_sink + '.monitor'] +
|
||||
format_args + [options.output])
|
||||
print ' '.join(command)
|
||||
record_proc = subprocess.Popen(command)
|
||||
|
||||
retcode = play_proc.wait()
|
||||
# If these ended early, an exception will be thrown here.
|
||||
record_proc.kill()
|
||||
voe_proc.kill()
|
||||
if retcode != 0:
|
||||
return retcode
|
||||
|
||||
# Restore the initial default capture device.
|
||||
command = ['pacmd', 'set-default-source', default_source]
|
||||
print ' '.join(command)
|
||||
retcode = subprocess.call(command, stdout=subprocess.PIPE)
|
||||
if retcode != 0:
|
||||
return retcode
|
||||
|
||||
if options.compare and options.regexp:
|
||||
command = shlex.split(options.compare) + [options.input, options.output]
|
||||
print ' '.join(command)
|
||||
proc = subprocess.Popen(command, stdout=subprocess.PIPE)
|
||||
output = proc.communicate()[0]
|
||||
if proc.returncode != 0:
|
||||
return proc.returncode
|
||||
|
||||
# The list should only contain one item.
|
||||
value = ''.join(re.findall(options.regexp, output))
|
||||
|
||||
perf.perf_utils.PrintPerfResult(graph_name='audio_e2e_score',
|
||||
series_name='e2e_score',
|
||||
data_point=value,
|
||||
units='MOS') # Assuming we run PESQ.
|
||||
|
||||
return 0
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main(sys.argv))
|
||||
@ -176,20 +176,6 @@
|
||||
'agc/activity_metric.cc',
|
||||
],
|
||||
}, # activity_metric
|
||||
{
|
||||
'target_name': 'audio_e2e_harness',
|
||||
'type': 'executable',
|
||||
'dependencies': [
|
||||
'<(webrtc_root)/test/test.gyp:channel_transport',
|
||||
'<(webrtc_root)/voice_engine/voice_engine.gyp:voice_engine',
|
||||
'<(webrtc_root)/system_wrappers/system_wrappers.gyp:system_wrappers_default',
|
||||
'<(DEPTH)/testing/gtest.gyp:gtest',
|
||||
'<(DEPTH)/third_party/gflags/gflags.gyp:gflags',
|
||||
],
|
||||
'sources': [
|
||||
'e2e_quality/audio/audio_e2e_harness.cc',
|
||||
],
|
||||
}, # audio_e2e_harness
|
||||
{
|
||||
'target_name': 'tools_unittests',
|
||||
'type': '<(gtest_target_type)',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user