| Index: remoting/host/audio_capturer_linux.cc
|
| diff --git a/remoting/host/audio_capturer_linux.cc b/remoting/host/audio_capturer_linux.cc
|
| index 5af0d4cf76b9685270258ac193596b6073e21ee2..b4a8fd0eeedfef1919d4ce2983e1405392cbdcc5 100644
|
| --- a/remoting/host/audio_capturer_linux.cc
|
| +++ b/remoting/host/audio_capturer_linux.cc
|
| @@ -9,19 +9,18 @@
|
| #include <sys/types.h>
|
| #include <unistd.h>
|
|
|
| -#include "base/command_line.h"
|
| #include "base/eintr_wrapper.h"
|
| #include "base/file_path.h"
|
| +#include "base/lazy_instance.h"
|
| #include "base/logging.h"
|
| #include "base/stl_util.h"
|
| #include "remoting/proto/audio.pb.h"
|
| +#include "remoting/host/chromoting_host_context.h"
|
|
|
| namespace remoting {
|
|
|
| namespace {
|
|
|
| -const char kAudioPipeOptionName[] = "audio-pipe-name";
|
| -
|
| // PulseAudio's module-pipe-sink must be configured to use the following
|
| // parameters for the sink we read from.
|
| const AudioPacket_SamplingRate kSamplingRate = AudioPacket::SAMPLING_RATE_44100;
|
| @@ -37,6 +36,12 @@ const int kCapturingPeriodMs = 40;
|
| #define F_SETPIPE_SZ 1031
|
| #endif // defined(F_SETPIPE_SZ)
|
|
|
| +// Pipename used to capture audio stream from.
|
| +// TODO(sergeyu): Pass this to AudioCapturerLinux constructor once we have
|
| +// Linux-specific DesktopEnvironmentFactory
|
| +base::LazyInstance<FilePath>::Leaky
|
| + g_audio_pipe_name = LAZY_INSTANCE_INITIALIZER;
|
| +
|
| const int IsPacketOfSilence(const std::string& data) {
|
| const int64* int_buf = reinterpret_cast<const int64*>(data.data());
|
| for (size_t i = 0; i < data.size() / sizeof(int64); i++) {
|
| @@ -175,14 +180,16 @@ void AudioCapturerLinux::WaitForPipeReadable() {
|
| &file_descriptor_watcher_, this);
|
| }
|
|
|
| +void AudioCapturerLinux::SetPipeName(const FilePath& pipe_name) {
|
| + g_audio_pipe_name.Get() = pipe_name;
|
| +}
|
| +
|
| bool AudioCapturer::IsSupported() {
|
| - CommandLine* cl = CommandLine::ForCurrentProcess();
|
| - return !cl->GetSwitchValuePath(kAudioPipeOptionName).empty();
|
| + return !g_audio_pipe_name.Get().empty();
|
| }
|
|
|
| scoped_ptr<AudioCapturer> AudioCapturer::Create() {
|
| - CommandLine* cl = CommandLine::ForCurrentProcess();
|
| - FilePath path = cl->GetSwitchValuePath(kAudioPipeOptionName);
|
| + FilePath path = g_audio_pipe_name.Get();
|
| if (path.empty())
|
| return scoped_ptr<AudioCapturer>();
|
| return scoped_ptr<AudioCapturer>(new AudioCapturerLinux(path));
|
|
|