Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Unified Diff: remoting/host/audio_capturer_linux.cc

Issue 10911271: Remove CommandLine dependency from the Linux's AudioCapturer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/host/audio_capturer_linux.h ('k') | remoting/host/remoting_me2me_host.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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));
« no previous file with comments | « remoting/host/audio_capturer_linux.h ('k') | remoting/host/remoting_me2me_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698