Commit 5b68db8c authored by Olga Sharonova's avatar Olga Sharonova Committed by Commit Bot

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

This reverts commit c0d56727.

Reason for revert: Win tests are still broken :(
https://uberchromegw.corp.google.com/i/chromium.webrtc/builders/Win7%20Tester/builds/43887/steps/browser_tests

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}

TBR=hbos@chromium.org,olka@chromium.org

Change-Id: I0a9dffe2824ac3fff218193fabe5caa39cb2a5cf
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 850936
Reviewed-on: https://chromium-review.googlesource.com/1124359Reviewed-by: default avatarOlga Sharonova <olka@chromium.org>
Commit-Queue: Olga Sharonova <olka@chromium.org>
Cr-Commit-Position: refs/heads/master@{#572163}
parent 14ae5724
...@@ -66,6 +66,14 @@ const int kMaxAgcSegmentDiffMs = ...@@ -66,6 +66,14 @@ const int kMaxAgcSegmentDiffMs =
200; 200;
#endif #endif
// Temporarily disabled on Win (https://crbug.com/850936).
#if defined(OS_LINUX) || defined(OS_MACOSX)
#define MAYBE_WebRtcAudioQualityBrowserTest WebRtcAudioQualityBrowserTest
#else
// Not implemented on Android, ChromeOS etc.
#define MAYBE_WebRtcAudioQualityBrowserTest DISABLED_WebRtcAudioQualityBrowserTest
#endif
} // namespace } // namespace
// Test we can set up a WebRTC call and play audio through it. // Test we can set up a WebRTC call and play audio through it.
...@@ -127,9 +135,9 @@ const int kMaxAgcSegmentDiffMs = ...@@ -127,9 +135,9 @@ const int kMaxAgcSegmentDiffMs =
// 50 / 100 in level. Also go into the playback tab, right-click Speakers, // 50 / 100 in level. Also go into the playback tab, right-click Speakers,
// and set that level to 50 / 100. Otherwise you will get distortion in // and set that level to 50 / 100. Otherwise you will get distortion in
// the recording. // the recording.
class WebRtcAudioQualityBrowserTest : public WebRtcTestBase { class MAYBE_WebRtcAudioQualityBrowserTest : public WebRtcTestBase {
public: public:
WebRtcAudioQualityBrowserTest() {} MAYBE_WebRtcAudioQualityBrowserTest() {}
void SetUpInProcessBrowserTestFixture() override { void SetUpInProcessBrowserTestFixture() override {
DetectErrorsInJavaScript(); // Look for errors in our rather complex js. DetectErrorsInJavaScript(); // Look for errors in our rather complex js.
} }
...@@ -153,9 +161,6 @@ class WebRtcAudioQualityBrowserTest : public WebRtcTestBase { ...@@ -153,9 +161,6 @@ class WebRtcAudioQualityBrowserTest : public WebRtcTestBase {
// Add loopback interface such that there is always connectivity. // Add loopback interface such that there is always connectivity.
command_line->AppendSwitch(switches::kAllowLoopbackInPeerConnection); command_line->AppendSwitch(switches::kAllowLoopbackInPeerConnection);
reference_file_ = test::GetReferenceFilesDir().Append(kReferenceFile);
ConfigureFakeDeviceToPlayFile(reference_file_);
} }
void ConfigureFakeDeviceToPlayFile(const base::FilePath& wav_file_path) { void ConfigureFakeDeviceToPlayFile(const base::FilePath& wav_file_path) {
...@@ -493,18 +498,17 @@ class WebRtcAudioQualityBrowserTest : public WebRtcTestBase { ...@@ -493,18 +498,17 @@ class WebRtcAudioQualityBrowserTest : public WebRtcTestBase {
} }
protected: protected:
void TestAutoGainControl(const std::string& constraints, void TestAutoGainControl(const base::FilePath::StringType& reference_filename,
const std::string& constraints,
const std::string& perf_modifier); const std::string& perf_modifier);
void SetupAndRecordAudioCall(const base::FilePath& recording, void SetupAndRecordAudioCall(const base::FilePath& reference_file,
const base::FilePath& recording,
const std::string& constraints, const std::string& constraints,
const base::TimeDelta recording_time); const base::TimeDelta recording_time);
void TestWithFakeDeviceGetUserMedia(const std::string& constraints, void TestWithFakeDeviceGetUserMedia(const std::string& constraints,
const std::string& perf_modifier); const std::string& perf_modifier);
const base::FilePath& reference_file() { return reference_file_; }
private: private:
base::FilePath reference_file_;
base::FilePath wav_dump_path_; base::FilePath wav_dump_path_;
}; };
...@@ -650,7 +654,8 @@ bool ForceMicrophoneVolumeTo100Percent() { ...@@ -650,7 +654,8 @@ bool ForceMicrophoneVolumeTo100Percent() {
// plenty of time. Similarly, the recording time should be enough to catch the // plenty of time. Similarly, the recording time should be enough to catch the
// whole reference file. If you then silence-trim the reference file and actual // whole reference file. If you then silence-trim the reference file and actual
// file, you should end up with two time-synchronized files. // file, you should end up with two time-synchronized files.
void WebRtcAudioQualityBrowserTest::SetupAndRecordAudioCall( void MAYBE_WebRtcAudioQualityBrowserTest::SetupAndRecordAudioCall(
const base::FilePath& reference_file,
const base::FilePath& recording, const base::FilePath& recording,
const std::string& constraints, const std::string& constraints,
const base::TimeDelta recording_time) { const base::TimeDelta recording_time) {
...@@ -658,6 +663,8 @@ void WebRtcAudioQualityBrowserTest::SetupAndRecordAudioCall( ...@@ -658,6 +663,8 @@ void WebRtcAudioQualityBrowserTest::SetupAndRecordAudioCall(
ASSERT_TRUE(test::HasReferenceFilesInCheckout()); ASSERT_TRUE(test::HasReferenceFilesInCheckout());
ASSERT_TRUE(ForceMicrophoneVolumeTo100Percent()); ASSERT_TRUE(ForceMicrophoneVolumeTo100Percent());
ConfigureFakeDeviceToPlayFile(reference_file);
// Create a two-way call. Mute one of the receivers though; that way it will // 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. // be receiving audio bytes, but we will not be playing out of both elements.
GURL test_page = embedded_test_server()->GetURL(kWebRtcAudioTestHtmlPage); GURL test_page = embedded_test_server()->GetURL(kWebRtcAudioTestHtmlPage);
...@@ -681,7 +688,7 @@ void WebRtcAudioQualityBrowserTest::SetupAndRecordAudioCall( ...@@ -681,7 +688,7 @@ void WebRtcAudioQualityBrowserTest::SetupAndRecordAudioCall(
HangUp(left_tab); HangUp(left_tab);
} }
void WebRtcAudioQualityBrowserTest::TestWithFakeDeviceGetUserMedia( void MAYBE_WebRtcAudioQualityBrowserTest::TestWithFakeDeviceGetUserMedia(
const std::string& constraints, const std::string& constraints,
const std::string& perf_modifier) { const std::string& perf_modifier) {
if (OnWin8OrHigher()) { if (OnWin8OrHigher()) {
...@@ -690,22 +697,25 @@ void WebRtcAudioQualityBrowserTest::TestWithFakeDeviceGetUserMedia( ...@@ -690,22 +697,25 @@ void WebRtcAudioQualityBrowserTest::TestWithFakeDeviceGetUserMedia(
return; return;
} }
base::FilePath reference_file =
test::GetReferenceFilesDir().Append(kReferenceFile);
base::FilePath recording = CreateTemporaryWaveFile(); base::FilePath recording = CreateTemporaryWaveFile();
ASSERT_NO_FATAL_FAILURE(SetupAndRecordAudioCall( ASSERT_NO_FATAL_FAILURE(SetupAndRecordAudioCall(
recording, constraints, base::TimeDelta::FromSeconds(30))); reference_file, recording, constraints,
base::TimeDelta::FromSeconds(30)));
ComputeAndPrintPesqResults(reference_file(), recording, perf_modifier); ComputeAndPrintPesqResults(reference_file, recording, perf_modifier);
DeleteFileUnlessTestFailed(recording, false); DeleteFileUnlessTestFailed(recording, false);
} }
IN_PROC_BROWSER_TEST_F(WebRtcAudioQualityBrowserTest, IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcAudioQualityBrowserTest,
MANUAL_TestCallQualityWithAudioFromFakeDevice) { MANUAL_TestCallQualityWithAudioFromFakeDevice) {
base::ScopedAllowBlockingForTesting allow_blocking; base::ScopedAllowBlockingForTesting allow_blocking;
TestWithFakeDeviceGetUserMedia(kAudioOnlyCallConstraints, "_getusermedia"); TestWithFakeDeviceGetUserMedia(kAudioOnlyCallConstraints, "_getusermedia");
} }
IN_PROC_BROWSER_TEST_F(WebRtcAudioQualityBrowserTest, IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcAudioQualityBrowserTest,
MANUAL_TestCallQualityWithAudioFromWebAudio) { MANUAL_TestCallQualityWithAudioFromWebAudio) {
base::ScopedAllowBlockingForTesting allow_blocking; base::ScopedAllowBlockingForTesting allow_blocking;
if (OnWin8OrHigher()) { if (OnWin8OrHigher()) {
...@@ -744,7 +754,9 @@ IN_PROC_BROWSER_TEST_F(WebRtcAudioQualityBrowserTest, ...@@ -744,7 +754,9 @@ IN_PROC_BROWSER_TEST_F(WebRtcAudioQualityBrowserTest,
// Compare with the reference file on disk (this is the same file we played // Compare with the reference file on disk (this is the same file we played
// through WebAudio earlier). // through WebAudio earlier).
ComputeAndPrintPesqResults(reference_file(), recording, "_webaudio"); base::FilePath reference_file =
test::GetReferenceFilesDir().Append(kReferenceFile);
ComputeAndPrintPesqResults(reference_file, recording, "_webaudio");
DeleteFileUnlessTestFailed(recording, false); DeleteFileUnlessTestFailed(recording, false);
} }
...@@ -779,7 +791,8 @@ IN_PROC_BROWSER_TEST_F(WebRtcAudioQualityBrowserTest, ...@@ -779,7 +791,8 @@ IN_PROC_BROWSER_TEST_F(WebRtcAudioQualityBrowserTest,
* device currently supports, and we want to be able to compare directly. See * device currently supports, and we want to be able to compare directly. See
* http://crbug.com/421054. * http://crbug.com/421054.
*/ */
void WebRtcAudioQualityBrowserTest::TestAutoGainControl( void MAYBE_WebRtcAudioQualityBrowserTest::TestAutoGainControl(
const base::FilePath::StringType& reference_filename,
const std::string& constraints, const std::string& constraints,
const std::string& perf_modifier) { const std::string& perf_modifier) {
if (OnWin8OrHigher()) { if (OnWin8OrHigher()) {
...@@ -787,15 +800,18 @@ void WebRtcAudioQualityBrowserTest::TestAutoGainControl( ...@@ -787,15 +800,18 @@ void WebRtcAudioQualityBrowserTest::TestAutoGainControl(
LOG(ERROR) << "This test is not implemented for Win8 or higher."; LOG(ERROR) << "This test is not implemented for Win8 or higher.";
return; return;
} }
base::FilePath reference_file =
test::GetReferenceFilesDir().Append(reference_filename);
base::FilePath recording = CreateTemporaryWaveFile(); base::FilePath recording = CreateTemporaryWaveFile();
ASSERT_NO_FATAL_FAILURE(SetupAndRecordAudioCall( ASSERT_NO_FATAL_FAILURE(SetupAndRecordAudioCall(
recording, constraints, base::TimeDelta::FromSeconds(30))); reference_file, recording, constraints,
base::TimeDelta::FromSeconds(30)));
base::ScopedTempDir split_ref_files; base::ScopedTempDir split_ref_files;
ASSERT_TRUE(split_ref_files.CreateUniqueTempDirUnderPath(wav_dump_path_)); ASSERT_TRUE(split_ref_files.CreateUniqueTempDirUnderPath(wav_dump_path_));
ASSERT_NO_FATAL_FAILURE( ASSERT_NO_FATAL_FAILURE(
SplitFileOnSilenceIntoDir(reference_file(), split_ref_files.GetPath())); SplitFileOnSilenceIntoDir(reference_file, split_ref_files.GetPath()));
std::vector<base::FilePath> ref_segments = std::vector<base::FilePath> ref_segments =
ListWavFilesInDir(split_ref_files.GetPath()); ListWavFilesInDir(split_ref_files.GetPath());
...@@ -809,30 +825,30 @@ void WebRtcAudioQualityBrowserTest::TestAutoGainControl( ...@@ -809,30 +825,30 @@ void WebRtcAudioQualityBrowserTest::TestAutoGainControl(
std::vector<base::FilePath> actual_segments = std::vector<base::FilePath> actual_segments =
ListWavFilesInDir(actual_files_dir); ListWavFilesInDir(actual_files_dir);
AnalyzeSegmentsAndPrintResult(ref_segments, actual_segments, reference_file(), AnalyzeSegmentsAndPrintResult(
perf_modifier); ref_segments, actual_segments, reference_file, perf_modifier);
DeleteFileUnlessTestFailed(recording, false); DeleteFileUnlessTestFailed(recording, false);
DeleteFileUnlessTestFailed(actual_files_dir, true); DeleteFileUnlessTestFailed(actual_files_dir, true);
} }
// The AGC should apply non-zero gain here. // The AGC should apply non-zero gain here.
IN_PROC_BROWSER_TEST_F(WebRtcAudioQualityBrowserTest, IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcAudioQualityBrowserTest,
MANUAL_TestAutoGainControlOnLowAudio) { MANUAL_TestAutoGainControlOnLowAudio) {
base::ScopedAllowBlockingForTesting allow_blocking; base::ScopedAllowBlockingForTesting allow_blocking;
// Disables AEC, but leaves AGC on. // Disables AEC, but leaves AGC on.
const char* kAudioCallWithoutEchoCancellation = const char* kAudioCallWithoutEchoCancellation =
"{audio: { mandatory: { googEchoCancellation: false } } }"; "{audio: { mandatory: { googEchoCancellation: false } } }";
ASSERT_NO_FATAL_FAILURE( ASSERT_NO_FATAL_FAILURE(TestAutoGainControl(
TestAutoGainControl(kAudioCallWithoutEchoCancellation, "_with_agc")); kReferenceFile, kAudioCallWithoutEchoCancellation, "_with_agc"));
} }
// Since the AGC is off here there should be no gain at all. // Since the AGC is off here there should be no gain at all.
IN_PROC_BROWSER_TEST_F(WebRtcAudioQualityBrowserTest, IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcAudioQualityBrowserTest,
MANUAL_TestAutoGainIsOffWithAudioProcessingOff) { MANUAL_TestAutoGainIsOffWithAudioProcessingOff) {
base::ScopedAllowBlockingForTesting allow_blocking; base::ScopedAllowBlockingForTesting allow_blocking;
const char* kAudioCallWithoutAudioProcessing = const char* kAudioCallWithoutAudioProcessing =
"{audio: { mandatory: { echoCancellation: false } } }"; "{audio: { mandatory: { echoCancellation: false } } }";
ASSERT_NO_FATAL_FAILURE( ASSERT_NO_FATAL_FAILURE(TestAutoGainControl(
TestAutoGainControl(kAudioCallWithoutAudioProcessing, "_no_agc")); kReferenceFile, 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