b_serv --port=1234 --db=/tmp/fakedb c_serv --port=1235 a_serv --b_spec=localhost:1234 --c_spec=localhost:1235
chrome --renderer-cmd-prefix='xterm -title renderer -e gdb --args'
$ git cl upload Error: the media/audio directory requires formatting. Please run git cl format media/audio.
int FileSource::OnMoreData(AudioBus* audio_bus, uint32 total_bytes_delay) { // Load the file if we haven't already. This load needs to happen on the // audio thread, otherwise we'll run on the UI thread on Mac for instance. // This will massively delay the first OnMoreData, but we'll catch up. if (!wav_audio_handler_) LoadWavFile(path_to_wav_file_); if (load_failed_) return 0; DCHECK(wav_audio_handler_.get()); // Stop playing if we've played out the whole file. if (wav_audio_handler_->AtEnd(wav_file_read_pos_)) return 0; // This pulls data from ProvideInput. file_audio_converter_->Convert(audio_bus); return audio_bus->frames(); }
chrome --use-fake-device-for-media-stream \ --use-file-for-fake-audio-capture=/tmp/file.wav
// ... size_t bytes_written; wav_audio_handler->CopyTo(audio_bus.get(), 0, &bytes_written); CHECK_EQ(bytes_written, wav_audio_handler->data().size()) << "Expected to write entire file into bus."; // Set the filter coefficient to the whole file's duration; this will make // the power monitor take the entire file into account. media::AudioPowerMonitor power_monitor(wav_audio_handler->sample_rate(), file_duration); power_monitor.Scan(*audio_bus, audio_bus->frames()); // ... return power_monitor.ReadCurrentPowerAndClip().first;
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))); base::ScopedTempDir split_ref_files; ASSERT_TRUE(split_ref_files.CreateUniqueTempDir()); ASSERT_NO_FATAL_FAILURE( SplitFileOnSilenceIntoDir(reference_file, split_ref_files.path())); std::vector<base::FilePath> ref_segments = ListWavFilesInDir(split_ref_files.path()); base::ScopedTempDir split_actual_files; ASSERT_TRUE(split_actual_files.CreateUniqueTempDir()); ASSERT_NO_FATAL_FAILURE( SplitFileOnSilenceIntoDir(recording, split_actual_files.path())); // Keep the recording and split files if the analysis fails. base::FilePath actual_files_dir = split_actual_files.Take(); std::vector<base::FilePath> actual_segments = ListWavFilesInDir(actual_files_dir); AnalyzeSegmentsAndPrintResult( ref_segments, actual_segments, reference_file, perf_modifier); DeleteFileUnlessTestFailed(recording, false); DeleteFileUnlessTestFailed(actual_files_dir, true);
void AnalyzeSegmentsAndPrintResult( const std::vector<base::FilePath>& ref_segments, const std::vector<base::FilePath>& actual_segments, const base::FilePath& reference_file, const std::string& perf_modifier) { ASSERT_GT(ref_segments.size(), 0u) << "Failed to split reference file on silence; sox is likely broken."; ASSERT_EQ(ref_segments.size(), actual_segments.size()) << "The recording did not result in the same number of audio segments " << "after on splitting on silence; WebRTC must have deformed the audio " << "too much."; for (size_t i = 0; i < ref_segments.size(); i++) { float difference_in_decibel = AnalyzeOneSegment(ref_segments[i], actual_segments[i], i); std::string trace_name = MakeTraceName(reference_file, i); perf_test::PrintResult("agc_energy_diff", perf_modifier, trace_name, difference_in_decibel, "dB", false); } }
{ # ... 'src/third_party/webrtc': 'https://chromium.googlesource.com/' + 'external/webrtc/trunk/webrtc.git' + '@' + '5727038f572c517204e1642b8bc69b25381c4e9f', }
class WebRtcAmplifier { ... int SetOutputVolume(float volume); }
class WebRtcAmplifier { ... int SetOutputVolume(float volume, bool allow_eleven1); }
class WebRtcAmplifier { ... int SetOutputVolume(float volume); int SetOutputVolume2(float volume, bool allow_eleven); }
bool WaitForCallToComeUp(content::WebContents* tab_contents) { // Apprtc will set remoteVideo.style.opacity to 1 when the call comes up. std::string javascript = "window.domAutomationController.send(remoteVideo.style.opacity)"; return test::PollingWaitUntil(javascript, "1", tab_contents); }
bool DetectRemoteVideoPlaying(content::WebContents* tab_contents) { if (!EvalInJavascriptFile(tab_contents, GetSourceDir().Append( FILE_PATH_LITERAL( "chrome/test/data/webrtc/test_functions.js")))) return false; if (!EvalInJavascriptFile(tab_contents, GetSourceDir().Append( FILE_PATH_LITERAL( "chrome/test/data/webrtc/video_detector.js")))) return false; // The remote video tag is called remoteVideo in the AppRTC code. StartDetectingVideo(tab_contents, "remoteVideo"); WaitForVideoToPlay(tab_contents); return true; }
if (!HasWebcamOnSystem()) return;
google_appengine/dev_appserver.py apprtc_code/
bool LaunchApprtcInstanceOnLocalhost() // ... Figure out locations of SDK and apprtc code ... CommandLine command_line(CommandLine::NO_PROGRAM); EXPECT_TRUE(GetPythonCommand(&command_line)); command_line.AppendArgPath(appengine_dev_appserver); command_line.AppendArgPath(apprtc_dir); command_line.AppendArg("--port=9999"); command_line.AppendArg("--admin_port=9998"); command_line.AppendArg("--skip_sdk_update_check"); VLOG(1) << "Running " << command_line.GetCommandLineString(); return base::LaunchProcess(command_line, base::LaunchOptions(), &dev_appserver_); }
bool LocalApprtcInstanceIsUp() { // Load the admin page and see if we manage to load it right. ui_test_utils::NavigateToURL(browser(), GURL("localhost:9998")); content::WebContents* tab_contents = browser()->tab_strip_model()->GetActiveWebContents(); std::string javascript = "window.domAutomationController.send(document.title)"; std::string result; if (!content::ExecuteScriptAndExtractString(tab_contents, javascript, &result)) return false; return result == kTitlePageOfAppEngineAdminPage; }
while (!LocalApprtcInstanceIsUp()) VLOG(1) << "Waiting for AppRTC to come up...";
from mozprofile import profile from mozrunner import runner WEBRTC_PREFERENCES = { 'media.navigator.permission.disabled': True, } def main(): # Set up flags, handle SIGTERM, etc # ... firefox_profile = profile.FirefoxProfile(preferences=WEBRTC_PREFERENCES) firefox_runner = runner.FirefoxRunner( profile=firefox_profile, binary=options.binary, cmdargs=[options.webpage]) firefox_runner.start()
GURL room_url = GURL(base::StringPrintf("http://localhost:9999?r=room_%d", base::RandInt(0, 65536))); content::WebContents* chrome_tab = OpenPageAndAcceptUserMedia(room_url); ASSERT_TRUE(LaunchFirefoxWithUrl(room_url));
run_firefox_webrtc.py --binary /path/to/firefox --webpage http://localhost::9999?r=my_room