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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 scoped_refptr<MediaStreamAudioRenderer> CreateSharedAudioRendererProxy( | 93 scoped_refptr<MediaStreamAudioRenderer> CreateSharedAudioRendererProxy( |
94 const scoped_refptr<webrtc::MediaStreamInterface>& media_stream); | 94 const scoped_refptr<webrtc::MediaStreamInterface>& media_stream); |
95 | 95 |
96 // Used to DCHECK on the expected state. | 96 // Used to DCHECK on the expected state. |
97 bool IsStarted() const; | 97 bool IsStarted() const; |
98 | 98 |
99 // Accessors to the sink audio parameters. | 99 // Accessors to the sink audio parameters. |
100 int channels() const { return sink_params_.channels(); } | 100 int channels() const { return sink_params_.channels(); } |
101 int sample_rate() const { return sink_params_.sample_rate(); } | 101 int sample_rate() const { return sink_params_.sample_rate(); } |
102 | 102 |
| 103 void SetCurrentRenderTime(const base::TimeDelta& current_time); |
| 104 |
103 private: | 105 private: |
104 // MediaStreamAudioRenderer implementation. This is private since we want | 106 // MediaStreamAudioRenderer implementation. This is private since we want |
105 // callers to use proxy objects. | 107 // callers to use proxy objects. |
106 // TODO(tommi): Make the MediaStreamAudioRenderer implementation a pimpl? | 108 // TODO(tommi): Make the MediaStreamAudioRenderer implementation a pimpl? |
107 virtual void Start() OVERRIDE; | 109 virtual void Start() OVERRIDE; |
108 virtual void Play() OVERRIDE; | 110 virtual void Play() OVERRIDE; |
109 virtual void Pause() OVERRIDE; | 111 virtual void Pause() OVERRIDE; |
110 virtual void Stop() OVERRIDE; | 112 virtual void Stop() OVERRIDE; |
111 virtual void SetVolume(float volume) OVERRIDE; | 113 virtual void SetVolume(float volume) OVERRIDE; |
112 virtual base::TimeDelta GetCurrentRenderTime() const OVERRIDE; | 114 virtual base::TimeDelta GetCurrentRenderTime() const OVERRIDE; |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 // the client buffer size is not the same as the output device buffer size. | 209 // the client buffer size is not the same as the output device buffer size. |
208 scoped_ptr<media::AudioPullFifo> audio_fifo_; | 210 scoped_ptr<media::AudioPullFifo> audio_fifo_; |
209 | 211 |
210 // Contains the accumulated delay estimate which is provided to the WebRTC | 212 // Contains the accumulated delay estimate which is provided to the WebRTC |
211 // AEC. | 213 // AEC. |
212 int audio_delay_milliseconds_; | 214 int audio_delay_milliseconds_; |
213 | 215 |
214 // Delay due to the FIFO in milliseconds. | 216 // Delay due to the FIFO in milliseconds. |
215 int fifo_delay_milliseconds_; | 217 int fifo_delay_milliseconds_; |
216 | 218 |
| 219 base::TimeDelta current_time_; |
| 220 |
217 // Saved volume and playing state of the root renderer. | 221 // Saved volume and playing state of the root renderer. |
218 PlayingState playing_state_; | 222 PlayingState playing_state_; |
219 | 223 |
220 // Audio params used by the sink of the renderer. | 224 // Audio params used by the sink of the renderer. |
221 media::AudioParameters sink_params_; | 225 media::AudioParameters sink_params_; |
222 | 226 |
223 // Maps audio sources to a list of active audio renderers. | 227 // Maps audio sources to a list of active audio renderers. |
224 // Pointers to PlayingState objects are only kept in this map while the | 228 // Pointers to PlayingState objects are only kept in this map while the |
225 // associated renderer is actually playing the stream. Ownership of the | 229 // associated renderer is actually playing the stream. Ownership of the |
226 // state objects lies with the renderers and they must leave the playing state | 230 // state objects lies with the renderers and they must leave the playing state |
227 // before being destructed (PlayingState object goes out of scope). | 231 // before being destructed (PlayingState object goes out of scope). |
228 SourcePlayingStates source_playing_states_; | 232 SourcePlayingStates source_playing_states_; |
229 | 233 |
230 DISALLOW_IMPLICIT_CONSTRUCTORS(WebRtcAudioRenderer); | 234 DISALLOW_IMPLICIT_CONSTRUCTORS(WebRtcAudioRenderer); |
231 }; | 235 }; |
232 | 236 |
233 } // namespace content | 237 } // namespace content |
234 | 238 |
235 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_RENDERER_H_ | 239 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_RENDERER_H_ |
OLD | NEW |