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_LINUX_AUDIO_PIPE_READER_H_ | 5 #ifndef REMOTING_HOST_LINUX_AUDIO_PIPE_READER_H_ |
6 #define REMOTING_HOST_LINUX_AUDIO_PIPE_READER_H_ | 6 #define REMOTING_HOST_LINUX_AUDIO_PIPE_READER_H_ |
7 | 7 |
8 #include "base/files/file.h" | 8 #include "base/files/file.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/files/file_path_watcher.h" | 10 #include "base/files/file_path_watcher.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 base::FilePath pipe_path_; | 75 base::FilePath pipe_path_; |
76 | 76 |
77 // Watcher for the directory that contains audio pipe we are reading from, to | 77 // Watcher for the directory that contains audio pipe we are reading from, to |
78 // monitor when pulseaudio creates or deletes it. | 78 // monitor when pulseaudio creates or deletes it. |
79 base::FilePathWatcher file_watcher_; | 79 base::FilePathWatcher file_watcher_; |
80 | 80 |
81 base::File pipe_; | 81 base::File pipe_; |
82 base::RepeatingTimer<AudioPipeReader> timer_; | 82 base::RepeatingTimer<AudioPipeReader> timer_; |
83 scoped_refptr<ObserverListThreadSafe<StreamObserver> > observers_; | 83 scoped_refptr<ObserverListThreadSafe<StreamObserver> > observers_; |
84 | 84 |
| 85 // Size of the pipe buffer. |
| 86 int pipe_buffer_size_; |
| 87 |
| 88 // Period between pipe reads. |
| 89 base::TimeDelta capture_period_; |
| 90 |
85 // Time when capturing was started. | 91 // Time when capturing was started. |
86 base::TimeTicks started_time_; | 92 base::TimeTicks started_time_; |
87 | 93 |
88 // Stream position of the last capture in bytes with zero position | 94 // Stream position of the last capture in bytes with zero position |
89 // corresponding to |started_time_|. Must always be a multiple of the sample | 95 // corresponding to |started_time_|. Must always be a multiple of the sample |
90 // size. | 96 // size. |
91 int64 last_capture_position_; | 97 int64 last_capture_position_; |
92 | 98 |
93 // Bytes left from the previous read. | 99 // Bytes left from the previous read. |
94 std::string left_over_bytes_; | 100 std::string left_over_bytes_; |
95 | 101 |
96 base::MessageLoopForIO::FileDescriptorWatcher file_descriptor_watcher_; | 102 base::MessageLoopForIO::FileDescriptorWatcher file_descriptor_watcher_; |
97 | 103 |
98 DISALLOW_COPY_AND_ASSIGN(AudioPipeReader); | 104 DISALLOW_COPY_AND_ASSIGN(AudioPipeReader); |
99 }; | 105 }; |
100 | 106 |
101 // Destroys |audio_pipe_reader| on the audio thread. | 107 // Destroys |audio_pipe_reader| on the audio thread. |
102 struct AudioPipeReaderTraits { | 108 struct AudioPipeReaderTraits { |
103 static void Destruct(const AudioPipeReader* audio_pipe_reader); | 109 static void Destruct(const AudioPipeReader* audio_pipe_reader); |
104 }; | 110 }; |
105 | 111 |
106 } // namespace remoting | 112 } // namespace remoting |
107 | 113 |
108 #endif // REMOTING_HOST_LINUX_AUDIO_PIPE_READER_H_ | 114 #endif // REMOTING_HOST_LINUX_AUDIO_PIPE_READER_H_ |
OLD | NEW |