summaryrefslogtreecommitdiffstats
path: root/third_party/libwebrtc/audio/test
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /third_party/libwebrtc/audio/test
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--third_party/libwebrtc/audio/test/OWNERS3
-rw-r--r--third_party/libwebrtc/audio/test/audio_end_to_end_test.cc91
-rw-r--r--third_party/libwebrtc/audio/test/audio_end_to_end_test.h64
-rw-r--r--third_party/libwebrtc/audio/test/audio_stats_test.cc115
-rw-r--r--third_party/libwebrtc/audio/test/low_bandwidth_audio_test.cc109
-rwxr-xr-xthird_party/libwebrtc/audio/test/low_bandwidth_audio_test.py365
-rw-r--r--third_party/libwebrtc/audio/test/low_bandwidth_audio_test_flags.cc28
-rw-r--r--third_party/libwebrtc/audio/test/nack_test.cc59
-rw-r--r--third_party/libwebrtc/audio/test/non_sender_rtt_test.cc58
-rw-r--r--third_party/libwebrtc/audio/test/pc_low_bandwidth_audio_test.cc176
-rwxr-xr-xthird_party/libwebrtc/audio/test/unittests/low_bandwidth_audio_test_test.py239
11 files changed, 1307 insertions, 0 deletions
diff --git a/third_party/libwebrtc/audio/test/OWNERS b/third_party/libwebrtc/audio/test/OWNERS
new file mode 100644
index 0000000000..3754d4823a
--- /dev/null
+++ b/third_party/libwebrtc/audio/test/OWNERS
@@ -0,0 +1,3 @@
+# Script to launch low_bandwidth_audio_test.
+per-file low_bandwidth_audio_test.py=mbonadei@webrtc.org
+per-file low_bandwidth_audio_test.py=jleconte@webrtc.org
diff --git a/third_party/libwebrtc/audio/test/audio_end_to_end_test.cc b/third_party/libwebrtc/audio/test/audio_end_to_end_test.cc
new file mode 100644
index 0000000000..b7dfdb89f6
--- /dev/null
+++ b/third_party/libwebrtc/audio/test/audio_end_to_end_test.cc
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2017 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.
+ */
+
+#include "audio/test/audio_end_to_end_test.h"
+
+#include <algorithm>
+#include <memory>
+
+#include "api/task_queue/task_queue_base.h"
+#include "call/fake_network_pipe.h"
+#include "call/simulated_network.h"
+#include "system_wrappers/include/sleep.h"
+#include "test/gtest.h"
+
+namespace webrtc {
+namespace test {
+namespace {
+// Wait half a second between stopping sending and stopping receiving audio.
+constexpr int kExtraRecordTimeMs = 500;
+
+constexpr int kSampleRate = 48000;
+} // namespace
+
+AudioEndToEndTest::AudioEndToEndTest()
+ : EndToEndTest(CallTest::kDefaultTimeout) {}
+
+size_t AudioEndToEndTest::GetNumVideoStreams() const {
+ return 0;
+}
+
+size_t AudioEndToEndTest::GetNumAudioStreams() const {
+ return 1;
+}
+
+size_t AudioEndToEndTest::GetNumFlexfecStreams() const {
+ return 0;
+}
+
+std::unique_ptr<TestAudioDeviceModule::Capturer>
+AudioEndToEndTest::CreateCapturer() {
+ return TestAudioDeviceModule::CreatePulsedNoiseCapturer(32000, kSampleRate);
+}
+
+std::unique_ptr<TestAudioDeviceModule::Renderer>
+AudioEndToEndTest::CreateRenderer() {
+ return TestAudioDeviceModule::CreateDiscardRenderer(kSampleRate);
+}
+
+void AudioEndToEndTest::OnFakeAudioDevicesCreated(
+ TestAudioDeviceModule* send_audio_device,
+ TestAudioDeviceModule* recv_audio_device) {
+ send_audio_device_ = send_audio_device;
+}
+
+void AudioEndToEndTest::ModifyAudioConfigs(
+ AudioSendStream::Config* send_config,
+ std::vector<AudioReceiveStreamInterface::Config>* receive_configs) {
+ // Large bitrate by default.
+ const webrtc::SdpAudioFormat kDefaultFormat("opus", 48000, 2,
+ {{"stereo", "1"}});
+ send_config->send_codec_spec = AudioSendStream::Config::SendCodecSpec(
+ test::CallTest::kAudioSendPayloadType, kDefaultFormat);
+ send_config->min_bitrate_bps = 32000;
+ send_config->max_bitrate_bps = 32000;
+}
+
+void AudioEndToEndTest::OnAudioStreamsCreated(
+ AudioSendStream* send_stream,
+ const std::vector<AudioReceiveStreamInterface*>& receive_streams) {
+ ASSERT_NE(nullptr, send_stream);
+ ASSERT_EQ(1u, receive_streams.size());
+ ASSERT_NE(nullptr, receive_streams[0]);
+ send_stream_ = send_stream;
+ receive_stream_ = receive_streams[0];
+}
+
+void AudioEndToEndTest::PerformTest() {
+ // Wait until the input audio file is done...
+ send_audio_device_->WaitForRecordingEnd();
+ // and some extra time to account for network delay.
+ SleepMs(GetSendTransportConfig().queue_delay_ms + kExtraRecordTimeMs);
+}
+} // namespace test
+} // namespace webrtc
diff --git a/third_party/libwebrtc/audio/test/audio_end_to_end_test.h b/third_party/libwebrtc/audio/test/audio_end_to_end_test.h
new file mode 100644
index 0000000000..607fe692be
--- /dev/null
+++ b/third_party/libwebrtc/audio/test/audio_end_to_end_test.h
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2017 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.
+ */
+#ifndef AUDIO_TEST_AUDIO_END_TO_END_TEST_H_
+#define AUDIO_TEST_AUDIO_END_TO_END_TEST_H_
+
+#include <memory>
+#include <string>
+#include <vector>
+
+#include "api/task_queue/task_queue_base.h"
+#include "api/test/simulated_network.h"
+#include "test/call_test.h"
+
+namespace webrtc {
+namespace test {
+
+class AudioEndToEndTest : public test::EndToEndTest {
+ public:
+ AudioEndToEndTest();
+
+ protected:
+ TestAudioDeviceModule* send_audio_device() { return send_audio_device_; }
+ const AudioSendStream* send_stream() const { return send_stream_; }
+ const AudioReceiveStreamInterface* receive_stream() const {
+ return receive_stream_;
+ }
+
+ size_t GetNumVideoStreams() const override;
+ size_t GetNumAudioStreams() const override;
+ size_t GetNumFlexfecStreams() const override;
+
+ std::unique_ptr<TestAudioDeviceModule::Capturer> CreateCapturer() override;
+ std::unique_ptr<TestAudioDeviceModule::Renderer> CreateRenderer() override;
+
+ void OnFakeAudioDevicesCreated(
+ TestAudioDeviceModule* send_audio_device,
+ TestAudioDeviceModule* recv_audio_device) override;
+
+ void ModifyAudioConfigs(AudioSendStream::Config* send_config,
+ std::vector<AudioReceiveStreamInterface::Config>*
+ receive_configs) override;
+ void OnAudioStreamsCreated(AudioSendStream* send_stream,
+ const std::vector<AudioReceiveStreamInterface*>&
+ receive_streams) override;
+
+ void PerformTest() override;
+
+ private:
+ TestAudioDeviceModule* send_audio_device_ = nullptr;
+ AudioSendStream* send_stream_ = nullptr;
+ AudioReceiveStreamInterface* receive_stream_ = nullptr;
+};
+
+} // namespace test
+} // namespace webrtc
+
+#endif // AUDIO_TEST_AUDIO_END_TO_END_TEST_H_
diff --git a/third_party/libwebrtc/audio/test/audio_stats_test.cc b/third_party/libwebrtc/audio/test/audio_stats_test.cc
new file mode 100644
index 0000000000..1c81432574
--- /dev/null
+++ b/third_party/libwebrtc/audio/test/audio_stats_test.cc
@@ -0,0 +1,115 @@
+/*
+ * Copyright (c) 2017 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.
+ */
+
+#include "audio/test/audio_end_to_end_test.h"
+#include "rtc_base/numerics/safe_compare.h"
+#include "system_wrappers/include/sleep.h"
+#include "test/gtest.h"
+
+namespace webrtc {
+namespace test {
+namespace {
+
+bool IsNear(int reference, int v) {
+ // Margin is 10%.
+ const int error = reference / 10 + 1;
+ return std::abs(reference - v) <= error;
+}
+
+class NoLossTest : public AudioEndToEndTest {
+ public:
+ const int kTestDurationMs = 8000;
+ const int kBytesSent = 69351;
+ const int32_t kPacketsSent = 400;
+ const int64_t kRttMs = 100;
+
+ NoLossTest() = default;
+
+ BuiltInNetworkBehaviorConfig GetSendTransportConfig() const override {
+ BuiltInNetworkBehaviorConfig pipe_config;
+ pipe_config.queue_delay_ms = kRttMs / 2;
+ return pipe_config;
+ }
+
+ void PerformTest() override {
+ SleepMs(kTestDurationMs);
+ send_audio_device()->StopRecording();
+ AudioEndToEndTest::PerformTest();
+ }
+
+ void OnStreamsStopped() override {
+ AudioSendStream::Stats send_stats = send_stream()->GetStats();
+ EXPECT_PRED2(IsNear, kBytesSent, send_stats.payload_bytes_sent);
+ EXPECT_PRED2(IsNear, kPacketsSent, send_stats.packets_sent);
+ EXPECT_EQ(0, send_stats.packets_lost);
+ EXPECT_EQ(0.0f, send_stats.fraction_lost);
+ EXPECT_EQ("opus", send_stats.codec_name);
+ // send_stats.jitter_ms
+ EXPECT_PRED2(IsNear, kRttMs, send_stats.rtt_ms);
+ // Send level is 0 because it is cleared in TransmitMixer::StopSend().
+ EXPECT_EQ(0, send_stats.audio_level);
+ // send_stats.total_input_energy
+ // send_stats.total_input_duration
+ EXPECT_FALSE(send_stats.apm_statistics.delay_median_ms);
+ EXPECT_FALSE(send_stats.apm_statistics.delay_standard_deviation_ms);
+ EXPECT_FALSE(send_stats.apm_statistics.echo_return_loss);
+ EXPECT_FALSE(send_stats.apm_statistics.echo_return_loss_enhancement);
+ EXPECT_FALSE(send_stats.apm_statistics.residual_echo_likelihood);
+ EXPECT_FALSE(send_stats.apm_statistics.residual_echo_likelihood_recent_max);
+
+ AudioReceiveStreamInterface::Stats recv_stats =
+ receive_stream()->GetStats(/*get_and_clear_legacy_stats=*/true);
+ EXPECT_PRED2(IsNear, kBytesSent, recv_stats.payload_bytes_rcvd);
+ EXPECT_PRED2(IsNear, kPacketsSent, recv_stats.packets_rcvd);
+ EXPECT_EQ(0, recv_stats.packets_lost);
+ EXPECT_EQ("opus", send_stats.codec_name);
+ // recv_stats.jitter_ms
+ // recv_stats.jitter_buffer_ms
+ EXPECT_EQ(20u, recv_stats.jitter_buffer_preferred_ms);
+ // recv_stats.delay_estimate_ms
+ // Receive level is 0 because it is cleared in Channel::StopPlayout().
+ EXPECT_EQ(0, recv_stats.audio_level);
+ // recv_stats.total_output_energy
+ // recv_stats.total_samples_received
+ // recv_stats.total_output_duration
+ // recv_stats.concealed_samples
+ // recv_stats.expand_rate
+ // recv_stats.speech_expand_rate
+ EXPECT_EQ(0.0, recv_stats.secondary_decoded_rate);
+ EXPECT_EQ(0.0, recv_stats.secondary_discarded_rate);
+ EXPECT_EQ(0.0, recv_stats.accelerate_rate);
+ EXPECT_EQ(0.0, recv_stats.preemptive_expand_rate);
+ EXPECT_EQ(0, recv_stats.decoding_calls_to_silence_generator);
+ // recv_stats.decoding_calls_to_neteq
+ // recv_stats.decoding_normal
+ // recv_stats.decoding_plc
+ EXPECT_EQ(0, recv_stats.decoding_cng);
+ // recv_stats.decoding_plc_cng
+ // recv_stats.decoding_muted_output
+ // Capture start time is -1 because we do not have an associated send stream
+ // on the receiver side.
+ EXPECT_EQ(-1, recv_stats.capture_start_ntp_time_ms);
+
+ // Match these stats between caller and receiver.
+ EXPECT_EQ(send_stats.local_ssrc, recv_stats.remote_ssrc);
+ EXPECT_EQ(*send_stats.codec_payload_type, *recv_stats.codec_payload_type);
+ }
+};
+} // namespace
+
+using AudioStatsTest = CallTest;
+
+TEST_F(AudioStatsTest, DISABLED_NoLoss) {
+ NoLossTest test;
+ RunBaseTest(&test);
+}
+
+} // namespace test
+} // namespace webrtc
diff --git a/third_party/libwebrtc/audio/test/low_bandwidth_audio_test.cc b/third_party/libwebrtc/audio/test/low_bandwidth_audio_test.cc
new file mode 100644
index 0000000000..f385eb9dcc
--- /dev/null
+++ b/third_party/libwebrtc/audio/test/low_bandwidth_audio_test.cc
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2017 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.
+ */
+
+#include "absl/flags/declare.h"
+#include "absl/flags/flag.h"
+#include "api/test/simulated_network.h"
+#include "audio/test/audio_end_to_end_test.h"
+#include "system_wrappers/include/sleep.h"
+#include "test/testsupport/file_utils.h"
+
+ABSL_DECLARE_FLAG(int, sample_rate_hz);
+ABSL_DECLARE_FLAG(bool, quick);
+
+namespace webrtc {
+namespace test {
+namespace {
+
+std::string FileSampleRateSuffix() {
+ return std::to_string(absl::GetFlag(FLAGS_sample_rate_hz) / 1000);
+}
+
+class AudioQualityTest : public AudioEndToEndTest {
+ public:
+ AudioQualityTest() = default;
+
+ private:
+ std::string AudioInputFile() const {
+ return test::ResourcePath(
+ "voice_engine/audio_tiny" + FileSampleRateSuffix(), "wav");
+ }
+
+ std::string AudioOutputFile() const {
+ const ::testing::TestInfo* const test_info =
+ ::testing::UnitTest::GetInstance()->current_test_info();
+ return webrtc::test::OutputPath() + "LowBandwidth_" + test_info->name() +
+ "_" + FileSampleRateSuffix() + ".wav";
+ }
+
+ std::unique_ptr<TestAudioDeviceModule::Capturer> CreateCapturer() override {
+ return TestAudioDeviceModule::CreateWavFileReader(AudioInputFile());
+ }
+
+ std::unique_ptr<TestAudioDeviceModule::Renderer> CreateRenderer() override {
+ return TestAudioDeviceModule::CreateBoundedWavFileWriter(
+ AudioOutputFile(), absl::GetFlag(FLAGS_sample_rate_hz));
+ }
+
+ void PerformTest() override {
+ if (absl::GetFlag(FLAGS_quick)) {
+ // Let the recording run for a small amount of time to check if it works.
+ SleepMs(1000);
+ } else {
+ AudioEndToEndTest::PerformTest();
+ }
+ }
+
+ void OnStreamsStopped() override {
+ const ::testing::TestInfo* const test_info =
+ ::testing::UnitTest::GetInstance()->current_test_info();
+
+ // Output information about the input and output audio files so that further
+ // processing can be done by an external process.
+ printf("TEST %s %s %s\n", test_info->name(), AudioInputFile().c_str(),
+ AudioOutputFile().c_str());
+ }
+};
+
+class Mobile2GNetworkTest : public AudioQualityTest {
+ void ModifyAudioConfigs(AudioSendStream::Config* send_config,
+ std::vector<AudioReceiveStreamInterface::Config>*
+ receive_configs) override {
+ send_config->send_codec_spec = AudioSendStream::Config::SendCodecSpec(
+ test::CallTest::kAudioSendPayloadType,
+ {"OPUS",
+ 48000,
+ 2,
+ {{"maxaveragebitrate", "6000"}, {"ptime", "60"}, {"stereo", "1"}}});
+ }
+
+ BuiltInNetworkBehaviorConfig GetSendTransportConfig() const override {
+ BuiltInNetworkBehaviorConfig pipe_config;
+ pipe_config.link_capacity_kbps = 12;
+ pipe_config.queue_length_packets = 1500;
+ pipe_config.queue_delay_ms = 400;
+ return pipe_config;
+ }
+};
+} // namespace
+
+using LowBandwidthAudioTest = CallTest;
+
+TEST_F(LowBandwidthAudioTest, GoodNetworkHighBitrate) {
+ AudioQualityTest test;
+ RunBaseTest(&test);
+}
+
+TEST_F(LowBandwidthAudioTest, Mobile2GNetwork) {
+ Mobile2GNetworkTest test;
+ RunBaseTest(&test);
+}
+} // namespace test
+} // namespace webrtc
diff --git a/third_party/libwebrtc/audio/test/low_bandwidth_audio_test.py b/third_party/libwebrtc/audio/test/low_bandwidth_audio_test.py
new file mode 100755
index 0000000000..07065e2c8d
--- /dev/null
+++ b/third_party/libwebrtc/audio/test/low_bandwidth_audio_test.py
@@ -0,0 +1,365 @@
+#!/usr/bin/env vpython3
+# Copyright (c) 2017 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.
+"""
+This script is the wrapper that runs the low-bandwidth audio test.
+
+After running the test, post-process steps for calculating audio quality of the
+output files will be performed.
+"""
+
+import argparse
+import collections
+import json
+import logging
+import os
+import re
+import shutil
+import subprocess
+import sys
+
+SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
+SRC_DIR = os.path.normpath(os.path.join(SCRIPT_DIR, os.pardir, os.pardir))
+
+NO_TOOLS_ERROR_MESSAGE = (
+ 'Could not find PESQ or POLQA at %s.\n'
+ '\n'
+ 'To fix this run:\n'
+ ' python %s %s\n'
+ '\n'
+ 'Note that these tools are Google-internal due to licensing, so in order '
+ 'to use them you will have to get your own license and manually put them '
+ 'in the right location.\n'
+ 'See https://cs.chromium.org/chromium/src/third_party/webrtc/tools_webrtc/'
+ 'download_tools.py?rcl=bbceb76f540159e2dba0701ac03c514f01624130&l=13')
+
+
+def _LogCommand(command):
+ logging.info('Running %r', command)
+ return command
+
+
+def _ParseArgs():
+ parser = argparse.ArgumentParser(description='Run low-bandwidth audio tests.')
+ parser.add_argument('build_dir',
+ help='Path to the build directory (e.g. out/Release).')
+ parser.add_argument('--remove',
+ action='store_true',
+ help='Remove output audio files after testing.')
+ parser.add_argument(
+ '--android',
+ action='store_true',
+ help='Perform the test on a connected Android device instead.')
+ parser.add_argument('--adb-path', help='Path to adb binary.', default='adb')
+ parser.add_argument('--num-retries',
+ default='0',
+ help='Number of times to retry the test on Android.')
+ parser.add_argument(
+ '--isolated-script-test-perf-output',
+ default=None,
+ help='Path to store perf results in histogram proto format.')
+ parser.add_argument(
+ '--isolated-script-test-output',
+ default=None,
+ help='Path to output an empty JSON file which Chromium infra requires.')
+
+ return parser.parse_known_args()
+
+
+def _GetPlatform():
+ if sys.platform == 'win32':
+ return 'win'
+ if sys.platform == 'darwin':
+ return 'mac'
+ if sys.platform.startswith('linux'):
+ return 'linux'
+ raise AssertionError('Unknown platform %s' % sys.platform)
+
+
+def _GetExtension():
+ return '.exe' if sys.platform == 'win32' else ''
+
+
+def _GetPathToTools():
+ tools_dir = os.path.join(SRC_DIR, 'tools_webrtc')
+ toolchain_dir = os.path.join(tools_dir, 'audio_quality')
+
+ platform = _GetPlatform()
+ ext = _GetExtension()
+
+ pesq_path = os.path.join(toolchain_dir, platform, 'pesq' + ext)
+ if not os.path.isfile(pesq_path):
+ pesq_path = None
+
+ polqa_path = os.path.join(toolchain_dir, platform, 'PolqaOem64' + ext)
+ if not os.path.isfile(polqa_path):
+ polqa_path = None
+
+ if (platform != 'mac' and not polqa_path) or not pesq_path:
+ logging.error(NO_TOOLS_ERROR_MESSAGE, toolchain_dir,
+ os.path.join(tools_dir, 'download_tools.py'), toolchain_dir)
+
+ return pesq_path, polqa_path
+
+
+def ExtractTestRuns(lines, echo=False):
+ """Extracts information about tests from the output of a test runner.
+
+ Produces tuples
+ (android_device, test_name, reference_file, degraded_file, cur_perf_results).
+ """
+ for line in lines:
+ if echo:
+ sys.stdout.write(line)
+
+ # Output from Android has a prefix with the device name.
+ android_prefix_re = r'(?:I\b.+\brun_tests_on_device\((.+?)\)\s*)?'
+ test_re = r'^' + android_prefix_re + (r'TEST (\w+) ([^ ]+?) ([^\s]+)'
+ r' ?([^\s]+)?\s*$')
+
+ match = re.search(test_re, line)
+ if match:
+ yield match.groups()
+
+
+def _GetFile(file_path,
+ out_dir,
+ move=False,
+ android=False,
+ adb_prefix=('adb', )):
+ out_file_name = os.path.basename(file_path)
+ out_file_path = os.path.join(out_dir, out_file_name)
+
+ if android:
+ # Pull the file from the connected Android device.
+ adb_command = adb_prefix + ('pull', file_path, out_dir)
+ subprocess.check_call(_LogCommand(adb_command))
+ if move:
+ # Remove that file.
+ adb_command = adb_prefix + ('shell', 'rm', file_path)
+ subprocess.check_call(_LogCommand(adb_command))
+ elif os.path.abspath(file_path) != os.path.abspath(out_file_path):
+ if move:
+ shutil.move(file_path, out_file_path)
+ else:
+ shutil.copy(file_path, out_file_path)
+
+ return out_file_path
+
+
+def _RunPesq(executable_path,
+ reference_file,
+ degraded_file,
+ sample_rate_hz=16000):
+ directory = os.path.dirname(reference_file)
+ assert os.path.dirname(degraded_file) == directory
+
+ # Analyze audio.
+ command = [
+ executable_path,
+ '+%d' % sample_rate_hz,
+ os.path.basename(reference_file),
+ os.path.basename(degraded_file)
+ ]
+ # Need to provide paths in the current directory due to a bug in PESQ:
+ # On Mac, for some 'path/to/file.wav', if 'file.wav' is longer than
+ # 'path/to', PESQ crashes.
+ out = subprocess.check_output(_LogCommand(command),
+ cwd=directory,
+ universal_newlines=True,
+ stderr=subprocess.STDOUT)
+
+ # Find the scores in stdout of PESQ.
+ match = re.search(
+ r'Prediction \(Raw MOS, MOS-LQO\):\s+=\s+([\d.]+)\s+([\d.]+)', out)
+ if match:
+ raw_mos, _ = match.groups()
+ return {'pesq_mos': (raw_mos, 'unitless')}
+ logging.error('PESQ: %s', out.splitlines()[-1])
+ return {}
+
+
+def _RunPolqa(executable_path, reference_file, degraded_file):
+ # Analyze audio.
+ command = [
+ executable_path, '-q', '-LC', 'NB', '-Ref', reference_file, '-Test',
+ degraded_file
+ ]
+ process = subprocess.Popen(_LogCommand(command),
+ universal_newlines=True,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE)
+ out, err = process.communicate()
+
+ # Find the scores in stdout of POLQA.
+ match = re.search(r'\bMOS-LQO:\s+([\d.]+)', out)
+
+ if process.returncode != 0 or not match:
+ if process.returncode == 2:
+ logging.warning('%s (2)', err.strip())
+ logging.warning('POLQA license error, skipping test.')
+ else:
+ logging.error('%s (%d)', err.strip(), process.returncode)
+ return {}
+
+ mos_lqo, = match.groups()
+ return {'polqa_mos_lqo': (mos_lqo, 'unitless')}
+
+
+def _MergeInPerfResultsFromCcTests(histograms, run_perf_results_file):
+ from tracing.value import histogram_set
+
+ cc_histograms = histogram_set.HistogramSet()
+ with open(run_perf_results_file, 'rb') as f:
+ contents = f.read()
+ if not contents:
+ return
+
+ cc_histograms.ImportProto(contents)
+
+ histograms.Merge(cc_histograms)
+
+
+Analyzer = collections.namedtuple(
+ 'Analyzer', ['name', 'func', 'executable', 'sample_rate_hz'])
+
+
+def _ConfigurePythonPath(args):
+ script_dir = os.path.dirname(os.path.realpath(__file__))
+ checkout_root = os.path.abspath(os.path.join(script_dir, os.pardir,
+ os.pardir))
+
+ # TODO(https://crbug.com/1029452): Use a copy rule and add these from the
+ # out dir like for the third_party/protobuf code.
+ sys.path.insert(
+ 0, os.path.join(checkout_root, 'third_party', 'catapult', 'tracing'))
+
+ # The low_bandwidth_audio_perf_test gn rule will build the protobuf stub
+ # for python, so put it in the path for this script before we attempt to
+ # import it.
+ histogram_proto_path = os.path.join(os.path.abspath(args.build_dir),
+ 'pyproto', 'tracing', 'tracing', 'proto')
+ sys.path.insert(0, histogram_proto_path)
+ proto_stub_path = os.path.join(os.path.abspath(args.build_dir), 'pyproto')
+ sys.path.insert(0, proto_stub_path)
+
+ # Fail early in case the proto hasn't been built.
+ try:
+ #pylint: disable=unused-import
+ import histogram_pb2
+ except ImportError as e:
+ raise ImportError('Could not import histogram_pb2. You need to build the '
+ 'low_bandwidth_audio_perf_test target before invoking '
+ 'this script. Expected to find '
+ 'histogram_pb2.py in %s.' % histogram_proto_path) from e
+
+
+def main():
+ logging.basicConfig(format='%(asctime)s %(levelname)-8s %(message)s',
+ level=logging.INFO,
+ datefmt='%Y-%m-%d %H:%M:%S')
+ logging.info('Invoked with %s', str(sys.argv))
+
+ args, extra_test_args = _ParseArgs()
+
+ _ConfigurePythonPath(args)
+
+ # Import catapult modules here after configuring the pythonpath.
+ from tracing.value import histogram_set
+ from tracing.value.diagnostics import reserved_infos
+ from tracing.value.diagnostics import generic_set
+
+ pesq_path, polqa_path = _GetPathToTools()
+ if pesq_path is None:
+ return 1
+
+ out_dir = os.path.join(args.build_dir, '..')
+ if args.android:
+ test_command = [
+ os.path.join(args.build_dir, 'bin', 'run_low_bandwidth_audio_test'),
+ '-v', '--num-retries', args.num_retries
+ ]
+ else:
+ test_command = [os.path.join(args.build_dir, 'low_bandwidth_audio_test')]
+
+ analyzers = [Analyzer('pesq', _RunPesq, pesq_path, 16000)]
+ # Check if POLQA can run at all, or skip the 48 kHz tests entirely.
+ example_path = os.path.join(SRC_DIR, 'resources', 'voice_engine',
+ 'audio_tiny48.wav')
+ if polqa_path and _RunPolqa(polqa_path, example_path, example_path):
+ analyzers.append(Analyzer('polqa', _RunPolqa, polqa_path, 48000))
+
+ histograms = histogram_set.HistogramSet()
+ for analyzer in analyzers:
+ # Start the test executable that produces audio files.
+ test_process = subprocess.Popen(_LogCommand(test_command + [
+ '--sample_rate_hz=%d' % analyzer.sample_rate_hz,
+ '--test_case_prefix=%s' % analyzer.name,
+ ] + extra_test_args),
+ universal_newlines=True,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.STDOUT)
+ perf_results_file = None
+ try:
+ lines = iter(test_process.stdout.readline, '')
+ for result in ExtractTestRuns(lines, echo=True):
+ (android_device, test_name, reference_file, degraded_file,
+ perf_results_file) = result
+
+ adb_prefix = (args.adb_path, )
+ if android_device:
+ adb_prefix += ('-s', android_device)
+
+ reference_file = _GetFile(reference_file,
+ out_dir,
+ android=args.android,
+ adb_prefix=adb_prefix)
+ degraded_file = _GetFile(degraded_file,
+ out_dir,
+ move=True,
+ android=args.android,
+ adb_prefix=adb_prefix)
+
+ analyzer_results = analyzer.func(analyzer.executable, reference_file,
+ degraded_file)
+ for metric, (value, units) in list(analyzer_results.items()):
+ hist = histograms.CreateHistogram(metric, units, [value])
+ user_story = generic_set.GenericSet([test_name])
+ hist.diagnostics[reserved_infos.STORIES.name] = user_story
+
+ # Output human readable results.
+ print('RESULT %s: %s= %s %s' % (metric, test_name, value, units))
+
+ if args.remove:
+ os.remove(reference_file)
+ os.remove(degraded_file)
+ finally:
+ test_process.terminate()
+ if perf_results_file:
+ perf_results_file = _GetFile(perf_results_file,
+ out_dir,
+ move=True,
+ android=args.android,
+ adb_prefix=adb_prefix)
+ _MergeInPerfResultsFromCcTests(histograms, perf_results_file)
+ if args.remove:
+ os.remove(perf_results_file)
+
+ if args.isolated_script_test_perf_output:
+ with open(args.isolated_script_test_perf_output, 'wb') as f:
+ f.write(histograms.AsProto().SerializeToString())
+
+ if args.isolated_script_test_output:
+ with open(args.isolated_script_test_output, 'w') as f:
+ json.dump({"version": 3}, f)
+
+ return test_process.wait()
+
+
+if __name__ == '__main__':
+ sys.exit(main())
diff --git a/third_party/libwebrtc/audio/test/low_bandwidth_audio_test_flags.cc b/third_party/libwebrtc/audio/test/low_bandwidth_audio_test_flags.cc
new file mode 100644
index 0000000000..9d93790d3d
--- /dev/null
+++ b/third_party/libwebrtc/audio/test/low_bandwidth_audio_test_flags.cc
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2019 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.
+ */
+// #ifndef AUDIO_TEST_LOW_BANDWIDTH_AUDIO_TEST_FLAGS_H_
+// #define AUDIO_TEST_LOW_BANDWIDTH_AUDIO_TEST_FLAGS_H_
+
+#include "absl/flags/flag.h"
+
+ABSL_FLAG(int,
+ sample_rate_hz,
+ 16000,
+ "Sample rate (Hz) of the produced audio files.");
+
+ABSL_FLAG(bool,
+ quick,
+ false,
+ "Don't do the full audio recording. "
+ "Used to quickly check that the test runs without crashing.");
+
+ABSL_FLAG(std::string, test_case_prefix, "", "Test case prefix.");
+
+// #endif // AUDIO_TEST_LOW_BANDWIDTH_AUDIO_TEST_FLAGS_H_
diff --git a/third_party/libwebrtc/audio/test/nack_test.cc b/third_party/libwebrtc/audio/test/nack_test.cc
new file mode 100644
index 0000000000..c4bfe8306f
--- /dev/null
+++ b/third_party/libwebrtc/audio/test/nack_test.cc
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2021 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.
+ */
+
+#include "audio/test/audio_end_to_end_test.h"
+#include "system_wrappers/include/sleep.h"
+#include "test/gtest.h"
+
+namespace webrtc {
+namespace test {
+
+using NackTest = CallTest;
+
+TEST_F(NackTest, ShouldNackInLossyNetwork) {
+ class NackTest : public AudioEndToEndTest {
+ public:
+ const int kTestDurationMs = 2000;
+ const int64_t kRttMs = 30;
+ const int64_t kLossPercent = 30;
+ const int kNackHistoryMs = 1000;
+
+ BuiltInNetworkBehaviorConfig GetSendTransportConfig() const override {
+ BuiltInNetworkBehaviorConfig pipe_config;
+ pipe_config.queue_delay_ms = kRttMs / 2;
+ pipe_config.loss_percent = kLossPercent;
+ return pipe_config;
+ }
+
+ void ModifyAudioConfigs(AudioSendStream::Config* send_config,
+ std::vector<AudioReceiveStreamInterface::Config>*
+ receive_configs) override {
+ ASSERT_EQ(receive_configs->size(), 1U);
+ (*receive_configs)[0].rtp.nack.rtp_history_ms = kNackHistoryMs;
+ AudioEndToEndTest::ModifyAudioConfigs(send_config, receive_configs);
+ }
+
+ void PerformTest() override { SleepMs(kTestDurationMs); }
+
+ void OnStreamsStopped() override {
+ AudioReceiveStreamInterface::Stats recv_stats =
+ receive_stream()->GetStats(/*get_and_clear_legacy_stats=*/true);
+ EXPECT_GT(recv_stats.nacks_sent, 0U);
+ AudioSendStream::Stats send_stats = send_stream()->GetStats();
+ EXPECT_GT(send_stats.retransmitted_packets_sent, 0U);
+ EXPECT_GT(send_stats.nacks_rcvd, 0U);
+ }
+ } test;
+
+ RunBaseTest(&test);
+}
+
+} // namespace test
+} // namespace webrtc
diff --git a/third_party/libwebrtc/audio/test/non_sender_rtt_test.cc b/third_party/libwebrtc/audio/test/non_sender_rtt_test.cc
new file mode 100644
index 0000000000..0c7dc6cbee
--- /dev/null
+++ b/third_party/libwebrtc/audio/test/non_sender_rtt_test.cc
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2021 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.
+ */
+
+#include "audio/test/audio_end_to_end_test.h"
+#include "system_wrappers/include/sleep.h"
+#include "test/gtest.h"
+
+namespace webrtc {
+namespace test {
+
+using NonSenderRttTest = CallTest;
+
+TEST_F(NonSenderRttTest, NonSenderRttStats) {
+ class NonSenderRttTest : public AudioEndToEndTest {
+ public:
+ const int kTestDurationMs = 10000;
+ const int64_t kRttMs = 30;
+
+ BuiltInNetworkBehaviorConfig GetSendTransportConfig() const override {
+ BuiltInNetworkBehaviorConfig pipe_config;
+ pipe_config.queue_delay_ms = kRttMs / 2;
+ return pipe_config;
+ }
+
+ void ModifyAudioConfigs(AudioSendStream::Config* send_config,
+ std::vector<AudioReceiveStreamInterface::Config>*
+ receive_configs) override {
+ ASSERT_EQ(receive_configs->size(), 1U);
+ (*receive_configs)[0].enable_non_sender_rtt = true;
+ AudioEndToEndTest::ModifyAudioConfigs(send_config, receive_configs);
+ send_config->send_codec_spec->enable_non_sender_rtt = true;
+ }
+
+ void PerformTest() override { SleepMs(kTestDurationMs); }
+
+ void OnStreamsStopped() override {
+ AudioReceiveStreamInterface::Stats recv_stats =
+ receive_stream()->GetStats(/*get_and_clear_legacy_stats=*/true);
+ EXPECT_GT(recv_stats.round_trip_time_measurements, 0);
+ ASSERT_TRUE(recv_stats.round_trip_time.has_value());
+ EXPECT_GT(recv_stats.round_trip_time->ms(), 0);
+ EXPECT_GE(recv_stats.total_round_trip_time.ms(),
+ recv_stats.round_trip_time->ms());
+ }
+ } test;
+
+ RunBaseTest(&test);
+}
+
+} // namespace test
+} // namespace webrtc
diff --git a/third_party/libwebrtc/audio/test/pc_low_bandwidth_audio_test.cc b/third_party/libwebrtc/audio/test/pc_low_bandwidth_audio_test.cc
new file mode 100644
index 0000000000..8b733d578d
--- /dev/null
+++ b/third_party/libwebrtc/audio/test/pc_low_bandwidth_audio_test.cc
@@ -0,0 +1,176 @@
+/*
+ * Copyright (c) 2019 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.
+ */
+
+#include <memory>
+
+#include "absl/flags/declare.h"
+#include "absl/flags/flag.h"
+#include "absl/strings/string_view.h"
+#include "api/test/create_network_emulation_manager.h"
+#include "api/test/create_peerconnection_quality_test_fixture.h"
+#include "api/test/metrics/chrome_perf_dashboard_metrics_exporter.h"
+#include "api/test/metrics/global_metrics_logger_and_exporter.h"
+#include "api/test/metrics/metrics_exporter.h"
+#include "api/test/metrics/stdout_metrics_exporter.h"
+#include "api/test/network_emulation_manager.h"
+#include "api/test/pclf/media_configuration.h"
+#include "api/test/pclf/media_quality_test_params.h"
+#include "api/test/pclf/peer_configurer.h"
+#include "api/test/peerconnection_quality_test_fixture.h"
+#include "api/test/simulated_network.h"
+#include "api/test/time_controller.h"
+#include "call/simulated_network.h"
+#include "test/gtest.h"
+#include "test/pc/e2e/network_quality_metrics_reporter.h"
+#include "test/testsupport/file_utils.h"
+
+ABSL_DECLARE_FLAG(std::string, test_case_prefix);
+ABSL_DECLARE_FLAG(int, sample_rate_hz);
+ABSL_DECLARE_FLAG(bool, quick);
+
+namespace webrtc {
+namespace test {
+
+using ::webrtc::webrtc_pc_e2e::AudioConfig;
+using ::webrtc::webrtc_pc_e2e::PeerConfigurer;
+using ::webrtc::webrtc_pc_e2e::RunParams;
+
+namespace {
+
+constexpr int kTestDurationMs = 5400;
+constexpr int kQuickTestDurationMs = 100;
+
+std::string GetMetricTestCaseName() {
+ const ::testing::TestInfo* const test_info =
+ ::testing::UnitTest::GetInstance()->current_test_info();
+ std::string test_case_prefix(absl::GetFlag(FLAGS_test_case_prefix));
+ if (test_case_prefix.empty()) {
+ return test_info->name();
+ }
+ return test_case_prefix + "_" + test_info->name();
+}
+
+std::unique_ptr<webrtc_pc_e2e::PeerConnectionE2EQualityTestFixture>
+CreateTestFixture(absl::string_view test_case_name,
+ TimeController& time_controller,
+ std::pair<EmulatedNetworkManagerInterface*,
+ EmulatedNetworkManagerInterface*> network_links,
+ rtc::FunctionView<void(PeerConfigurer*)> alice_configurer,
+ rtc::FunctionView<void(PeerConfigurer*)> bob_configurer) {
+ auto fixture = webrtc_pc_e2e::CreatePeerConnectionE2EQualityTestFixture(
+ std::string(test_case_name), time_controller,
+ /*audio_quality_analyzer=*/nullptr,
+ /*video_quality_analyzer=*/nullptr);
+ auto alice = std::make_unique<PeerConfigurer>(
+ network_links.first->network_dependencies());
+ auto bob = std::make_unique<PeerConfigurer>(
+ network_links.second->network_dependencies());
+ alice_configurer(alice.get());
+ bob_configurer(bob.get());
+ fixture->AddPeer(std::move(alice));
+ fixture->AddPeer(std::move(bob));
+ fixture->AddQualityMetricsReporter(
+ std::make_unique<webrtc_pc_e2e::NetworkQualityMetricsReporter>(
+ network_links.first, network_links.second,
+ test::GetGlobalMetricsLogger()));
+ return fixture;
+}
+
+std::string FileSampleRateSuffix() {
+ return std::to_string(absl::GetFlag(FLAGS_sample_rate_hz) / 1000);
+}
+
+std::string AudioInputFile() {
+ return test::ResourcePath("voice_engine/audio_tiny" + FileSampleRateSuffix(),
+ "wav");
+}
+
+std::string AudioOutputFile() {
+ const ::testing::TestInfo* const test_info =
+ ::testing::UnitTest::GetInstance()->current_test_info();
+ return webrtc::test::OutputPath() + "PCLowBandwidth_" + test_info->name() +
+ "_" + FileSampleRateSuffix() + ".wav";
+}
+
+std::string PerfResultsOutputFile() {
+ return webrtc::test::OutputPath() + "PCLowBandwidth_perf_" +
+ FileSampleRateSuffix() + ".pb";
+}
+
+void LogTestResults() {
+ std::string perf_results_output_file = PerfResultsOutputFile();
+ std::vector<std::unique_ptr<MetricsExporter>> exporters;
+ exporters.push_back(std::make_unique<StdoutMetricsExporter>());
+ exporters.push_back(std::make_unique<ChromePerfDashboardMetricsExporter>(
+ perf_results_output_file));
+ EXPECT_TRUE(
+ ExportPerfMetric(*GetGlobalMetricsLogger(), std::move(exporters)));
+
+ const ::testing::TestInfo* const test_info =
+ ::testing::UnitTest::GetInstance()->current_test_info();
+
+ // Output information about the input and output audio files so that further
+ // processing can be done by an external process.
+ printf("TEST %s %s %s %s\n", test_info->name(), AudioInputFile().c_str(),
+ AudioOutputFile().c_str(), perf_results_output_file.c_str());
+}
+
+} // namespace
+
+TEST(PCLowBandwidthAudioTest, PCGoodNetworkHighBitrate) {
+ std::unique_ptr<NetworkEmulationManager> network_emulation_manager =
+ CreateNetworkEmulationManager();
+ auto fixture = CreateTestFixture(
+ GetMetricTestCaseName(), *network_emulation_manager->time_controller(),
+ network_emulation_manager->CreateEndpointPairWithTwoWayRoutes(
+ BuiltInNetworkBehaviorConfig()),
+ [](PeerConfigurer* alice) {
+ AudioConfig audio;
+ audio.stream_label = "alice-audio";
+ audio.mode = AudioConfig::Mode::kFile;
+ audio.input_file_name = AudioInputFile();
+ audio.output_dump_file_name = AudioOutputFile();
+ audio.sampling_frequency_in_hz = absl::GetFlag(FLAGS_sample_rate_hz);
+ alice->SetAudioConfig(std::move(audio));
+ },
+ [](PeerConfigurer* bob) {});
+ fixture->Run(RunParams(TimeDelta::Millis(
+ absl::GetFlag(FLAGS_quick) ? kQuickTestDurationMs : kTestDurationMs)));
+ LogTestResults();
+}
+
+TEST(PCLowBandwidthAudioTest, PC40kbpsNetwork) {
+ std::unique_ptr<NetworkEmulationManager> network_emulation_manager =
+ CreateNetworkEmulationManager();
+ BuiltInNetworkBehaviorConfig config;
+ config.link_capacity_kbps = 40;
+ config.queue_length_packets = 1500;
+ config.queue_delay_ms = 400;
+ config.loss_percent = 1;
+ auto fixture = CreateTestFixture(
+ GetMetricTestCaseName(), *network_emulation_manager->time_controller(),
+ network_emulation_manager->CreateEndpointPairWithTwoWayRoutes(config),
+ [](PeerConfigurer* alice) {
+ AudioConfig audio;
+ audio.stream_label = "alice-audio";
+ audio.mode = AudioConfig::Mode::kFile;
+ audio.input_file_name = AudioInputFile();
+ audio.output_dump_file_name = AudioOutputFile();
+ audio.sampling_frequency_in_hz = absl::GetFlag(FLAGS_sample_rate_hz);
+ alice->SetAudioConfig(std::move(audio));
+ },
+ [](PeerConfigurer* bob) {});
+ fixture->Run(RunParams(TimeDelta::Millis(
+ absl::GetFlag(FLAGS_quick) ? kQuickTestDurationMs : kTestDurationMs)));
+ LogTestResults();
+}
+
+} // namespace test
+} // namespace webrtc
diff --git a/third_party/libwebrtc/audio/test/unittests/low_bandwidth_audio_test_test.py b/third_party/libwebrtc/audio/test/unittests/low_bandwidth_audio_test_test.py
new file mode 100755
index 0000000000..be72fcbfdd
--- /dev/null
+++ b/third_party/libwebrtc/audio/test/unittests/low_bandwidth_audio_test_test.py
@@ -0,0 +1,239 @@
+#!/usr/bin/env python3
+# Copyright (c) 2017 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.
+
+from __future__ import absolute_import
+import os
+import unittest
+import sys
+
+SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
+PARENT_DIR = os.path.join(SCRIPT_DIR, os.pardir)
+sys.path.append(PARENT_DIR)
+import low_bandwidth_audio_test
+
+
+class TestExtractTestRuns(unittest.TestCase):
+ def _TestLog(self, log, *expected):
+ self.assertEqual(
+ tuple(low_bandwidth_audio_test.ExtractTestRuns(log.splitlines(True))),
+ expected)
+
+ def testLinux(self):
+ self._TestLog(
+ LINUX_LOG,
+ (None, 'GoodNetworkHighBitrate',
+ '/webrtc/src/resources/voice_engine/audio_tiny16.wav',
+ '/webrtc/src/out/LowBandwidth_GoodNetworkHighBitrate.wav', None),
+ (None, 'Mobile2GNetwork',
+ '/webrtc/src/resources/voice_engine/audio_tiny16.wav',
+ '/webrtc/src/out/LowBandwidth_Mobile2GNetwork.wav', None),
+ (None, 'PCGoodNetworkHighBitrate',
+ '/webrtc/src/resources/voice_engine/audio_tiny16.wav',
+ '/webrtc/src/out/PCLowBandwidth_PCGoodNetworkHighBitrate.wav',
+ '/webrtc/src/out/PCLowBandwidth_perf_48.json'),
+ (None, 'PCMobile2GNetwork',
+ '/webrtc/src/resources/voice_engine/audio_tiny16.wav',
+ '/webrtc/src/out/PCLowBandwidth_PCMobile2GNetwork.wav',
+ '/webrtc/src/out/PCLowBandwidth_perf_48.json'))
+
+ def testAndroid(self):
+ self._TestLog(
+ ANDROID_LOG,
+ ('ddfa6149', 'Mobile2GNetwork',
+ '/sdcard/chromium_tests_root/resources/voice_engine/audio_tiny16.wav',
+ '/sdcard/chromium_tests_root/LowBandwidth_Mobile2GNetwork.wav', None),
+ ('TA99205CNO', 'GoodNetworkHighBitrate',
+ '/sdcard/chromium_tests_root/resources/voice_engine/audio_tiny16.wav',
+ '/sdcard/chromium_tests_root/LowBandwidth_GoodNetworkHighBitrate.wav',
+ None),
+ ('ddfa6149', 'PCMobile2GNetwork',
+ '/sdcard/chromium_tests_root/resources/voice_engine/audio_tiny16.wav',
+ '/sdcard/chromium_tests_root/PCLowBandwidth_PCMobile2GNetwork.wav',
+ '/sdcard/chromium_tests_root/PCLowBandwidth_perf_48.json'),
+ ('TA99205CNO', 'PCGoodNetworkHighBitrate',
+ '/sdcard/chromium_tests_root/resources/voice_engine/audio_tiny16.wav',
+ ('/sdcard/chromium_tests_root/'
+ 'PCLowBandwidth_PCGoodNetworkHighBitrate.wav'),
+ '/sdcard/chromium_tests_root/PCLowBandwidth_perf_48.json'))
+
+
+LINUX_LOG = r'''\
+[==========] Running 2 tests from 1 test case.
+[----------] Global test environment set-up.
+[----------] 2 tests from LowBandwidthAudioTest
+[ RUN ] LowBandwidthAudioTest.GoodNetworkHighBitrate
+TEST GoodNetworkHighBitrate /webrtc/src/resources/voice_engine/audio_tiny16.wav /webrtc/src/out/LowBandwidth_GoodNetworkHighBitrate.wav
+[ OK ] LowBandwidthAudioTest.GoodNetworkHighBitrate (5932 ms)
+[ RUN ] LowBandwidthAudioTest.Mobile2GNetwork
+TEST Mobile2GNetwork /webrtc/src/resources/voice_engine/audio_tiny16.wav /webrtc/src/out/LowBandwidth_Mobile2GNetwork.wav
+[ OK ] LowBandwidthAudioTest.Mobile2GNetwork (6333 ms)
+[----------] 2 tests from LowBandwidthAudioTest (12265 ms total)
+[----------] 2 tests from PCLowBandwidthAudioTest
+[ RUN ] PCLowBandwidthAudioTest.PCGoodNetworkHighBitrate
+TEST PCGoodNetworkHighBitrate /webrtc/src/resources/voice_engine/audio_tiny16.wav /webrtc/src/out/PCLowBandwidth_PCGoodNetworkHighBitrate.wav /webrtc/src/out/PCLowBandwidth_perf_48.json
+[ OK ] PCLowBandwidthAudioTest.PCGoodNetworkHighBitrate (5932 ms)
+[ RUN ] PCLowBandwidthAudioTest.PCMobile2GNetwork
+TEST PCMobile2GNetwork /webrtc/src/resources/voice_engine/audio_tiny16.wav /webrtc/src/out/PCLowBandwidth_PCMobile2GNetwork.wav /webrtc/src/out/PCLowBandwidth_perf_48.json
+[ OK ] PCLowBandwidthAudioTest.PCMobile2GNetwork (6333 ms)
+[----------] 2 tests from PCLowBandwidthAudioTest (12265 ms total)
+
+[----------] Global test environment tear-down
+[==========] 2 tests from 1 test case ran. (12266 ms total)
+[ PASSED ] 2 tests.
+'''
+
+ANDROID_LOG = r'''\
+I 0.000s Main command: /webrtc/src/build/android/test_runner.py gtest --suite low_bandwidth_audio_test --output-directory /webrtc/src/out/debug-android --runtime-deps-path /webrtc/src/out/debug-android/gen.runtime/webrtc/audio/low_bandwidth_audio_test__test_runner_script.runtime_deps -v
+I 0.007s Main [host]> /webrtc/src/third_party/android_sdk/public/build-tools/24.0.2/aapt dump xmltree /webrtc/src/out/debug-android/low_bandwidth_audio_test_apk/low_bandwidth_audio_test-debug.apk AndroidManifest.xml
+I 0.028s TimeoutThread-1-for-MainThread [host]> /webrtc/src/third_party/android_sdk/public/platform-tools/adb devices
+I 0.062s TimeoutThread-1-for-prepare_device(TA99205CNO) [host]> /webrtc/src/third_party/android_sdk/public/platform-tools/adb -s TA99205CNO wait-for-device
+I 0.063s TimeoutThread-1-for-prepare_device(ddfa6149) [host]> /webrtc/src/third_party/android_sdk/public/platform-tools/adb -s ddfa6149 wait-for-device
+I 0.102s TimeoutThread-1-for-prepare_device(TA99205CNO) [host]> /webrtc/src/third_party/android_sdk/public/platform-tools/adb -s TA99205CNO shell '( ( c=/data/local/tmp/cache_token;echo $EXTERNAL_STORAGE;cat $c 2>/dev/null||echo;echo "77611072-160c-11d7-9362-705b0f464195">$c &&getprop )>/data/local/tmp/temp_file-5ea34389e3f92 );echo %$?'
+I 0.105s TimeoutThread-1-for-prepare_device(ddfa6149) [host]> /webrtc/src/third_party/android_sdk/public/platform-tools/adb -s ddfa6149 shell '( ( c=/data/local/tmp/cache_token;echo $EXTERNAL_STORAGE;cat $c 2>/dev/null||echo;echo "77618afc-160c-11d7-bda4-705b0f464195">$c &&getprop )>/data/local/tmp/temp_file-b995cef6e0e3d );echo %$?'
+I 0.204s TimeoutThread-1-for-prepare_device(ddfa6149) [host]> /webrtc/src/third_party/android_sdk/public/platform-tools/adb -s ddfa6149 pull /data/local/tmp/temp_file-b995cef6e0e3d /tmp/tmpieAgDj/tmp_ReadFileWithPull
+I 0.285s TimeoutThread-1-for-prepare_device(ddfa6149) [host]> /webrtc/src/third_party/android_sdk/public/platform-tools/adb -s ddfa6149 shell '( test -d /storage/emulated/legacy );echo %$?'
+I 0.285s TimeoutThread-1-for-delete_temporary_file(ddfa6149) [host]> /webrtc/src/third_party/android_sdk/public/platform-tools/adb -s ddfa6149 shell 'rm -f /data/local/tmp/temp_file-b995cef6e0e3d'
+I 0.302s TimeoutThread-1-for-prepare_device(TA99205CNO) [host]> /webrtc/src/third_party/android_sdk/public/platform-tools/adb -s TA99205CNO pull /data/local/tmp/temp_file-5ea34389e3f92 /tmp/tmpvlyG3I/tmp_ReadFileWithPull
+I 0.352s TimeoutThread-1-for-prepare_device(ddfa6149) condition 'sd_card_ready' met (0.3s)
+I 0.353s TimeoutThread-1-for-prepare_device(ddfa6149) [host]> /webrtc/src/third_party/android_sdk/public/platform-tools/adb -s ddfa6149 shell '( pm path android );echo %$?'
+I 0.369s TimeoutThread-1-for-prepare_device(TA99205CNO) [host]> /webrtc/src/third_party/android_sdk/public/platform-tools/adb -s TA99205CNO shell '( test -d /sdcard );echo %$?'
+I 0.370s TimeoutThread-1-for-delete_temporary_file(TA99205CNO) [host]> /webrtc/src/third_party/android_sdk/public/platform-tools/adb -s TA99205CNO shell 'rm -f /data/local/tmp/temp_file-5ea34389e3f92'
+I 0.434s TimeoutThread-1-for-prepare_device(TA99205CNO) condition 'sd_card_ready' met (0.4s)
+I 0.434s TimeoutThread-1-for-prepare_device(TA99205CNO) [host]> /webrtc/src/third_party/android_sdk/public/platform-tools/adb -s TA99205CNO shell '( pm path android );echo %$?'
+I 1.067s TimeoutThread-1-for-prepare_device(ddfa6149) condition 'pm_ready' met (1.0s)
+I 1.067s TimeoutThread-1-for-prepare_device(ddfa6149) [host]> /webrtc/src/third_party/android_sdk/public/platform-tools/adb -s ddfa6149 shell '( getprop sys.boot_completed );echo %$?'
+I 1.115s TimeoutThread-1-for-prepare_device(ddfa6149) condition 'boot_completed' met (1.1s)
+I 1.181s TimeoutThread-1-for-prepare_device(TA99205CNO) condition 'pm_ready' met (1.1s)
+I 1.181s TimeoutThread-1-for-prepare_device(TA99205CNO) [host]> /webrtc/src/third_party/android_sdk/public/platform-tools/adb -s TA99205CNO shell '( getprop sys.boot_completed );echo %$?'
+I 1.242s TimeoutThread-1-for-prepare_device(TA99205CNO) condition 'boot_completed' met (1.2s)
+I 1.268s TimeoutThread-1-for-individual_device_set_up(TA99205CNO) [host]> /webrtc/src/third_party/android_sdk/public/platform-tools/adb -s TA99205CNO shell '( pm path org.chromium.native_test );echo %$?'
+I 1.269s TimeoutThread-1-for-individual_device_set_up(ddfa6149) [host]> /webrtc/src/third_party/android_sdk/public/platform-tools/adb -s ddfa6149 shell '( pm path org.chromium.native_test );echo %$?'
+I 2.008s calculate_device_checksums [host]> /webrtc/src/third_party/android_sdk/public/platform-tools/adb -s ddfa6149 shell '( a=/data/local/tmp/md5sum/md5sum_bin;! [[ $(ls -l $a) = *1225256* ]]&&exit 2;export LD_LIBRARY_PATH=/data/local/tmp/md5sum;$a /data/app/org.chromium.native_test-2/base.apk;: );echo %$?'
+I 2.008s calculate_host_checksums [host]> /webrtc/src/out/debug-android/md5sum_bin_host /webrtc/src/out/debug-android/low_bandwidth_audio_test_apk/low_bandwidth_audio_test-debug.apk
+I 2.019s calculate_device_checksums [host]> /webrtc/src/third_party/android_sdk/public/platform-tools/adb -s TA99205CNO shell '( a=/data/local/tmp/md5sum/md5sum_bin;! [[ $(ls -l $a) = *1225256* ]]&&exit 2;export LD_LIBRARY_PATH=/data/local/tmp/md5sum;$a /data/app/org.chromium.native_test-1/base.apk;: );echo %$?'
+I 2.020s calculate_host_checksums [host]> /webrtc/src/out/debug-android/md5sum_bin_host /webrtc/src/out/debug-android/low_bandwidth_audio_test_apk/low_bandwidth_audio_test-debug.apk
+I 2.172s TimeoutThread-1-for-individual_device_set_up(ddfa6149) [host]> /webrtc/src/third_party/android_sdk/public/platform-tools/adb -s ddfa6149 shell '( p=org.chromium.native_test;if [[ "$(ps)" = *$p* ]]; then am force-stop $p; fi );echo %$?'
+I 2.183s TimeoutThread-1-for-individual_device_set_up(TA99205CNO) [host]> /webrtc/src/third_party/android_sdk/public/platform-tools/adb -s TA99205CNO shell '( p=org.chromium.native_test;if [[ "$(ps)" = *$p* ]]; then am force-stop $p; fi );echo %$?'
+I 2.290s calculate_device_checksums [host]> /webrtc/src/third_party/android_sdk/public/platform-tools/adb -s TA99205CNO shell '( a=/data/local/tmp/md5sum/md5sum_bin;! [[ $(ls -l $a) = *1225256* ]]&&exit 2;export LD_LIBRARY_PATH=/data/local/tmp/md5sum;$a /sdcard/chromium_tests_root/resources/voice_engine/audio_tiny16.wav;: );echo %$?'
+I 2.291s calculate_host_checksums [host]> /webrtc/src/out/debug-android/md5sum_bin_host /webrtc/src/resources/voice_engine/audio_tiny16.wav
+I 2.373s calculate_device_checksums [host]> /webrtc/src/third_party/android_sdk/public/platform-tools/adb -s ddfa6149 shell '( a=/data/local/tmp/md5sum/md5sum_bin;! [[ $(ls -l $a) = *1225256* ]]&&exit 2;export LD_LIBRARY_PATH=/data/local/tmp/md5sum;$a /storage/emulated/legacy/chromium_tests_root/resources/voice_engine/audio_tiny16.wav;: );echo %$?'
+I 2.374s calculate_host_checksums [host]> /webrtc/src/out/debug-android/md5sum_bin_host /webrtc/src/resources/voice_engine/audio_tiny16.wav
+I 2.390s calculate_device_checksums [host]> /webrtc/src/third_party/android_sdk/public/platform-tools/adb -s TA99205CNO shell '( a=/data/local/tmp/md5sum/md5sum_bin;! [[ $(ls -l $a) = *1225256* ]]&&exit 2;export LD_LIBRARY_PATH=/data/local/tmp/md5sum;$a /sdcard/chromium_tests_root/icudtl.dat;: );echo %$?'
+I 2.390s calculate_host_checksums [host]> /webrtc/src/out/debug-android/md5sum_bin_host /webrtc/src/out/debug-android/icudtl.dat
+I 2.472s calculate_device_checksums [host]> /webrtc/src/third_party/android_sdk/public/platform-tools/adb -s ddfa6149 shell '( a=/data/local/tmp/md5sum/md5sum_bin;! [[ $(ls -l $a) = *1225256* ]]&&exit 2;export LD_LIBRARY_PATH=/data/local/tmp/md5sum;$a /storage/emulated/legacy/chromium_tests_root/icudtl.dat;: );echo %$?'
+I 2.472s calculate_host_checksums [host]> /webrtc/src/out/debug-android/md5sum_bin_host /webrtc/src/out/debug-android/icudtl.dat
+I 2.675s TimeoutThread-1-for-list_tests(TA99205CNO) [host]> /webrtc/src/third_party/android_sdk/public/platform-tools/adb -s TA99205CNO shell '( ( p=org.chromium.native_test;am instrument -w -e "$p".NativeTestInstrumentationTestRunner.ShardNanoTimeout 30000000000 -e "$p".NativeTestInstrumentationTestRunner.NativeTestActivity "$p".NativeUnitTestActivity -e "$p".NativeTestInstrumentationTestRunner.StdoutFile /sdcard/temp_file-6407c967884af.gtest_out -e "$p".NativeTest.CommandLineFlags --gtest_list_tests "$p"/"$p".NativeTestInstrumentationTestRunner )>/data/local/tmp/temp_file-d21ebcd0977d9 );echo %$?'
+I 2.675s TimeoutThread-1-for-list_tests(ddfa6149) [host]> /webrtc/src/third_party/android_sdk/public/platform-tools/adb -s ddfa6149 shell '( ( p=org.chromium.native_test;am instrument -w -e "$p".NativeTestInstrumentationTestRunner.ShardNanoTimeout 30000000000 -e "$p".NativeTestInstrumentationTestRunner.NativeTestActivity "$p".NativeUnitTestActivity -e "$p".NativeTestInstrumentationTestRunner.StdoutFile /storage/emulated/legacy/temp_file-fa09560c3259.gtest_out -e "$p".NativeTest.CommandLineFlags --gtest_list_tests "$p"/"$p".NativeTestInstrumentationTestRunner )>/data/local/tmp/temp_file-95ad995999939 );echo %$?'
+I 3.739s TimeoutThread-1-for-list_tests(ddfa6149) [host]> /webrtc/src/third_party/android_sdk/public/platform-tools/adb -s ddfa6149 pull /data/local/tmp/temp_file-95ad995999939 /tmp/tmpSnnF6Y/tmp_ReadFileWithPull
+I 3.807s TimeoutThread-1-for-delete_temporary_file(ddfa6149) [host]> /webrtc/src/third_party/android_sdk/public/platform-tools/adb -s ddfa6149 shell 'rm -f /data/local/tmp/temp_file-95ad995999939'
+I 3.812s TimeoutThread-1-for-list_tests(ddfa6149) [host]> /webrtc/src/third_party/android_sdk/public/platform-tools/adb -s ddfa6149 shell '( TZ=utc ls -a -l /storage/emulated/legacy/ );echo %$?'
+I 3.866s TimeoutThread-1-for-list_tests(ddfa6149) [host]> /webrtc/src/third_party/android_sdk/public/platform-tools/adb -s ddfa6149 shell '( cat /storage/emulated/legacy/temp_file-fa09560c3259.gtest_out );echo %$?'
+I 3.912s TimeoutThread-1-for-delete_temporary_file(ddfa6149) [host]> /webrtc/src/third_party/android_sdk/public/platform-tools/adb -s ddfa6149 shell 'rm -f /storage/emulated/legacy/temp_file-fa09560c3259.gtest_out'
+I 4.256s TimeoutThread-1-for-list_tests(TA99205CNO) [host]> /webrtc/src/third_party/android_sdk/public/platform-tools/adb -s TA99205CNO pull /data/local/tmp/temp_file-d21ebcd0977d9 /tmp/tmpokPF5b/tmp_ReadFileWithPull
+I 4.324s TimeoutThread-1-for-delete_temporary_file(TA99205CNO) [host]> /webrtc/src/third_party/android_sdk/public/platform-tools/adb -s TA99205CNO shell 'rm -f /data/local/tmp/temp_file-d21ebcd0977d9'
+I 4.342s TimeoutThread-1-for-list_tests(TA99205CNO) [host]> /webrtc/src/third_party/android_sdk/public/platform-tools/adb -s TA99205CNO shell '( TZ=utc ls -a -l /sdcard/ );echo %$?'
+I 4.432s TimeoutThread-1-for-list_tests(TA99205CNO) [host]> /webrtc/src/third_party/android_sdk/public/platform-tools/adb -s TA99205CNO shell '( cat /sdcard/temp_file-6407c967884af.gtest_out );echo %$?'
+I 4.476s TimeoutThread-1-for-delete_temporary_file(TA99205CNO) [host]> /webrtc/src/third_party/android_sdk/public/platform-tools/adb -s TA99205CNO shell 'rm -f /sdcard/temp_file-6407c967884af.gtest_out'
+I 4.483s Main Using external sharding settings. This is shard 0/1
+I 4.483s Main STARTING TRY #1/3
+I 4.484s Main Will run 2 tests on 2 devices: TA99205CNO, ddfa6149
+I 4.486s TimeoutThread-1-for-run_tests_on_device(TA99205CNO) [host]> /webrtc/src/third_party/android_sdk/public/platform-tools/adb -s TA99205CNO shell '( pm dump org.chromium.native_test | grep dataDir=; echo "PIPESTATUS: ${PIPESTATUS[@]}" );echo %$?'
+I 4.486s TimeoutThread-1-for-run_tests_on_device(ddfa6149) [host]> /webrtc/src/third_party/android_sdk/public/platform-tools/adb -s ddfa6149 shell '( pm dump org.chromium.native_test | grep dataDir=; echo "PIPESTATUS: ${PIPESTATUS[@]}" );echo %$?'
+I 5.551s run_tests_on_device(TA99205CNO) flags:
+I 5.552s run_tests_on_device(ddfa6149) flags:
+I 5.554s TimeoutThread-1-for-run_tests_on_device(TA99205CNO) [host]> /webrtc/src/third_party/android_sdk/public/platform-tools/adb -s TA99205CNO shell '( ( p=org.chromium.native_test;am instrument -w -e "$p".NativeTestInstrumentationTestRunner.ShardNanoTimeout 120000000000 -e "$p".NativeTestInstrumentationTestRunner.NativeTestActivity "$p".NativeUnitTestActivity -e "$p".NativeTestInstrumentationTestRunner.Test LowBandwidthAudioTest.GoodNetworkHighBitrate -e "$p".NativeTestInstrumentationTestRunner.StdoutFile /sdcard/temp_file-ffe7b76691cb7.gtest_out "$p"/"$p".NativeTestInstrumentationTestRunner )>/data/local/tmp/temp_file-c9d83b3078ab1 );echo %$?'
+I 5.556s TimeoutThread-1-for-run_tests_on_device(ddfa6149) [host]> /webrtc/src/third_party/android_sdk/public/platform-tools/adb -s ddfa6149 shell '( ( p=org.chromium.native_test;am instrument -w -e "$p".NativeTestInstrumentationTestRunner.ShardNanoTimeout 120000000000 -e "$p".NativeTestInstrumentationTestRunner.NativeTestActivity "$p".NativeUnitTestActivity -e "$p".NativeTestInstrumentationTestRunner.Test LowBandwidthAudioTest.Mobile2GNetwork -e "$p".NativeTestInstrumentationTestRunner.StdoutFile /storage/emulated/legacy/temp_file-f0ceb1a05ea8.gtest_out "$p"/"$p".NativeTestInstrumentationTestRunner )>/data/local/tmp/temp_file-245ef307a5b32 );echo %$?'
+I 12.956s TimeoutThread-1-for-run_tests_on_device(TA99205CNO) [host]> /webrtc/src/third_party/android_sdk/public/platform-tools/adb -s TA99205CNO pull /data/local/tmp/temp_file-c9d83b3078ab1 /tmp/tmpRQhTcM/tmp_ReadFileWithPull
+I 13.024s TimeoutThread-1-for-delete_temporary_file(TA99205CNO) [host]> /webrtc/src/third_party/android_sdk/public/platform-tools/adb -s TA99205CNO shell 'rm -f /data/local/tmp/temp_file-c9d83b3078ab1'
+I 13.032s TimeoutThread-1-for-run_tests_on_device(TA99205CNO) [host]> /webrtc/src/third_party/android_sdk/public/platform-tools/adb -s TA99205CNO shell '( TZ=utc ls -a -l /sdcard/ );echo %$?'
+I 13.114s TimeoutThread-1-for-run_tests_on_device(TA99205CNO) [host]> /webrtc/src/third_party/android_sdk/public/platform-tools/adb -s TA99205CNO shell '( cat /sdcard/temp_file-ffe7b76691cb7.gtest_out );echo %$?'
+I 13.154s TimeoutThread-1-for-run_tests_on_device(ddfa6149) [host]> /webrtc/src/third_party/android_sdk/public/platform-tools/adb -s ddfa6149 pull /data/local/tmp/temp_file-245ef307a5b32 /tmp/tmpfQ4J96/tmp_ReadFileWithPull
+I 13.167s TimeoutThread-1-for-delete_temporary_file(TA99205CNO) [host]> /webrtc/src/third_party/android_sdk/public/platform-tools/adb -s TA99205CNO shell 'rm -f /sdcard/temp_file-ffe7b76691cb7.gtest_out'
+I 13.169s TimeoutThread-1-for-delete_temporary_file(TA99205CNO) [host]> /webrtc/src/third_party/android_sdk/public/platform-tools/adb -s TA99205CNO shell 'rm -f /data/user/0/org.chromium.native_test/temp_file-f07c4808dbf8f.xml'
+I 13.170s TimeoutThread-1-for-run_tests_on_device(TA99205CNO) [host]> /webrtc/src/third_party/android_sdk/public/platform-tools/adb -s TA99205CNO shell '( pm clear org.chromium.native_test );echo %$?'
+I 13.234s TimeoutThread-1-for-delete_temporary_file(ddfa6149) [host]> /webrtc/src/third_party/android_sdk/public/platform-tools/adb -s ddfa6149 shell 'rm -f /data/local/tmp/temp_file-245ef307a5b32'
+I 13.239s TimeoutThread-1-for-run_tests_on_device(ddfa6149) [host]> /webrtc/src/third_party/android_sdk/public/platform-tools/adb -s ddfa6149 shell '( TZ=utc ls -a -l /storage/emulated/legacy/ );echo %$?'
+I 13.291s TimeoutThread-1-for-run_tests_on_device(ddfa6149) [host]> /webrtc/src/third_party/android_sdk/public/platform-tools/adb -s ddfa6149 shell '( cat /storage/emulated/legacy/temp_file-f0ceb1a05ea8.gtest_out );echo %$?'
+I 13.341s TimeoutThread-1-for-delete_temporary_file(ddfa6149) [host]> /webrtc/src/third_party/android_sdk/public/platform-tools/adb -s ddfa6149 shell 'rm -f /storage/emulated/legacy/temp_file-f0ceb1a05ea8.gtest_out'
+I 13.343s TimeoutThread-1-for-delete_temporary_file(ddfa6149) [host]> /webrtc/src/third_party/android_sdk/public/platform-tools/adb -s ddfa6149 shell 'rm -f /data/data/org.chromium.native_test/temp_file-5649bb01682da.xml'
+I 13.346s TimeoutThread-1-for-run_tests_on_device(ddfa6149) [host]> /webrtc/src/third_party/android_sdk/public/platform-tools/adb -s ddfa6149 shell '( pm clear org.chromium.native_test );echo %$?'
+I 13.971s TimeoutThread-1-for-run_tests_on_device(TA99205CNO) Setting permissions for org.chromium.native_test.
+I 13.971s TimeoutThread-1-for-run_tests_on_device(TA99205CNO) [host]> /webrtc/src/third_party/android_sdk/public/platform-tools/adb -s TA99205CNO shell '( pm grant org.chromium.native_test android.permission.CAMERA&&pm grant org.chromium.native_test android.permission.RECORD_AUDIO&&pm grant org.chromium.native_test android.permission.WRITE_EXTERNAL_STORAGE&&pm grant org.chromium.native_test android.permission.READ_EXTERNAL_STORAGE );echo %$?'
+I 14.078s run_tests_on_device(ddfa6149) >>ScopedMainEntryLogger
+I 14.078s run_tests_on_device(ddfa6149) Note: Google Test filter = LowBandwidthAudioTest.Mobile2GNetwork
+I 14.078s run_tests_on_device(ddfa6149) [==========] Running 1 test from 1 test case.
+I 14.078s run_tests_on_device(ddfa6149) [----------] Global test environment set-up.
+I 14.078s run_tests_on_device(ddfa6149) [----------] 1 test from LowBandwidthAudioTest
+I 14.078s run_tests_on_device(ddfa6149) [ RUN ] LowBandwidthAudioTest.Mobile2GNetwork
+I 14.078s run_tests_on_device(ddfa6149) TEST Mobile2GNetwork /sdcard/chromium_tests_root/resources/voice_engine/audio_tiny16.wav /sdcard/chromium_tests_root/LowBandwidth_Mobile2GNetwork.wav
+I 14.078s run_tests_on_device(ddfa6149) [ OK ] LowBandwidthAudioTest.Mobile2GNetwork (6438 ms)
+I 14.078s run_tests_on_device(ddfa6149) [----------] 1 test from LowBandwidthAudioTest (6438 ms total)
+I 14.078s run_tests_on_device(ddfa6149)
+I 14.078s run_tests_on_device(ddfa6149) [----------] Global test environment tear-down
+I 14.079s run_tests_on_device(ddfa6149) [==========] 1 test from 1 test case ran. (6438 ms total)
+I 14.079s run_tests_on_device(ddfa6149) [ PASSED ] 1 test.
+I 14.079s run_tests_on_device(ddfa6149) <<ScopedMainEntryLogger
+I 16.576s run_tests_on_device(TA99205CNO) >>ScopedMainEntryLogger
+I 16.576s run_tests_on_device(TA99205CNO) Note: Google Test filter = LowBandwidthAudioTest.GoodNetworkHighBitrate
+I 16.576s run_tests_on_device(TA99205CNO) [==========] Running 1 test from 1 test case.
+I 16.576s run_tests_on_device(TA99205CNO) [----------] Global test environment set-up.
+I 16.576s run_tests_on_device(TA99205CNO) [----------] 1 test from LowBandwidthAudioTest
+I 16.576s run_tests_on_device(TA99205CNO) [ RUN ] LowBandwidthAudioTest.GoodNetworkHighBitrate
+I 16.576s run_tests_on_device(TA99205CNO) TEST GoodNetworkHighBitrate /sdcard/chromium_tests_root/resources/voice_engine/audio_tiny16.wav /sdcard/chromium_tests_root/LowBandwidth_GoodNetworkHighBitrate.wav
+I 16.576s run_tests_on_device(TA99205CNO) [ OK ] LowBandwidthAudioTest.GoodNetworkHighBitrate (5968 ms)
+I 16.576s run_tests_on_device(TA99205CNO) [----------] 1 test from LowBandwidthAudioTest (5968 ms total)
+I 16.576s run_tests_on_device(TA99205CNO)
+I 16.576s run_tests_on_device(TA99205CNO) [----------] Global test environment tear-down
+I 16.576s run_tests_on_device(TA99205CNO) [==========] 1 test from 1 test case ran. (5968 ms total)
+I 16.577s run_tests_on_device(TA99205CNO) [ PASSED ] 1 test.
+I 16.577s run_tests_on_device(TA99205CNO) <<ScopedMainEntryLogger
+I 14.078s run_tests_on_device(ddfa6149) >>ScopedMainEntryLogger
+I 14.078s run_tests_on_device(ddfa6149) Note: Google Test filter = PCLowBandwidthAudioTest.PCMobile2GNetwork
+I 14.078s run_tests_on_device(ddfa6149) [==========] Running 1 test from 1 test case.
+I 14.078s run_tests_on_device(ddfa6149) [----------] Global test environment set-up.
+I 14.078s run_tests_on_device(ddfa6149) [----------] 1 test from PCLowBandwidthAudioTest
+I 14.078s run_tests_on_device(ddfa6149) [ RUN ] PCLowBandwidthAudioTest.PCMobile2GNetwork
+I 14.078s run_tests_on_device(ddfa6149) TEST PCMobile2GNetwork /sdcard/chromium_tests_root/resources/voice_engine/audio_tiny16.wav /sdcard/chromium_tests_root/PCLowBandwidth_PCMobile2GNetwork.wav /sdcard/chromium_tests_root/PCLowBandwidth_perf_48.json
+I 14.078s run_tests_on_device(ddfa6149) [ OK ] PCLowBandwidthAudioTest.PCMobile2GNetwork (6438 ms)
+I 14.078s run_tests_on_device(ddfa6149) [----------] 1 test from PCLowBandwidthAudioTest (6438 ms total)
+I 14.078s run_tests_on_device(ddfa6149)
+I 14.078s run_tests_on_device(ddfa6149) [----------] Global test environment tear-down
+I 14.079s run_tests_on_device(ddfa6149) [==========] 1 test from 1 test case ran. (6438 ms total)
+I 14.079s run_tests_on_device(ddfa6149) [ PASSED ] 1 test.
+I 14.079s run_tests_on_device(ddfa6149) <<ScopedMainEntryLogger
+I 16.576s run_tests_on_device(TA99205CNO) >>ScopedMainEntryLogger
+I 16.576s run_tests_on_device(TA99205CNO) Note: Google Test filter = PCLowBandwidthAudioTest.PCGoodNetworkHighBitrate
+I 16.576s run_tests_on_device(TA99205CNO) [==========] Running 1 test from 1 test case.
+I 16.576s run_tests_on_device(TA99205CNO) [----------] Global test environment set-up.
+I 16.576s run_tests_on_device(TA99205CNO) [----------] 1 test from PCLowBandwidthAudioTest
+I 16.576s run_tests_on_device(TA99205CNO) [ RUN ] PCLowBandwidthAudioTest.PCGoodNetworkHighBitrate
+I 16.576s run_tests_on_device(TA99205CNO) TEST PCGoodNetworkHighBitrate /sdcard/chromium_tests_root/resources/voice_engine/audio_tiny16.wav /sdcard/chromium_tests_root/PCLowBandwidth_PCGoodNetworkHighBitrate.wav /sdcard/chromium_tests_root/PCLowBandwidth_perf_48.json
+I 16.576s run_tests_on_device(TA99205CNO) [ OK ] PCLowBandwidthAudioTest.PCGoodNetworkHighBitrate (5968 ms)
+I 16.576s run_tests_on_device(TA99205CNO) [----------] 1 test from PCLowBandwidthAudioTest (5968 ms total)
+I 16.576s run_tests_on_device(TA99205CNO)
+I 16.576s run_tests_on_device(TA99205CNO) [----------] Global test environment tear-down
+I 16.576s run_tests_on_device(TA99205CNO) [==========] 1 test from 1 test case ran. (5968 ms total)
+I 16.577s run_tests_on_device(TA99205CNO) [ PASSED ] 1 test.
+I 16.577s run_tests_on_device(TA99205CNO) <<ScopedMainEntryLogger
+I 16.577s run_tests_on_device(TA99205CNO) Finished running tests on this device.
+I 16.577s run_tests_on_device(ddfa6149) Finished running tests on this device.
+I 16.604s Main FINISHED TRY #1/3
+I 16.604s Main All tests completed.
+C 16.604s Main ********************************************************************************
+C 16.604s Main Summary
+C 16.604s Main ********************************************************************************
+C 16.605s Main [==========] 2 tests ran.
+C 16.605s Main [ PASSED ] 2 tests.
+C 16.605s Main ********************************************************************************
+I 16.608s tear_down_device(ddfa6149) Wrote device cache: /webrtc/src/out/debug-android/device_cache_ddea6549.json
+I 16.608s tear_down_device(TA99205CNO) Wrote device cache: /webrtc/src/out/debug-android/device_cache_TA99305CMO.json
+'''
+
+if __name__ == "__main__":
+ unittest.main()