OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef REMOTING_HOST_AUDIO_CAPTURER_LINUX_H_ | |
6 #define REMOTING_HOST_AUDIO_CAPTURER_LINUX_H_ | |
7 | |
8 #include "remoting/host/audio_capturer.h" | |
9 | |
10 #include "base/message_loop.h" | |
11 #include "base/time.h" | |
12 #include "base/timer.h" | |
13 | |
14 class FilePath; | |
15 | |
16 namespace remoting { | |
17 | |
18 class AudioCapturerLinux : public AudioCapturer, | |
19 public MessageLoopForIO::Watcher { | |
20 public: | |
21 explicit AudioCapturerLinux(const FilePath& pipe_name); | |
22 virtual ~AudioCapturerLinux(); | |
23 | |
24 // AudioCapturer interface. | |
25 virtual bool Start(const PacketCapturedCallback& callback) OVERRIDE; | |
26 virtual void Stop() OVERRIDE; | |
27 virtual bool IsRunning() OVERRIDE; | |
Wez
2012/09/06 21:47:29
nit: IsStarted()
Sergey Ulanov
2012/09/06 23:18:53
Done
| |
28 | |
29 // MessageLoopForIO::Watcher interface. | |
30 virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE; | |
31 virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE; | |
32 | |
33 private: | |
34 void StartTimer(); | |
35 void DoCapture(); | |
36 void Sleep(); | |
37 | |
38 int pipe_fd_; | |
39 base::RepeatingTimer<AudioCapturerLinux> timer_; | |
40 PacketCapturedCallback callback_; | |
41 | |
42 // Time when capturing was started. | |
43 base::TimeTicks started_time_; | |
44 | |
45 // Time of the last capture measured in samples relative to the beginning of | |
46 // the stream. | |
47 int64 last_capture_time_samples_; | |
Wez
2012/09/06 21:47:29
Express this simply as the stream position of the
Sergey Ulanov
2012/09/06 23:18:53
Done
| |
48 | |
49 MessageLoopForIO::FileDescriptorWatcher file_descriptor_watcher_; | |
50 | |
51 DISALLOW_COPY_AND_ASSIGN(AudioCapturerLinux); | |
52 }; | |
53 | |
54 } // namespace remoting | |
55 | |
56 #endif // REMOTING_HOST_AUDIO_CAPTURER_LINUX_H_ | |
OLD | NEW |