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

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

Issue 10835025: Plumb render view ID to media observer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/message_loop_proxy.h" 15 #include "base/message_loop_proxy.h"
16 #include "base/time.h" 16 #include "base/time.h"
17 #include "content/common/content_export.h" 17 #include "content/common/content_export.h"
18 #include "content/renderer/media/audio_input_device.h" 18 #include "content/renderer/media/audio_input_device.h"
19 #include "media/base/audio_renderer_sink.h" 19 #include "media/base/audio_renderer_sink.h"
20 #include "third_party/webrtc/modules/audio_device/main/interface/audio_device.h" 20 #include "third_party/webrtc/modules/audio_device/main/interface/audio_device.h"
21 21
22 namespace content {
23 class RenderView;
24 }
25
22 // A WebRtcAudioDeviceImpl instance implements the abstract interface 26 // A WebRtcAudioDeviceImpl instance implements the abstract interface
23 // webrtc::AudioDeviceModule which makes it possible for a user (e.g. webrtc:: 27 // webrtc::AudioDeviceModule which makes it possible for a user (e.g. webrtc::
24 // VoiceEngine) to register this class as an external AudioDeviceModule (ADM). 28 // VoiceEngine) to register this class as an external AudioDeviceModule (ADM).
25 // Then WebRtcAudioDeviceImpl::SetSessionId() needs to be called to set the 29 // Then WebRtcAudioDeviceImpl::SetSessionId() needs to be called to set the
26 // session id that tells which device to use. The user can either get the 30 // session id that tells which device to use. The user can either get the
27 // session id from the MediaStream or use a value of 1 (AudioInputDeviceManager 31 // session id from the MediaStream or use a value of 1 (AudioInputDeviceManager
28 // ::kFakeOpenSessionId), the later will open the default device without going 32 // ::kFakeOpenSessionId), the later will open the default device without going
29 // through the MediaStream. The user can then call WebRtcAudioDeviceImpl:: 33 // through the MediaStream. The user can then call WebRtcAudioDeviceImpl::
30 // StartPlayout() and WebRtcAudioDeviceImpl::StartRecording() from the render 34 // StartPlayout() and WebRtcAudioDeviceImpl::StartRecording() from the render
31 // process to initiate and start audio rendering and capturing in the browser 35 // process to initiate and start audio rendering and capturing in the browser
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 // (WebRTC client a media layer). This approach ensures that we can avoid 205 // (WebRTC client a media layer). This approach ensures that we can avoid
202 // transferring maximum levels between the renderer and the browser. 206 // transferring maximum levels between the renderer and the browser.
203 // 207 //
204 class CONTENT_EXPORT WebRtcAudioDeviceImpl 208 class CONTENT_EXPORT WebRtcAudioDeviceImpl
205 : NON_EXPORTED_BASE(public webrtc::AudioDeviceModule), 209 : NON_EXPORTED_BASE(public webrtc::AudioDeviceModule),
206 public media::AudioRendererSink::RenderCallback, 210 public media::AudioRendererSink::RenderCallback,
207 public AudioInputDevice::CaptureCallback, 211 public AudioInputDevice::CaptureCallback,
208 public AudioInputDevice::CaptureEventHandler { 212 public AudioInputDevice::CaptureEventHandler {
209 public: 213 public:
210 // Methods called on main render thread. 214 // Methods called on main render thread.
211 WebRtcAudioDeviceImpl(); 215 WebRtcAudioDeviceImpl(content::RenderView* render_view);
212 216
213 // webrtc::RefCountedModule implementation. 217 // webrtc::RefCountedModule implementation.
214 // The creator must call AddRef() after construction and use Release() 218 // The creator must call AddRef() after construction and use Release()
215 // to release the reference and delete this object. 219 // to release the reference and delete this object.
216 virtual int32_t AddRef() OVERRIDE; 220 virtual int32_t AddRef() OVERRIDE;
217 virtual int32_t Release() OVERRIDE; 221 virtual int32_t Release() OVERRIDE;
218 222
219 // We need this one to support runnable method tasks. 223 // We need this one to support runnable method tasks.
220 static bool ImplementsThreadSafeReferenceCounting() { return true; } 224 static bool ImplementsThreadSafeReferenceCounting() { return true; }
221 225
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 bool agc_is_enabled_; 453 bool agc_is_enabled_;
450 454
451 // Used for histograms of total recording and playout times. 455 // Used for histograms of total recording and playout times.
452 base::Time start_capture_time_; 456 base::Time start_capture_time_;
453 base::Time start_render_time_; 457 base::Time start_render_time_;
454 458
455 DISALLOW_COPY_AND_ASSIGN(WebRtcAudioDeviceImpl); 459 DISALLOW_COPY_AND_ASSIGN(WebRtcAudioDeviceImpl);
456 }; 460 };
457 461
458 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_DEVICE_IMPL_H_ 462 #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