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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 PlayingState* state); | 196 PlayingState* state); |
197 | 197 |
198 // Called whenever the Play/Pause state changes of any of the renderers | 198 // Called whenever the Play/Pause state changes of any of the renderers |
199 // or if the volume of any of them is changed. | 199 // or if the volume of any of them is changed. |
200 // Here we update the shared Play state and apply volume scaling to all audio | 200 // Here we update the shared Play state and apply volume scaling to all audio |
201 // sources associated with the |media_stream| based on the collective volume | 201 // sources associated with the |media_stream| based on the collective volume |
202 // of playing renderers. | 202 // of playing renderers. |
203 void OnPlayStateChanged(const blink::WebMediaStream& media_stream, | 203 void OnPlayStateChanged(const blink::WebMediaStream& media_stream, |
204 PlayingState* state); | 204 PlayingState* state); |
205 | 205 |
206 // Updates |sink_params_|, |audio_fifo_| and |fifo_delay_milliseconds_| based | 206 // Updates |sink_params_| and |audio_fifo_| based on |sink_|, and initializes |
207 // on |sink_|, and initializes |sink_|. | 207 // |sink_|. |
208 void PrepareSink(); | 208 void PrepareSink(); |
209 | 209 |
210 // The RenderFrame in which the audio is rendered into |sink_|. | 210 // The RenderFrame in which the audio is rendered into |sink_|. |
211 const int source_render_frame_id_; | 211 const int source_render_frame_id_; |
212 const int session_id_; | 212 const int session_id_; |
213 | 213 |
214 const scoped_refptr<base::SingleThreadTaskRunner> signaling_thread_; | 214 const scoped_refptr<base::SingleThreadTaskRunner> signaling_thread_; |
215 | 215 |
216 // The sink (destination) for rendered audio. | 216 // The sink (destination) for rendered audio. |
217 scoped_refptr<media::AudioOutputDevice> sink_; | 217 scoped_refptr<media::AudioOutputDevice> sink_; |
(...skipping 16 matching lines...) Expand all Loading... |
234 int start_ref_count_; | 234 int start_ref_count_; |
235 | 235 |
236 // Used to buffer data between the client and the output device in cases where | 236 // Used to buffer data between the client and the output device in cases where |
237 // the client buffer size is not the same as the output device buffer size. | 237 // the client buffer size is not the same as the output device buffer size. |
238 scoped_ptr<media::AudioPullFifo> audio_fifo_; | 238 scoped_ptr<media::AudioPullFifo> audio_fifo_; |
239 | 239 |
240 // Contains the accumulated delay estimate which is provided to the WebRTC | 240 // Contains the accumulated delay estimate which is provided to the WebRTC |
241 // AEC. | 241 // AEC. |
242 int audio_delay_milliseconds_; | 242 int audio_delay_milliseconds_; |
243 | 243 |
244 // Delay due to the FIFO in milliseconds. | |
245 int fifo_delay_milliseconds_; | |
246 | |
247 base::TimeDelta current_time_; | 244 base::TimeDelta current_time_; |
248 | 245 |
249 // Saved volume and playing state of the root renderer. | 246 // Saved volume and playing state of the root renderer. |
250 PlayingState playing_state_; | 247 PlayingState playing_state_; |
251 | 248 |
252 // Audio params used by the sink of the renderer. | 249 // Audio params used by the sink of the renderer. |
253 media::AudioParameters sink_params_; | 250 media::AudioParameters sink_params_; |
254 | 251 |
255 // The preferred device id of the output device or empty for the default | 252 // The preferred device id of the output device or empty for the default |
256 // output device. Can change as a result of a SetSinkId() call. | 253 // output device. Can change as a result of a SetSinkId() call. |
(...skipping 10 matching lines...) Expand all Loading... |
267 // Used for triggering new UMA histogram. Counts number of render | 264 // Used for triggering new UMA histogram. Counts number of render |
268 // callbacks modulo |kNumCallbacksBetweenRenderTimeHistograms|. | 265 // callbacks modulo |kNumCallbacksBetweenRenderTimeHistograms|. |
269 int render_callback_count_; | 266 int render_callback_count_; |
270 | 267 |
271 DISALLOW_IMPLICIT_CONSTRUCTORS(WebRtcAudioRenderer); | 268 DISALLOW_IMPLICIT_CONSTRUCTORS(WebRtcAudioRenderer); |
272 }; | 269 }; |
273 | 270 |
274 } // namespace content | 271 } // namespace content |
275 | 272 |
276 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_RENDERER_H_ | 273 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_RENDERER_H_ |
OLD | NEW |