0

Suggest --no-sandbox if fake audio capture fails reading the file

When simulating a fake audio device with the
--use-fake-device-for-media-stream
--use-file-for-fake-audio-capture=audio.wav
arguments, the filepath (`audio.wav` here) isn't accessible because
of the mac sandbox. As a result, opening the file fails and the audio
file isn't played.

This changeset adds a suggestion to disable the sandbox if
simulating a fake audio device fails reading the audio file.

Bug: 1032604
Change-Id: Ia4bc9a1ba4eb9a6d199f7d018bb0122bbd912517
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2383230
Reviewed-by: Tommi <tommi@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Commit-Queue: Robert Sesek <rsesek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#805945}
This commit is contained in:
Arnaud Coomans
2020-09-10 22:23:10 +00:00
committed by Commit Bot
parent da1d809c00
commit 167f34ae93
2 changed files with 4 additions and 1 deletions

@ -106,6 +106,7 @@ Anuj Kumar Sharma <anujk.sharma@samsung.com>
Arjun Karthik <arjunkar@amazon.com>
Arman Ghotb <armanghotb@gmail.com>
Armin Burgmeier <aburgmeier@bloomberg.net>
Arnaud Coomans <hello@acoomans.com>
Arnaud Mandy <arnaud.mandy@intel.com>
Arnaud Renevier <a.renevier@samsung.com>
Arpita Bahuguna <a.bah@samsung.com>

@ -13,6 +13,7 @@
#include "base/numerics/math_constants.h"
#include "base/thread_annotations.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "media/audio/wav_audio_handler.h"
#include "media/base/audio_bus.h"
@ -28,7 +29,8 @@ std::unique_ptr<char[]> ReadWavFile(const base::FilePath& wav_filename,
wav_filename, base::File::FLAG_OPEN | base::File::FLAG_READ);
if (!wav_file.IsValid()) {
LOG(ERROR) << "Failed to read " << wav_filename.value()
<< " as input to the fake device.";
<< " as input to the fake device."
" Try disabling the sandbox with --no-sandbox.";
return nullptr;
}