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 CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_RENDERER_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_RENDERER_H_ |
6 #define CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_RENDERER_H_ | 6 #define CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_RENDERER_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/threading/non_thread_safe.h" | 10 #include "base/threading/non_thread_safe.h" |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 | 187 |
188 // The sink (destination) for rendered audio. | 188 // The sink (destination) for rendered audio. |
189 scoped_refptr<media::AudioOutputDevice> sink_; | 189 scoped_refptr<media::AudioOutputDevice> sink_; |
190 | 190 |
191 // The media stream that holds the audio tracks that this renderer renders. | 191 // The media stream that holds the audio tracks that this renderer renders. |
192 const scoped_refptr<webrtc::MediaStreamInterface> media_stream_; | 192 const scoped_refptr<webrtc::MediaStreamInterface> media_stream_; |
193 | 193 |
194 // Audio data source from the browser process. | 194 // Audio data source from the browser process. |
195 WebRtcAudioRendererSource* source_; | 195 WebRtcAudioRendererSource* source_; |
196 | 196 |
197 // Protects access to |state_|, |source_| and |sink_|. | 197 // Protects access to |state_|, |source_|, |sink_| and |current_time_|. |
198 base::Lock lock_; | 198 mutable base::Lock lock_; |
199 | 199 |
200 // Ref count for the MediaPlayers which are playing audio. | 200 // Ref count for the MediaPlayers which are playing audio. |
201 int play_ref_count_; | 201 int play_ref_count_; |
202 | 202 |
203 // Ref count for the MediaPlayers which have called Start() but not Stop(). | 203 // Ref count for the MediaPlayers which have called Start() but not Stop(). |
204 int start_ref_count_; | 204 int start_ref_count_; |
205 | 205 |
206 // Used to buffer data between the client and the output device in cases where | 206 // Used to buffer data between the client and the output device in cases where |
207 // the client buffer size is not the same as the output device buffer size. | 207 // the client buffer size is not the same as the output device buffer size. |
208 scoped_ptr<media::AudioPullFifo> audio_fifo_; | 208 scoped_ptr<media::AudioPullFifo> audio_fifo_; |
209 | 209 |
210 // Contains the accumulated delay estimate which is provided to the WebRTC | 210 // Contains the accumulated delay estimate which is provided to the WebRTC |
211 // AEC. | 211 // AEC. |
212 int audio_delay_milliseconds_; | 212 int audio_delay_milliseconds_; |
213 | 213 |
214 // Delay due to the FIFO in milliseconds. | 214 // Delay due to the FIFO in milliseconds. |
215 int fifo_delay_milliseconds_; | 215 int fifo_delay_milliseconds_; |
216 | 216 |
| 217 base::TimeDelta current_time_; |
| 218 |
217 // Saved volume and playing state of the root renderer. | 219 // Saved volume and playing state of the root renderer. |
218 PlayingState playing_state_; | 220 PlayingState playing_state_; |
219 | 221 |
220 // Audio params used by the sink of the renderer. | 222 // Audio params used by the sink of the renderer. |
221 media::AudioParameters sink_params_; | 223 media::AudioParameters sink_params_; |
222 | 224 |
223 // Maps audio sources to a list of active audio renderers. | 225 // Maps audio sources to a list of active audio renderers. |
224 // Pointers to PlayingState objects are only kept in this map while the | 226 // Pointers to PlayingState objects are only kept in this map while the |
225 // associated renderer is actually playing the stream. Ownership of the | 227 // associated renderer is actually playing the stream. Ownership of the |
226 // state objects lies with the renderers and they must leave the playing state | 228 // state objects lies with the renderers and they must leave the playing state |
227 // before being destructed (PlayingState object goes out of scope). | 229 // before being destructed (PlayingState object goes out of scope). |
228 SourcePlayingStates source_playing_states_; | 230 SourcePlayingStates source_playing_states_; |
229 | 231 |
230 DISALLOW_IMPLICIT_CONSTRUCTORS(WebRtcAudioRenderer); | 232 DISALLOW_IMPLICIT_CONSTRUCTORS(WebRtcAudioRenderer); |
231 }; | 233 }; |
232 | 234 |
233 } // namespace content | 235 } // namespace content |
234 | 236 |
235 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_RENDERER_H_ | 237 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_RENDERER_H_ |
OLD | NEW |