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

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

Issue 670683003: Standardize usage of virtual/override/final in content/renderer/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 int frames_per_buffer() const { return sink_params_.frames_per_buffer(); } 102 int frames_per_buffer() const { return sink_params_.frames_per_buffer(); }
103 103
104 private: 104 private:
105 // MediaStreamAudioRenderer implementation. This is private since we want 105 // MediaStreamAudioRenderer implementation. This is private since we want
106 // callers to use proxy objects. 106 // callers to use proxy objects.
107 // TODO(tommi): Make the MediaStreamAudioRenderer implementation a pimpl? 107 // TODO(tommi): Make the MediaStreamAudioRenderer implementation a pimpl?
108 virtual void Start() override; 108 void Start() override;
109 virtual void Play() override; 109 void Play() override;
110 virtual void Pause() override; 110 void Pause() override;
111 virtual void Stop() override; 111 void Stop() override;
112 virtual void SetVolume(float volume) override; 112 void SetVolume(float volume) override;
113 virtual base::TimeDelta GetCurrentRenderTime() const override; 113 base::TimeDelta GetCurrentRenderTime() const override;
114 virtual bool IsLocalRenderer() const override; 114 bool IsLocalRenderer() const override;
115 115
116 // Called when an audio renderer, either the main or a proxy, starts playing. 116 // Called when an audio renderer, either the main or a proxy, starts playing.
117 // Here we maintain a reference count of how many renderers are currently 117 // Here we maintain a reference count of how many renderers are currently
118 // playing so that the shared play state of all the streams can be reflected 118 // playing so that the shared play state of all the streams can be reflected
119 // correctly. 119 // correctly.
120 void EnterPlayState(); 120 void EnterPlayState();
121 121
122 // Called when an audio renderer, either the main or a proxy, is paused. 122 // Called when an audio renderer, either the main or a proxy, is paused.
123 // See EnterPlayState for more details. 123 // See EnterPlayState for more details.
124 void EnterPauseState(); 124 void EnterPauseState();
125 125
126 protected: 126 protected:
127 virtual ~WebRtcAudioRenderer(); 127 ~WebRtcAudioRenderer() override;
128 128
129 private: 129 private:
130 enum State { 130 enum State {
131 UNINITIALIZED, 131 UNINITIALIZED,
132 PLAYING, 132 PLAYING,
133 PAUSED, 133 PAUSED,
134 }; 134 };
135 135
136 // Holds raw pointers to PlaingState objects. Ownership is managed outside 136 // Holds raw pointers to PlaingState objects. Ownership is managed outside
137 // of this type. 137 // of this type.
138 typedef std::vector<PlayingState*> PlayingStates; 138 typedef std::vector<PlayingState*> PlayingStates;
139 // Maps an audio source to a list of playing states that collectively hold 139 // Maps an audio source to a list of playing states that collectively hold
140 // volume information for that source. 140 // volume information for that source.
141 typedef std::map<webrtc::AudioSourceInterface*, PlayingStates> 141 typedef std::map<webrtc::AudioSourceInterface*, PlayingStates>
142 SourcePlayingStates; 142 SourcePlayingStates;
143 143
144 // Used to DCHECK that we are called on the correct thread. 144 // Used to DCHECK that we are called on the correct thread.
145 base::ThreadChecker thread_checker_; 145 base::ThreadChecker thread_checker_;
146 146
147 // Flag to keep track the state of the renderer. 147 // Flag to keep track the state of the renderer.
148 State state_; 148 State state_;
149 149
150 // media::AudioRendererSink::RenderCallback implementation. 150 // media::AudioRendererSink::RenderCallback implementation.
151 // These two methods are called on the AudioOutputDevice worker thread. 151 // These two methods are called on the AudioOutputDevice worker thread.
152 virtual int Render(media::AudioBus* audio_bus, 152 int Render(media::AudioBus* audio_bus, int audio_delay_milliseconds) override;
153 int audio_delay_milliseconds) override; 153 void OnRenderError() override;
154 virtual void OnRenderError() override;
155 154
156 // Called by AudioPullFifo when more data is necessary. 155 // Called by AudioPullFifo when more data is necessary.
157 // This method is called on the AudioOutputDevice worker thread. 156 // This method is called on the AudioOutputDevice worker thread.
158 void SourceCallback(int fifo_frame_delay, media::AudioBus* audio_bus); 157 void SourceCallback(int fifo_frame_delay, media::AudioBus* audio_bus);
159 158
160 // Goes through all renderers for the |source| and applies the proper 159 // Goes through all renderers for the |source| and applies the proper
161 // volume scaling for the source based on the volume(s) of the renderer(s). 160 // volume scaling for the source based on the volume(s) of the renderer(s).
162 void UpdateSourceVolume(webrtc::AudioSourceInterface* source); 161 void UpdateSourceVolume(webrtc::AudioSourceInterface* source);
163 162
164 // Tracks a playing state. The state must be playing when this method 163 // Tracks a playing state. The state must be playing when this method
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 // Used for triggering new UMA histogram. Counts number of render 232 // Used for triggering new UMA histogram. Counts number of render
234 // callbacks modulo |kNumCallbacksBetweenRenderTimeHistograms|. 233 // callbacks modulo |kNumCallbacksBetweenRenderTimeHistograms|.
235 int render_callback_count_; 234 int render_callback_count_;
236 235
237 DISALLOW_IMPLICIT_CONSTRUCTORS(WebRtcAudioRenderer); 236 DISALLOW_IMPLICIT_CONSTRUCTORS(WebRtcAudioRenderer);
238 }; 237 };
239 238
240 } // namespace content 239 } // namespace content
241 240
242 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_RENDERER_H_ 241 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_RENDERER_H_
OLDNEW
« no previous file with comments | « content/renderer/media/webrtc_audio_device_not_impl.h ('k') | content/renderer/media/webrtc_audio_renderer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698