Commit d5597f9c authored by phoglund's avatar phoglund Committed by Commit bot

Implementing WebRTC audio quality test for Mac.

This makes the test described in http://goo.gl/umvzMt run on Mac.
It relies on Soundflower to loop audio from output to input so that rec
picks up the right audio.

The new gs resource files have been added to their respective buckets.

Note: this patch doesn't enable the tests. I need to configure the bots
first with sox and soundflower before I do that.

BUG=418034

Review URL: https://codereview.chromium.org/611433002

Cr-Commit-Position: refs/heads/master@{#296917}
parent 1810bb5c
...@@ -29,6 +29,8 @@ ...@@ -29,6 +29,8 @@
static const base::FilePath::CharType kReferenceFile[] = static const base::FilePath::CharType kReferenceFile[] =
#if defined (OS_WIN) #if defined (OS_WIN)
FILE_PATH_LITERAL("human-voice-win.wav"); FILE_PATH_LITERAL("human-voice-win.wav");
#elif defined (OS_MACOSX)
FILE_PATH_LITERAL("human-voice-mac.wav");
#else #else
FILE_PATH_LITERAL("human-voice-linux.wav"); FILE_PATH_LITERAL("human-voice-linux.wav");
#endif #endif
...@@ -39,6 +41,8 @@ static const base::FilePath::CharType kReferenceFile[] = ...@@ -39,6 +41,8 @@ static const base::FilePath::CharType kReferenceFile[] =
static const char kReferenceFileRelativeUrl[] = static const char kReferenceFileRelativeUrl[] =
#if defined (OS_WIN) #if defined (OS_WIN)
"resources/human-voice-win.wav"; "resources/human-voice-win.wav";
#elif defined (OS_MACOSX)
"resources/human-voice-mac.wav";
#else #else
"resources/human-voice-linux.wav"; "resources/human-voice-linux.wav";
#endif #endif
...@@ -70,6 +74,21 @@ static const char kMainWebrtcTestHtmlPage[] = ...@@ -70,6 +74,21 @@ static const char kMainWebrtcTestHtmlPage[] =
// Note: the volume for ALL your input devices will be forced to 100% by // Note: the volume for ALL your input devices will be forced to 100% by
// running this test on Linux. // running this test on Linux.
// //
// On Mac:
// 1. Get SoundFlower: http://rogueamoeba.com/freebies/soundflower/download.php
// 2. Install it + reboot.
// 3. Install MacPorts (http://www.macports.org/).
// 4. Install sox: sudo port install sox.
// 5. In Sound Preferences, set both input and output to Soundflower (2ch).
// Note: You will no longer hear audio on this machine, and it will no
// longer use any built-in mics.
// 6. Ensure the output volume is max and the input volume at about 20%.
// 7. Try launching chrome as the target user on the target machine, try
// playing, say, a YouTube video, and record with 'rec test.wav trim 0 5'.
// Stop the video in chrome and try playing back the file; you should hear
// a recording of the video (note; if you play back on the target machine
// you must revert the changes in step 3 first).
//
// On Windows 7: // On Windows 7:
// 1. Control panel > Sound > Manage audio devices. // 1. Control panel > Sound > Manage audio devices.
// 2. In the recording tab, right-click in an empty space in the pane with the // 2. In the recording tab, right-click in an empty space in the pane with the
...@@ -163,6 +182,21 @@ class AudioRecorder { ...@@ -163,6 +182,21 @@ class AudioRecorder {
command_line.AppendArgPath(output_file); command_line.AppendArgPath(output_file);
command_line.AppendArg("/DURATION"); command_line.AppendArg("/DURATION");
command_line.AppendArg(duration_in_hms); command_line.AppendArg(duration_in_hms);
#elif defined(OS_MACOSX)
command_line.SetProgram(base::FilePath("rec"));
command_line.AppendArg("-b");
command_line.AppendArg("16");
command_line.AppendArg("-q");
command_line.AppendArgPath(output_file);
command_line.AppendArg("trim");
command_line.AppendArg("0");
command_line.AppendArg(base::StringPrintf("%d", duration_sec));
command_line.AppendArg("rate");
command_line.AppendArg("16k");
if (mono) {
command_line.AppendArg("remix");
command_line.AppendArg("-");
}
#else #else
int num_channels = mono ? 1 : 2; int num_channels = mono ? 1 : 2;
command_line.SetProgram(base::FilePath("arecord")); command_line.SetProgram(base::FilePath("arecord"));
...@@ -201,6 +235,8 @@ bool ForceMicrophoneVolumeTo100Percent() { ...@@ -201,6 +235,8 @@ bool ForceMicrophoneVolumeTo100Percent() {
LOG(ERROR) << "Failed to set source volume: output was " << result; LOG(ERROR) << "Failed to set source volume: output was " << result;
return false; return false;
} }
#elif defined(OS_MACOSX)
// TODO(phoglund): implement.
#else #else
// Just force the volume of, say the first 5 devices. A machine will rarely // Just force the volume of, say the first 5 devices. A machine will rarely
// have more input sources than that. This is way easier than finding the // have more input sources than that. This is way easier than finding the
...@@ -297,6 +333,9 @@ bool RunPesq(const base::FilePath& reference_file, ...@@ -297,6 +333,9 @@ bool RunPesq(const base::FilePath& reference_file,
#if defined(OS_WIN) #if defined(OS_WIN)
base::FilePath pesq_path = base::FilePath pesq_path =
test::GetReferenceFilesDir().Append(FILE_PATH_LITERAL("tools/pesq.exe")); test::GetReferenceFilesDir().Append(FILE_PATH_LITERAL("tools/pesq.exe"));
#elif defined(OS_MACOSX)
base::FilePath pesq_path =
test::GetReferenceFilesDir().Append(FILE_PATH_LITERAL("tools/pesq_mac"));
#else #else
base::FilePath pesq_path = base::FilePath pesq_path =
test::GetReferenceFilesDir().Append(FILE_PATH_LITERAL("tools/pesq")); test::GetReferenceFilesDir().Append(FILE_PATH_LITERAL("tools/pesq"));
......
e02f47e3f9cc41b8218b4d80a690a007ce325e94
\ No newline at end of file
The files in this directory are downloaded from gs://chrome-webrtc-resources,
which is a google-internal bucket. The files in .. are downloaded from
gs://chromium-webrtc-resources, which is public.
9b9349dd7ef47709ca497cd66d9c453ab2b5c732
\ No newline at end of file
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