OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef REMOTING_HOST_AUDIO_CAPTURER_LINUX_H_ | 5 #ifndef REMOTING_HOST_AUDIO_CAPTURER_LINUX_H_ |
6 #define REMOTING_HOST_AUDIO_CAPTURER_LINUX_H_ | 6 #define REMOTING_HOST_AUDIO_CAPTURER_LINUX_H_ |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "remoting/host/audio_capturer.h" | 9 #include "remoting/host/audio_capturer.h" |
10 #include "remoting/host/audio_silence_detector.h" | 10 #include "remoting/host/audio_silence_detector.h" |
11 #include "remoting/host/linux/audio_pipe_reader.h" | 11 #include "remoting/host/linux/audio_pipe_reader.h" |
12 | 12 |
| 13 namespace base { |
13 class FilePath; | 14 class FilePath; |
| 15 } |
14 | 16 |
15 namespace remoting { | 17 namespace remoting { |
16 | 18 |
17 // Linux implementation of AudioCapturer interface which captures audio by | 19 // Linux implementation of AudioCapturer interface which captures audio by |
18 // reading samples from a Pulseaudio "pipe" sink. | 20 // reading samples from a Pulseaudio "pipe" sink. |
19 class AudioCapturerLinux : public AudioCapturer, | 21 class AudioCapturerLinux : public AudioCapturer, |
20 public AudioPipeReader::StreamObserver { | 22 public AudioPipeReader::StreamObserver { |
21 public: | 23 public: |
22 // Must be called to configure the capturer before the first capturer instance | 24 // Must be called to configure the capturer before the first capturer instance |
23 // is created. |task_runner| is an IO thread that is passed to AudioPipeReader | 25 // is created. |task_runner| is an IO thread that is passed to AudioPipeReader |
24 // to read from the pipe. | 26 // to read from the pipe. |
25 static void InitializePipeReader( | 27 static void InitializePipeReader( |
26 scoped_refptr<base::SingleThreadTaskRunner> task_runner, | 28 scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
27 const FilePath& pipe_name); | 29 const base::FilePath& pipe_name); |
28 | 30 |
29 explicit AudioCapturerLinux( | 31 explicit AudioCapturerLinux( |
30 scoped_refptr<AudioPipeReader> pipe_reader); | 32 scoped_refptr<AudioPipeReader> pipe_reader); |
31 virtual ~AudioCapturerLinux(); | 33 virtual ~AudioCapturerLinux(); |
32 | 34 |
33 // AudioCapturer interface. | 35 // AudioCapturer interface. |
34 virtual bool Start(const PacketCapturedCallback& callback) OVERRIDE; | 36 virtual bool Start(const PacketCapturedCallback& callback) OVERRIDE; |
35 virtual void Stop() OVERRIDE; | 37 virtual void Stop() OVERRIDE; |
36 virtual bool IsStarted() OVERRIDE; | 38 virtual bool IsStarted() OVERRIDE; |
37 | 39 |
38 // AudioPipeReader::StreamObserver interface. | 40 // AudioPipeReader::StreamObserver interface. |
39 virtual void OnDataRead(scoped_refptr<base::RefCountedString> data) OVERRIDE; | 41 virtual void OnDataRead(scoped_refptr<base::RefCountedString> data) OVERRIDE; |
40 | 42 |
41 private: | 43 private: |
42 scoped_refptr<AudioPipeReader> pipe_reader_; | 44 scoped_refptr<AudioPipeReader> pipe_reader_; |
43 PacketCapturedCallback callback_; | 45 PacketCapturedCallback callback_; |
44 | 46 |
45 AudioSilenceDetector silence_detector_; | 47 AudioSilenceDetector silence_detector_; |
46 | 48 |
47 DISALLOW_COPY_AND_ASSIGN(AudioCapturerLinux); | 49 DISALLOW_COPY_AND_ASSIGN(AudioCapturerLinux); |
48 }; | 50 }; |
49 | 51 |
50 } // namespace remoting | 52 } // namespace remoting |
51 | 53 |
52 #endif // REMOTING_HOST_AUDIO_CAPTURER_LINUX_H_ | 54 #endif // REMOTING_HOST_AUDIO_CAPTURER_LINUX_H_ |
OLD | NEW |