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

Unified Diff: content/browser/renderer_host/media/audio_input_renderer_host.cc

Issue 9702019: Adds Analog Gain Control (AGC) to the WebRTC client. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/media/audio_input_renderer_host.cc
diff --git a/content/browser/renderer_host/media/audio_input_renderer_host.cc b/content/browser/renderer_host/media/audio_input_renderer_host.cc
index 85d269fb98e7a915931779925777b924acc92b64..121a5acf5c967dd9b7ead0f2b83e36595d7348b8 100644
--- a/content/browser/renderer_host/media/audio_input_renderer_host.cc
+++ b/content/browser/renderer_host/media/audio_input_renderer_host.cc
@@ -174,7 +174,6 @@ bool AudioInputRendererHost::OnMessageReceived(const IPC::Message& message,
IPC_MESSAGE_HANDLER(AudioInputHostMsg_CreateStream, OnCreateStream)
IPC_MESSAGE_HANDLER(AudioInputHostMsg_RecordStream, OnRecordStream)
IPC_MESSAGE_HANDLER(AudioInputHostMsg_CloseStream, OnCloseStream)
- IPC_MESSAGE_HANDLER(AudioInputHostMsg_GetVolume, OnGetVolume)
IPC_MESSAGE_HANDLER(AudioInputHostMsg_SetVolume, OnSetVolume)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP_EX()
@@ -200,7 +199,8 @@ void AudioInputRendererHost::OnStartDevice(int stream_id, int session_id) {
void AudioInputRendererHost::OnCreateStream(int stream_id,
const AudioParameters& params,
- const std::string& device_id) {
+ const std::string& device_id,
+ bool automatic_gain_control) {
VLOG(1) << "AudioInputRendererHost::OnCreateStream(stream_id="
<< stream_id << ")";
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
@@ -214,9 +214,11 @@ void AudioInputRendererHost::OnCreateStream(int stream_id,
// Create a new AudioEntry structure.
scoped_ptr<AudioEntry> entry(new AudioEntry());
+ uint32 mem_size = sizeof(AudioInputBufferParameters) + buffer_size;
+
// Create the shared memory and share it with the renderer process
// using a new SyncWriter object.
- if (!entry->shared_memory.CreateAndMapAnonymous(buffer_size)) {
+ if (!entry->shared_memory.CreateAndMapAnonymous(mem_size)) {
// If creation of shared memory failed then send an error message.
SendErrorMessage(stream_id);
return;
@@ -248,6 +250,9 @@ void AudioInputRendererHost::OnCreateStream(int stream_id,
return;
}
+ // Set the initial AGC state for the audio input stream.
+ entry->controller->SetAutomaticGainControl(automatic_gain_control);
+
// If we have created the controller successfully create a entry and add it
// to the map.
entry->stream_id = stream_id;
@@ -290,21 +295,7 @@ void AudioInputRendererHost::OnSetVolume(int stream_id, double volume) {
return;
}
- // TODO(henrika): TBI.
- NOTIMPLEMENTED();
-}
-
-void AudioInputRendererHost::OnGetVolume(int stream_id) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
-
- AudioEntry* entry = LookupById(stream_id);
- if (!entry) {
- SendErrorMessage(stream_id);
- return;
- }
-
- // TODO(henrika): TBI.
- NOTIMPLEMENTED();
+ entry->controller->SetVolume(volume);
}
void AudioInputRendererHost::SendErrorMessage(int stream_id) {

Powered by Google App Engine
This is Rietveld 408576698