| 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 SourcePlayingStates; | 153 SourcePlayingStates; |
| 154 | 154 |
| 155 // Used to DCHECK that we are called on the correct thread. | 155 // Used to DCHECK that we are called on the correct thread. |
| 156 base::ThreadChecker thread_checker_; | 156 base::ThreadChecker thread_checker_; |
| 157 | 157 |
| 158 // Flag to keep track the state of the renderer. | 158 // Flag to keep track the state of the renderer. |
| 159 State state_; | 159 State state_; |
| 160 | 160 |
| 161 // media::AudioRendererSink::RenderCallback implementation. | 161 // media::AudioRendererSink::RenderCallback implementation. |
| 162 // These two methods are called on the AudioOutputDevice worker thread. | 162 // These two methods are called on the AudioOutputDevice worker thread. |
| 163 int Render(media::AudioBus* audio_bus, | 163 int Render(base::TimeDelta delay, |
| 164 uint32_t frames_delayed, | 164 base::TimeTicks delay_timestamp, |
| 165 uint32_t frames_skipped) override; | 165 int prior_frames_skipped, |
| 166 media::AudioBus* audio_bus) override; |
| 166 void OnRenderError() override; | 167 void OnRenderError() override; |
| 167 | 168 |
| 168 // Called by AudioPullFifo when more data is necessary. | 169 // Called by AudioPullFifo when more data is necessary. |
| 169 // This method is called on the AudioOutputDevice worker thread. | 170 // This method is called on the AudioOutputDevice worker thread. |
| 170 void SourceCallback(int fifo_frame_delay, media::AudioBus* audio_bus); | 171 void SourceCallback(int fifo_frame_delay, media::AudioBus* audio_bus); |
| 171 | 172 |
| 172 // Goes through all renderers for the |source| and applies the proper | 173 // Goes through all renderers for the |source| and applies the proper |
| 173 // volume scaling for the source based on the volume(s) of the renderer(s). | 174 // volume scaling for the source based on the volume(s) of the renderer(s). |
| 174 void UpdateSourceVolume(webrtc::AudioSourceInterface* source); | 175 void UpdateSourceVolume(webrtc::AudioSourceInterface* source); |
| 175 | 176 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 | 222 |
| 222 // Ref count for the MediaPlayers which have called Start() but not Stop(). | 223 // Ref count for the MediaPlayers which have called Start() but not Stop(). |
| 223 int start_ref_count_; | 224 int start_ref_count_; |
| 224 | 225 |
| 225 // Used to buffer data between the client and the output device in cases where | 226 // Used to buffer data between the client and the output device in cases where |
| 226 // the client buffer size is not the same as the output device buffer size. | 227 // the client buffer size is not the same as the output device buffer size. |
| 227 std::unique_ptr<media::AudioPullFifo> audio_fifo_; | 228 std::unique_ptr<media::AudioPullFifo> audio_fifo_; |
| 228 | 229 |
| 229 // Contains the accumulated delay estimate which is provided to the WebRTC | 230 // Contains the accumulated delay estimate which is provided to the WebRTC |
| 230 // AEC. | 231 // AEC. |
| 231 int audio_delay_milliseconds_; | 232 base::TimeDelta audio_delay_; |
| 232 | 233 |
| 233 base::TimeDelta current_time_; | 234 base::TimeDelta current_time_; |
| 234 | 235 |
| 235 // Saved volume and playing state of the root renderer. | 236 // Saved volume and playing state of the root renderer. |
| 236 PlayingState playing_state_; | 237 PlayingState playing_state_; |
| 237 | 238 |
| 238 // Audio params used by the sink of the renderer. | 239 // Audio params used by the sink of the renderer. |
| 239 media::AudioParameters sink_params_; | 240 media::AudioParameters sink_params_; |
| 240 | 241 |
| 241 // The preferred device id of the output device or empty for the default | 242 // The preferred device id of the output device or empty for the default |
| (...skipping 11 matching lines...) Expand all Loading... |
| 253 // Stores the maximum time spent waiting for render data from the source. Used | 254 // Stores the maximum time spent waiting for render data from the source. Used |
| 254 // for logging UMA data. Logged and reset when Stop() is called. | 255 // for logging UMA data. Logged and reset when Stop() is called. |
| 255 base::TimeDelta max_render_time_; | 256 base::TimeDelta max_render_time_; |
| 256 | 257 |
| 257 DISALLOW_IMPLICIT_CONSTRUCTORS(WebRtcAudioRenderer); | 258 DISALLOW_IMPLICIT_CONSTRUCTORS(WebRtcAudioRenderer); |
| 258 }; | 259 }; |
| 259 | 260 |
| 260 } // namespace content | 261 } // namespace content |
| 261 | 262 |
| 262 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_RENDERER_H_ | 263 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_RENDERER_H_ |
| OLD | NEW |