| 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..1a9453c61914eba23a3f9d0b5ce4c95fb963f832 100644
|
| --- a/remoting/host/audio_capturer_linux.h
|
| +++ b/remoting/host/audio_capturer_linux.h
|
| @@ -5,24 +5,28 @@
|
| #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/audio_pipe_reader.h"
|
|
|
| class FilePath;
|
|
|
| namespace remoting {
|
|
|
| +// Linux implementation of AudioCapturer interface which captures audio by
|
| +// reading samples from a Pulseaudio "pipe" sink.
|
| class AudioCapturerLinux : public AudioCapturer,
|
| - public MessageLoopForIO::Watcher {
|
| + public AudioPipeReader::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 to AudioPipeReader
|
| + // to read from the pipe.
|
| + static void InitializePipeReader(
|
| + scoped_refptr<base::SingleThreadTaskRunner> task_runner,
|
| + const FilePath& pipe_name);
|
| +
|
| + explicit AudioCapturerLinux(
|
| + scoped_refptr<AudioPipeReader> pipe_reader);
|
| virtual ~AudioCapturerLinux();
|
|
|
| // AudioCapturer interface.
|
| @@ -30,30 +34,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;
|
| + // AudioPipeReader::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<AudioPipeReader> pipe_reader_;
|
| 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);
|
| };
|
|
|
|
|