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

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

Issue 10537121: Adds AudioDevice factory for all audio clients in Chrome (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 8 years, 5 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>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "base/message_loop_proxy.h" 16 #include "base/message_loop_proxy.h"
17 #include "base/time.h" 17 #include "base/time.h"
18 #include "content/common/content_export.h" 18 #include "content/common/content_export.h"
19 #include "content/renderer/media/audio_device.h"
20 #include "content/renderer/media/audio_input_device.h" 19 #include "content/renderer/media/audio_input_device.h"
20 #include "media/base/audio_renderer_sink.h"
21 #include "third_party/webrtc/modules/audio_device/main/interface/audio_device.h" 21 #include "third_party/webrtc/modules/audio_device/main/interface/audio_device.h"
22 22
23 // A WebRtcAudioDeviceImpl instance implements the abstract interface 23 // A WebRtcAudioDeviceImpl instance implements the abstract interface
24 // webrtc::AudioDeviceModule which makes it possible for a user (e.g. webrtc:: 24 // webrtc::AudioDeviceModule which makes it possible for a user (e.g. webrtc::
25 // VoiceEngine) to register this class as an external AudioDeviceModule (ADM). 25 // VoiceEngine) to register this class as an external AudioDeviceModule (ADM).
26 // Then WebRtcAudioDeviceImpl::SetSessionId() needs to be called to set the 26 // Then WebRtcAudioDeviceImpl::SetSessionId() needs to be called to set the
27 // session id that tells which device to use. The user can either get the 27 // session id that tells which device to use. The user can either get the
28 // session id from the MediaStream or use a value of 1 (AudioInputDeviceManager 28 // session id from the MediaStream or use a value of 1 (AudioInputDeviceManager
29 // ::kFakeOpenSessionId), the later will open the default device without going 29 // ::kFakeOpenSessionId), the later will open the default device without going
30 // through the MediaStream. The user can then call WebRtcAudioDeviceImpl:: 30 // through the MediaStream. The user can then call WebRtcAudioDeviceImpl::
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 213
214 // webrtc::RefCountedModule implementation. 214 // webrtc::RefCountedModule implementation.
215 // The creator must call AddRef() after construction and use Release() 215 // The creator must call AddRef() after construction and use Release()
216 // to release the reference and delete this object. 216 // to release the reference and delete this object.
217 virtual int32_t AddRef() OVERRIDE; 217 virtual int32_t AddRef() OVERRIDE;
218 virtual int32_t Release() OVERRIDE; 218 virtual int32_t Release() OVERRIDE;
219 219
220 // We need this one to support runnable method tasks. 220 // We need this one to support runnable method tasks.
221 static bool ImplementsThreadSafeReferenceCounting() { return true; } 221 static bool ImplementsThreadSafeReferenceCounting() { return true; }
222 222
223 // AudioDevice::RenderCallback implementation. 223 // media::AudioRendererSink::RenderCallback implementation.
224 virtual int Render(const std::vector<float*>& audio_data, 224 virtual int Render(const std::vector<float*>& audio_data,
225 int number_of_frames, 225 int number_of_frames,
226 int audio_delay_milliseconds) OVERRIDE; 226 int audio_delay_milliseconds) OVERRIDE;
227 virtual void OnRenderError() OVERRIDE; 227 virtual void OnRenderError() OVERRIDE;
228 228
229 // AudioInputDevice::CaptureCallback implementation. 229 // AudioInputDevice::CaptureCallback implementation.
230 virtual void Capture(const std::vector<float*>& audio_data, 230 virtual void Capture(const std::vector<float*>& audio_data,
231 int number_of_frames, 231 int number_of_frames,
232 int audio_delay_milliseconds, 232 int audio_delay_milliseconds,
233 double volume) OVERRIDE; 233 double volume) OVERRIDE;
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 int ref_count_; 400 int ref_count_;
401 401
402 // Gives access to the message loop of the render thread on which this 402 // Gives access to the message loop of the render thread on which this
403 // object is created. 403 // object is created.
404 scoped_refptr<base::MessageLoopProxy> render_loop_; 404 scoped_refptr<base::MessageLoopProxy> render_loop_;
405 405
406 // Provides access to the native audio input layer in the browser process. 406 // Provides access to the native audio input layer in the browser process.
407 scoped_refptr<AudioInputDevice> audio_input_device_; 407 scoped_refptr<AudioInputDevice> audio_input_device_;
408 408
409 // Provides access to the native audio output layer in the browser process. 409 // Provides access to the native audio output layer in the browser process.
410 scoped_refptr<AudioDevice> audio_output_device_; 410 scoped_refptr<media::AudioRendererSink> audio_output_device_;
411 411
412 // Weak reference to the audio callback. 412 // Weak reference to the audio callback.
413 // The webrtc client defines |audio_transport_callback_| by calling 413 // The webrtc client defines |audio_transport_callback_| by calling
414 // RegisterAudioCallback(). 414 // RegisterAudioCallback().
415 webrtc::AudioTransport* audio_transport_callback_; 415 webrtc::AudioTransport* audio_transport_callback_;
416 416
417 // Cached values of utilized audio parameters. Platform dependent. 417 // Cached values of utilized audio parameters. Platform dependent.
418 media::AudioParameters input_audio_parameters_; 418 media::AudioParameters input_audio_parameters_;
419 media::AudioParameters output_audio_parameters_; 419 media::AudioParameters output_audio_parameters_;
420 420
(...skipping 29 matching lines...) Expand all
450 bool agc_is_enabled_; 450 bool agc_is_enabled_;
451 451
452 // Used for histograms of total recording and playout times. 452 // Used for histograms of total recording and playout times.
453 base::Time start_capture_time_; 453 base::Time start_capture_time_;
454 base::Time start_render_time_; 454 base::Time start_render_time_;
455 455
456 DISALLOW_COPY_AND_ASSIGN(WebRtcAudioDeviceImpl); 456 DISALLOW_COPY_AND_ASSIGN(WebRtcAudioDeviceImpl);
457 }; 457 };
458 458
459 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_DEVICE_IMPL_H_ 459 #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