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

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

Issue 15979015: Reland 15721002: Hook up the device selection to the WebAudio live audio (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed the comments. Created 7 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/logging.h" 12 #include "base/logging.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/threading/thread_checker.h" 15 #include "base/threading/thread_checker.h"
16 #include "content/common/content_export.h" 16 #include "content/common/content_export.h"
17 #include "content/renderer/media/webrtc_audio_capturer.h" 17 #include "content/renderer/media/webrtc_audio_capturer.h"
18 #include "content/renderer/media/webrtc_audio_device_not_impl.h" 18 #include "content/renderer/media/webrtc_audio_device_not_impl.h"
19 #include "content/renderer/media/webrtc_audio_renderer.h" 19 #include "content/renderer/media/webrtc_audio_renderer.h"
20 #include "media/base/audio_capturer_source.h" 20 #include "media/base/audio_capturer_source.h"
21 #include "media/base/audio_renderer_sink.h" 21 #include "media/base/audio_renderer_sink.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 then call
28 // session id from the MediaStream or use a value of 1 (AudioInputDeviceManager 28 // WebRtcAudioDeviceImpl::StartPlayout() and
29 // ::kFakeOpenSessionId), the later will open the default device without going 29 // WebRtcAudioDeviceImpl::StartRecording() from the render process to initiate
30 // through the MediaStream. The user can then call WebRtcAudioDeviceImpl:: 30 // and start audio rendering and capturing in the browser process. IPC is
31 // StartPlayout() and WebRtcAudioDeviceImpl::StartRecording() from the render 31 // utilized to set up the media streams.
32 // process to initiate and start audio rendering and capturing in the browser
33 // process. IPC is utilized to set up the media streams.
34 // 32 //
35 // Usage example: 33 // Usage example:
36 // 34 //
37 // using namespace webrtc; 35 // using namespace webrtc;
38 // 36 //
39 // { 37 // {
40 // scoped_refptr<WebRtcAudioDeviceImpl> external_adm; 38 // scoped_refptr<WebRtcAudioDeviceImpl> external_adm;
41 // external_adm = new WebRtcAudioDeviceImpl(); 39 // external_adm = new WebRtcAudioDeviceImpl();
42 // external_adm->SetSessionId(1); 40 // external_adm->SetSessionId(session_id);
43 // VoiceEngine* voe = VoiceEngine::Create(); 41 // VoiceEngine* voe = VoiceEngine::Create();
44 // VoEBase* base = VoEBase::GetInterface(voe); 42 // VoEBase* base = VoEBase::GetInterface(voe);
45 // base->Init(external_adm); 43 // base->Init(external_adm);
46 // int ch = base->CreateChannel(); 44 // int ch = base->CreateChannel();
47 // ... 45 // ...
48 // base->StartReceive(ch) 46 // base->StartReceive(ch)
49 // base->StartPlayout(ch); 47 // base->StartPlayout(ch);
50 // base->StartSending(ch); 48 // base->StartSending(ch);
51 // ... 49 // ...
52 // <== full-duplex audio session with AGC enabled ==> 50 // <== full-duplex audio session with AGC enabled ==>
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 // Stores latest microphone volume received in a CaptureData() callback. 380 // Stores latest microphone volume received in a CaptureData() callback.
383 // Range is [0, 255]. 381 // Range is [0, 255].
384 uint32_t microphone_volume_; 382 uint32_t microphone_volume_;
385 383
386 DISALLOW_COPY_AND_ASSIGN(WebRtcAudioDeviceImpl); 384 DISALLOW_COPY_AND_ASSIGN(WebRtcAudioDeviceImpl);
387 }; 385 };
388 386
389 } // namespace content 387 } // namespace content
390 388
391 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_DEVICE_IMPL_H_ 389 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_DEVICE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698