Commit d5df68e2 authored by Olga Sharonova's avatar Olga Sharonova Committed by Commit Bot

Reland "Fix fake audio setup in WebRTC audio perf tests."

This is a reland of c0d56727

The fix helps only on Mac and Linux.

Original change's description:
> Fix fake audio setup in WebRTC audio perf tests.
>
> Change them to set up switches::kUseFileForFakeAudioCapture in
> SetUpCommandLine(), so that it can be propagated to the audio process.
>
> Bug: 850936
> Change-Id: Ia6cccc01d2b5fa7545abe8cb1554d72c33146566
> Reviewed-on: https://chromium-review.googlesource.com/1122857
> Reviewed-by: Henrik Boström <hbos@chromium.org>
> Commit-Queue: Olga Sharonova <olka@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#572142}

Bug: 850936
Change-Id: Ida4f3b888bc0332b68050d6b1cb8a0d5fef3cf32
Reviewed-on: https://chromium-review.googlesource.com/1124519Reviewed-by: default avatarHenrik Boström <hbos@chromium.org>
Commit-Queue: Henrik Boström <hbos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#572189}
parent ce5f0c23
......@@ -161,6 +161,9 @@ class MAYBE_WebRtcAudioQualityBrowserTest : public WebRtcTestBase {
// Add loopback interface such that there is always connectivity.
command_line->AppendSwitch(switches::kAllowLoopbackInPeerConnection);
reference_file_ = test::GetReferenceFilesDir().Append(kReferenceFile);
ConfigureFakeDeviceToPlayFile(reference_file_);
}
void ConfigureFakeDeviceToPlayFile(const base::FilePath& wav_file_path) {
......@@ -498,17 +501,18 @@ class MAYBE_WebRtcAudioQualityBrowserTest : public WebRtcTestBase {
}
protected:
void TestAutoGainControl(const base::FilePath::StringType& reference_filename,
const std::string& constraints,
void TestAutoGainControl(const std::string& constraints,
const std::string& perf_modifier);
void SetupAndRecordAudioCall(const base::FilePath& reference_file,
const base::FilePath& recording,
void SetupAndRecordAudioCall(const base::FilePath& recording,
const std::string& constraints,
const base::TimeDelta recording_time);
void TestWithFakeDeviceGetUserMedia(const std::string& constraints,
const std::string& perf_modifier);
const base::FilePath& reference_file() { return reference_file_; }
private:
base::FilePath reference_file_;
base::FilePath wav_dump_path_;
};
......@@ -655,7 +659,6 @@ bool ForceMicrophoneVolumeTo100Percent() {
// whole reference file. If you then silence-trim the reference file and actual
// file, you should end up with two time-synchronized files.
void MAYBE_WebRtcAudioQualityBrowserTest::SetupAndRecordAudioCall(
const base::FilePath& reference_file,
const base::FilePath& recording,
const std::string& constraints,
const base::TimeDelta recording_time) {
......@@ -663,8 +666,6 @@ void MAYBE_WebRtcAudioQualityBrowserTest::SetupAndRecordAudioCall(
ASSERT_TRUE(test::HasReferenceFilesInCheckout());
ASSERT_TRUE(ForceMicrophoneVolumeTo100Percent());
ConfigureFakeDeviceToPlayFile(reference_file);
// Create a two-way call. Mute one of the receivers though; that way it will
// be receiving audio bytes, but we will not be playing out of both elements.
GURL test_page = embedded_test_server()->GetURL(kWebRtcAudioTestHtmlPage);
......@@ -697,15 +698,12 @@ void MAYBE_WebRtcAudioQualityBrowserTest::TestWithFakeDeviceGetUserMedia(
return;
}
base::FilePath reference_file =
test::GetReferenceFilesDir().Append(kReferenceFile);
base::FilePath recording = CreateTemporaryWaveFile();
ASSERT_NO_FATAL_FAILURE(SetupAndRecordAudioCall(
reference_file, recording, constraints,
base::TimeDelta::FromSeconds(30)));
recording, constraints, base::TimeDelta::FromSeconds(30)));
ComputeAndPrintPesqResults(reference_file, recording, perf_modifier);
ComputeAndPrintPesqResults(reference_file(), recording, perf_modifier);
DeleteFileUnlessTestFailed(recording, false);
}
......@@ -754,9 +752,7 @@ IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcAudioQualityBrowserTest,
// Compare with the reference file on disk (this is the same file we played
// through WebAudio earlier).
base::FilePath reference_file =
test::GetReferenceFilesDir().Append(kReferenceFile);
ComputeAndPrintPesqResults(reference_file, recording, "_webaudio");
ComputeAndPrintPesqResults(reference_file(), recording, "_webaudio");
DeleteFileUnlessTestFailed(recording, false);
}
......@@ -792,7 +788,6 @@ IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcAudioQualityBrowserTest,
* http://crbug.com/421054.
*/
void MAYBE_WebRtcAudioQualityBrowserTest::TestAutoGainControl(
const base::FilePath::StringType& reference_filename,
const std::string& constraints,
const std::string& perf_modifier) {
if (OnWin8OrHigher()) {
......@@ -800,18 +795,15 @@ void MAYBE_WebRtcAudioQualityBrowserTest::TestAutoGainControl(
LOG(ERROR) << "This test is not implemented for Win8 or higher.";
return;
}
base::FilePath reference_file =
test::GetReferenceFilesDir().Append(reference_filename);
base::FilePath recording = CreateTemporaryWaveFile();
ASSERT_NO_FATAL_FAILURE(SetupAndRecordAudioCall(
reference_file, recording, constraints,
base::TimeDelta::FromSeconds(30)));
recording, constraints, base::TimeDelta::FromSeconds(30)));
base::ScopedTempDir split_ref_files;
ASSERT_TRUE(split_ref_files.CreateUniqueTempDirUnderPath(wav_dump_path_));
ASSERT_NO_FATAL_FAILURE(
SplitFileOnSilenceIntoDir(reference_file, split_ref_files.GetPath()));
SplitFileOnSilenceIntoDir(reference_file(), split_ref_files.GetPath()));
std::vector<base::FilePath> ref_segments =
ListWavFilesInDir(split_ref_files.GetPath());
......@@ -825,8 +817,8 @@ void MAYBE_WebRtcAudioQualityBrowserTest::TestAutoGainControl(
std::vector<base::FilePath> actual_segments =
ListWavFilesInDir(actual_files_dir);
AnalyzeSegmentsAndPrintResult(
ref_segments, actual_segments, reference_file, perf_modifier);
AnalyzeSegmentsAndPrintResult(ref_segments, actual_segments, reference_file(),
perf_modifier);
DeleteFileUnlessTestFailed(recording, false);
DeleteFileUnlessTestFailed(actual_files_dir, true);
......@@ -839,8 +831,8 @@ IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcAudioQualityBrowserTest,
// Disables AEC, but leaves AGC on.
const char* kAudioCallWithoutEchoCancellation =
"{audio: { mandatory: { googEchoCancellation: false } } }";
ASSERT_NO_FATAL_FAILURE(TestAutoGainControl(
kReferenceFile, kAudioCallWithoutEchoCancellation, "_with_agc"));
ASSERT_NO_FATAL_FAILURE(
TestAutoGainControl(kAudioCallWithoutEchoCancellation, "_with_agc"));
}
// Since the AGC is off here there should be no gain at all.
......@@ -849,6 +841,6 @@ IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcAudioQualityBrowserTest,
base::ScopedAllowBlockingForTesting allow_blocking;
const char* kAudioCallWithoutAudioProcessing =
"{audio: { mandatory: { echoCancellation: false } } }";
ASSERT_NO_FATAL_FAILURE(TestAutoGainControl(
kReferenceFile, kAudioCallWithoutAudioProcessing, "_no_agc"));
ASSERT_NO_FATAL_FAILURE(
TestAutoGainControl(kAudioCallWithoutAudioProcessing, "_no_agc"));
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment