OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_PROTOCOL_WEBRTC_AUDIO_MODULE_H_ | 5 #ifndef REMOTING_PROTOCOL_WEBRTC_AUDIO_MODULE_H_ |
6 #define REMOTING_PROTOCOL_WEBRTC_AUDIO_MODULE_H_ | 6 #define REMOTING_PROTOCOL_WEBRTC_AUDIO_MODULE_H_ |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/synchronization/lock.h" | 9 #include "base/synchronization/lock.h" |
10 #include "base/timer/timer.h" | |
11 #include "third_party/webrtc/modules/audio_device/include/audio_device.h" | 10 #include "third_party/webrtc/modules/audio_device/include/audio_device.h" |
12 | 11 |
13 namespace base { | 12 namespace base { |
| 13 class RepeatingTimer; |
14 class SingleThreadTaskRunner; | 14 class SingleThreadTaskRunner; |
15 } // namespace base | 15 } // namespace base |
16 | 16 |
17 namespace remoting { | 17 namespace remoting { |
18 namespace protocol { | 18 namespace protocol { |
19 | 19 |
20 // Audio module passed to WebRTC. It doesn't access actual audio devices, but it | 20 // Audio module passed to WebRTC. It doesn't access actual audio devices, but it |
21 // provides all functionality we need to ensure that audio streaming works | 21 // provides all functionality we need to ensure that audio streaming works |
22 // properly in WebRTC. Particularly it's responsible for calling AudioTransport | 22 // properly in WebRTC. Particularly it's responsible for calling AudioTransport |
23 // on regular intervals when playback is active. This ensures that all incoming | 23 // on regular intervals when playback is active. This ensures that all incoming |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 // |lock_| must be locked when accessing |initialized_|, |playing_| and | 148 // |lock_| must be locked when accessing |initialized_|, |playing_| and |
149 // |audio_transport_|. | 149 // |audio_transport_|. |
150 mutable base::Lock lock_; | 150 mutable base::Lock lock_; |
151 | 151 |
152 bool initialized_ = false; | 152 bool initialized_ = false; |
153 bool playing_ = false; | 153 bool playing_ = false; |
154 webrtc::AudioTransport* audio_transport_ = nullptr; | 154 webrtc::AudioTransport* audio_transport_ = nullptr; |
155 | 155 |
156 // Timer running on the |audio_task_runner_| that polls audio from | 156 // Timer running on the |audio_task_runner_| that polls audio from |
157 // |audio_transport_|. | 157 // |audio_transport_|. |
158 base::RepeatingTimer poll_timer_; | 158 std::unique_ptr<base::RepeatingTimer> poll_timer_; |
159 }; | 159 }; |
160 | 160 |
161 } // namespace protocol | 161 } // namespace protocol |
162 } // namespace remoting | 162 } // namespace remoting |
163 | 163 |
164 #endif // REMOTING_PROTOCOL_WEBRTC_AUDIO_MODULE_H_ | 164 #endif // REMOTING_PROTOCOL_WEBRTC_AUDIO_MODULE_H_ |
OLD | NEW |