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

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

Issue 9655018: Make AudioParameters a class instead of a struct (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix copyright years Created 8 years, 9 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_DEVICE_IMPL_H_ 5 #ifndef CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_DEVICE_IMPL_H_
6 #define CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_DEVICE_IMPL_H_ 6 #define CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_DEVICE_IMPL_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 virtual int32_t PlayoutSampleRate(uint32_t* samples_per_sec) const OVERRIDE; 247 virtual int32_t PlayoutSampleRate(uint32_t* samples_per_sec) const OVERRIDE;
248 248
249 virtual int32_t ResetAudioDevice() OVERRIDE; 249 virtual int32_t ResetAudioDevice() OVERRIDE;
250 virtual int32_t SetLoudspeakerStatus(bool enable) OVERRIDE; 250 virtual int32_t SetLoudspeakerStatus(bool enable) OVERRIDE;
251 virtual int32_t GetLoudspeakerStatus(bool* enabled) const OVERRIDE; 251 virtual int32_t GetLoudspeakerStatus(bool* enabled) const OVERRIDE;
252 252
253 // Sets the session id. 253 // Sets the session id.
254 void SetSessionId(int session_id); 254 void SetSessionId(int session_id);
255 255
256 // Accessors. 256 // Accessors.
257 size_t input_buffer_size() const { return input_buffer_size_; } 257 size_t input_buffer_size() const {
258 size_t output_buffer_size() const { return output_buffer_size_; } 258 return input_audio_parameters_.frames_per_buffer();
259 int input_channels() const { return input_channels_; } 259 }
260 int output_channels() const { return output_channels_; } 260 size_t output_buffer_size() const {
261 int input_sample_rate() const { return static_cast<int>(input_sample_rate_); } 261 return input_audio_parameters_.frames_per_buffer();
262 }
263 int input_channels() const {
264 return input_audio_parameters_.channels();
265 }
266 int output_channels() const {
267 return output_audio_parameters_.channels();
268 }
269 int input_sample_rate() const {
270 return input_audio_parameters_.sample_rate();
271 }
262 int output_sample_rate() const { 272 int output_sample_rate() const {
263 return static_cast<int>(output_sample_rate_); 273 return output_audio_parameters_.sample_rate();
264 } 274 }
265 int input_delay_ms() const { return input_delay_ms_; } 275 int input_delay_ms() const { return input_delay_ms_; }
266 int output_delay_ms() const { return output_delay_ms_; } 276 int output_delay_ms() const { return output_delay_ms_; }
267 bool initialized() const { return initialized_; } 277 bool initialized() const { return initialized_; }
268 bool playing() const { return playing_; } 278 bool playing() const { return playing_; }
269 bool recording() const { return recording_; } 279 bool recording() const { return recording_; }
270 280
271 private: 281 private:
272 // Make destructor private to ensure that we can only be deleted by Release(). 282 // Make destructor private to ensure that we can only be deleted by Release().
273 virtual ~WebRtcAudioDeviceImpl(); 283 virtual ~WebRtcAudioDeviceImpl();
(...skipping 14 matching lines...) Expand all
288 298
289 // Provides access to the native audio output layer in the browser process. 299 // Provides access to the native audio output layer in the browser process.
290 scoped_refptr<AudioDevice> audio_output_device_; 300 scoped_refptr<AudioDevice> audio_output_device_;
291 301
292 // Weak reference to the audio callback. 302 // Weak reference to the audio callback.
293 // The webrtc client defines |audio_transport_callback_| by calling 303 // The webrtc client defines |audio_transport_callback_| by calling
294 // RegisterAudioCallback(). 304 // RegisterAudioCallback().
295 webrtc::AudioTransport* audio_transport_callback_; 305 webrtc::AudioTransport* audio_transport_callback_;
296 306
297 // Cached values of utilized audio parameters. Platform dependent. 307 // Cached values of utilized audio parameters. Platform dependent.
298 size_t input_buffer_size_; 308 AudioParameters input_audio_parameters_;
299 size_t output_buffer_size_; 309 AudioParameters output_audio_parameters_;
300 int input_channels_;
301 int output_channels_;
302 double input_sample_rate_;
303 double output_sample_rate_;
304 310
305 // Cached value of the current audio delay on the input/capture side. 311 // Cached value of the current audio delay on the input/capture side.
306 int input_delay_ms_; 312 int input_delay_ms_;
307 313
308 // Cached value of the current audio delay on the output/renderer side. 314 // Cached value of the current audio delay on the output/renderer side.
309 int output_delay_ms_; 315 int output_delay_ms_;
310 316
311 // Buffers used for temporary storage during capture/render callbacks. 317 // Buffers used for temporary storage during capture/render callbacks.
312 // Allocated during initialization to save stack. 318 // Allocated during initialization to save stack.
313 scoped_array<int16> input_buffer_; 319 scoped_array<int16> input_buffer_;
(...skipping 13 matching lines...) Expand all
327 int bytes_per_sample_; 333 int bytes_per_sample_;
328 334
329 bool initialized_; 335 bool initialized_;
330 bool playing_; 336 bool playing_;
331 bool recording_; 337 bool recording_;
332 338
333 DISALLOW_COPY_AND_ASSIGN(WebRtcAudioDeviceImpl); 339 DISALLOW_COPY_AND_ASSIGN(WebRtcAudioDeviceImpl);
334 }; 340 };
335 341
336 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_DEVICE_IMPL_H_ 342 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_DEVICE_IMPL_H_
OLDNEW
« no previous file with comments | « content/renderer/media/renderer_webaudiodevice_impl.cc ('k') | content/renderer/media/webrtc_audio_device_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698