Chromium Code Reviews| Index: remoting/host/audio_capturer_linux.h |
| diff --git a/remoting/host/audio_capturer_linux.h b/remoting/host/audio_capturer_linux.h |
| index 8a825fffbf0b3fee922c56d750c7e7d4e0caf9a6..491df2ac963c775de59a76165acef052ee777f77 100644 |
| --- a/remoting/host/audio_capturer_linux.h |
| +++ b/remoting/host/audio_capturer_linux.h |
| @@ -5,24 +5,27 @@ |
| #ifndef REMOTING_HOST_AUDIO_CAPTURER_LINUX_H_ |
| #define REMOTING_HOST_AUDIO_CAPTURER_LINUX_H_ |
| +#include "base/memory/ref_counted.h" |
| #include "remoting/host/audio_capturer.h" |
| - |
| -#include "base/message_loop.h" |
| -#include "base/time.h" |
| -#include "base/timer.h" |
| +#include "remoting/host/linux/pulseaudio_pipe_sink_reader.h" |
| class FilePath; |
| namespace remoting { |
| +// Linux implementation of AudioCapturer interface. |
|
Wez
2012/10/31 00:56:28
nit: Suggest elaborating a little e.g. adding "...
Sergey Ulanov
2012/10/31 18:41:24
Done.
|
| class AudioCapturerLinux : public AudioCapturer, |
| - public MessageLoopForIO::Watcher { |
| + public PulseaudioPipeSinkReader::StreamObserver { |
| public: |
| - // Must be called to configure the capturer before the first instance is |
| - // created. |
| - static void SetPipeName(const FilePath& pipe_name); |
| - |
| - explicit AudioCapturerLinux(const FilePath& pipe_name); |
| + // Must be called to configure the capturer before the first capturer instance |
| + // is created. |task_runner| is an IO thread that is passed |
|
Wez
2012/10/31 00:56:28
nit: "... passed to PulseaudioPipeSinkReader ..."
Sergey Ulanov
2012/10/31 18:41:24
Done.
|
| + // PulseaudioPipeSinkReader to read from the pipe. |
| + static void InitializePipeReader( |
| + scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
| + const FilePath& pipe_name); |
| + |
| + explicit AudioCapturerLinux( |
| + scoped_refptr<PulseaudioPipeSinkReader> reader); |
| virtual ~AudioCapturerLinux(); |
| // AudioCapturer interface. |
| @@ -30,30 +33,13 @@ class AudioCapturerLinux : public AudioCapturer, |
| virtual void Stop() OVERRIDE; |
| virtual bool IsStarted() OVERRIDE; |
| - // MessageLoopForIO::Watcher interface. |
| - virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE; |
| - virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE; |
| + // PulseaudioPipeSinkReader::StreamObserver interface. |
| + virtual void OnDataRead(scoped_refptr<base::RefCountedString> data) OVERRIDE; |
| private: |
| - void StartTimer(); |
| - void DoCapture(); |
| - void WaitForPipeReadable(); |
| - |
| - int pipe_fd_; |
| - base::RepeatingTimer<AudioCapturerLinux> timer_; |
| + scoped_refptr<PulseaudioPipeSinkReader> reader_; |
|
Wez
2012/10/31 00:56:28
nit: pipe_reader_
Sergey Ulanov
2012/10/31 18:41:24
Done.
|
| PacketCapturedCallback callback_; |
| - // Time when capturing was started. |
| - base::TimeTicks started_time_; |
| - |
| - // Stream position of the last capture. |
| - int64 last_capture_samples_; |
| - |
| - // Bytes left from the previous read. |
| - std::string left_over_bytes_; |
| - |
| - MessageLoopForIO::FileDescriptorWatcher file_descriptor_watcher_; |
| - |
| DISALLOW_COPY_AND_ASSIGN(AudioCapturerLinux); |
| }; |