Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(284)

Side by Side Diff: content/renderer/media/webrtc_audio_renderer.h

Issue 328493003: Pass the elapsed time from VoE to WebRtcAudioRenderer as the current time for the audio/video eleme… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 // This method is called on the AudioOutputDevice worker thread.
104 void SetCurrentRenderTime(const base::TimeDelta& current_time);
105
103 private: 106 private:
104 // MediaStreamAudioRenderer implementation. This is private since we want 107 // MediaStreamAudioRenderer implementation. This is private since we want
105 // callers to use proxy objects. 108 // callers to use proxy objects.
106 // TODO(tommi): Make the MediaStreamAudioRenderer implementation a pimpl? 109 // TODO(tommi): Make the MediaStreamAudioRenderer implementation a pimpl?
107 virtual void Start() OVERRIDE; 110 virtual void Start() OVERRIDE;
108 virtual void Play() OVERRIDE; 111 virtual void Play() OVERRIDE;
109 virtual void Pause() OVERRIDE; 112 virtual void Pause() OVERRIDE;
110 virtual void Stop() OVERRIDE; 113 virtual void Stop() OVERRIDE;
111 virtual void SetVolume(float volume) OVERRIDE; 114 virtual void SetVolume(float volume) OVERRIDE;
112 virtual base::TimeDelta GetCurrentRenderTime() const OVERRIDE; 115 virtual base::TimeDelta GetCurrentRenderTime() const OVERRIDE;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 190
188 // The sink (destination) for rendered audio. 191 // The sink (destination) for rendered audio.
189 scoped_refptr<media::AudioOutputDevice> sink_; 192 scoped_refptr<media::AudioOutputDevice> sink_;
190 193
191 // The media stream that holds the audio tracks that this renderer renders. 194 // The media stream that holds the audio tracks that this renderer renders.
192 const scoped_refptr<webrtc::MediaStreamInterface> media_stream_; 195 const scoped_refptr<webrtc::MediaStreamInterface> media_stream_;
193 196
194 // Audio data source from the browser process. 197 // Audio data source from the browser process.
195 WebRtcAudioRendererSource* source_; 198 WebRtcAudioRendererSource* source_;
196 199
197 // Protects access to |state_|, |source_| and |sink_|. 200 // Protects access to |state_|, |source_|, |sink_| and |current_time_|.
198 base::Lock lock_; 201 mutable base::Lock lock_;
199 202
200 // Ref count for the MediaPlayers which are playing audio. 203 // Ref count for the MediaPlayers which are playing audio.
201 int play_ref_count_; 204 int play_ref_count_;
202 205
203 // Ref count for the MediaPlayers which have called Start() but not Stop(). 206 // Ref count for the MediaPlayers which have called Start() but not Stop().
204 int start_ref_count_; 207 int start_ref_count_;
205 208
206 // Used to buffer data between the client and the output device in cases where 209 // 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. 210 // the client buffer size is not the same as the output device buffer size.
208 scoped_ptr<media::AudioPullFifo> audio_fifo_; 211 scoped_ptr<media::AudioPullFifo> audio_fifo_;
209 212
210 // Contains the accumulated delay estimate which is provided to the WebRTC 213 // Contains the accumulated delay estimate which is provided to the WebRTC
211 // AEC. 214 // AEC.
212 int audio_delay_milliseconds_; 215 int audio_delay_milliseconds_;
213 216
214 // Delay due to the FIFO in milliseconds. 217 // Delay due to the FIFO in milliseconds.
215 int fifo_delay_milliseconds_; 218 int fifo_delay_milliseconds_;
216 219
220 base::TimeDelta current_time_;
221
217 // Saved volume and playing state of the root renderer. 222 // Saved volume and playing state of the root renderer.
218 PlayingState playing_state_; 223 PlayingState playing_state_;
219 224
220 // Audio params used by the sink of the renderer. 225 // Audio params used by the sink of the renderer.
221 media::AudioParameters sink_params_; 226 media::AudioParameters sink_params_;
222 227
223 // Maps audio sources to a list of active audio renderers. 228 // Maps audio sources to a list of active audio renderers.
224 // Pointers to PlayingState objects are only kept in this map while the 229 // Pointers to PlayingState objects are only kept in this map while the
225 // associated renderer is actually playing the stream. Ownership of the 230 // associated renderer is actually playing the stream. Ownership of the
226 // state objects lies with the renderers and they must leave the playing state 231 // state objects lies with the renderers and they must leave the playing state
227 // before being destructed (PlayingState object goes out of scope). 232 // before being destructed (PlayingState object goes out of scope).
228 SourcePlayingStates source_playing_states_; 233 SourcePlayingStates source_playing_states_;
229 234
230 DISALLOW_IMPLICIT_CONSTRUCTORS(WebRtcAudioRenderer); 235 DISALLOW_IMPLICIT_CONSTRUCTORS(WebRtcAudioRenderer);
231 }; 236 };
232 237
233 } // namespace content 238 } // namespace content
234 239
235 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_RENDERER_H_ 240 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_RENDERER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698