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

Side by Side Diff: content/browser/renderer_host/media/audio_input_renderer_host.cc

Issue 11359196: Associate audio streams with their source/destination RenderView. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed Andrew's review comments. Created 8 years 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 #include "content/browser/renderer_host/media/audio_input_renderer_host.h" 5 #include "content/browser/renderer_host/media/audio_input_renderer_host.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/process.h" 9 #include "base/process.h"
10 #include "base/shared_memory.h" 10 #include "base/shared_memory.h"
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 176
177 DeleteEntryOnError(entry); 177 DeleteEntryOnError(entry);
178 } 178 }
179 179
180 bool AudioInputRendererHost::OnMessageReceived(const IPC::Message& message, 180 bool AudioInputRendererHost::OnMessageReceived(const IPC::Message& message,
181 bool* message_was_ok) { 181 bool* message_was_ok) {
182 bool handled = true; 182 bool handled = true;
183 IPC_BEGIN_MESSAGE_MAP_EX(AudioInputRendererHost, message, *message_was_ok) 183 IPC_BEGIN_MESSAGE_MAP_EX(AudioInputRendererHost, message, *message_was_ok)
184 IPC_MESSAGE_HANDLER(AudioInputHostMsg_StartDevice, OnStartDevice) 184 IPC_MESSAGE_HANDLER(AudioInputHostMsg_StartDevice, OnStartDevice)
185 IPC_MESSAGE_HANDLER(AudioInputHostMsg_CreateStream, OnCreateStream) 185 IPC_MESSAGE_HANDLER(AudioInputHostMsg_CreateStream, OnCreateStream)
186 IPC_MESSAGE_HANDLER(AudioInputHostMsg_AssociateStreamWithConsumer,
187 OnAssociateStreamWithConsumer)
186 IPC_MESSAGE_HANDLER(AudioInputHostMsg_RecordStream, OnRecordStream) 188 IPC_MESSAGE_HANDLER(AudioInputHostMsg_RecordStream, OnRecordStream)
187 IPC_MESSAGE_HANDLER(AudioInputHostMsg_CloseStream, OnCloseStream) 189 IPC_MESSAGE_HANDLER(AudioInputHostMsg_CloseStream, OnCloseStream)
188 IPC_MESSAGE_HANDLER(AudioInputHostMsg_SetVolume, OnSetVolume) 190 IPC_MESSAGE_HANDLER(AudioInputHostMsg_SetVolume, OnSetVolume)
189 IPC_MESSAGE_UNHANDLED(handled = false) 191 IPC_MESSAGE_UNHANDLED(handled = false)
190 IPC_END_MESSAGE_MAP_EX() 192 IPC_END_MESSAGE_MAP_EX()
191 193
192 return handled; 194 return handled;
193 } 195 }
194 void AudioInputRendererHost::OnStartDevice(int stream_id, int session_id) { 196 void AudioInputRendererHost::OnStartDevice(int stream_id, int session_id) {
195 VLOG(1) << "AudioInputRendererHost::OnStartDevice(stream_id=" 197 VLOG(1) << "AudioInputRendererHost::OnStartDevice(stream_id="
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 if (params.format() == media::AudioParameters::AUDIO_PCM_LOW_LATENCY) 269 if (params.format() == media::AudioParameters::AUDIO_PCM_LOW_LATENCY)
268 entry->controller->SetAutomaticGainControl(automatic_gain_control); 270 entry->controller->SetAutomaticGainControl(automatic_gain_control);
269 271
270 // If we have created the controller successfully create a entry and add it 272 // If we have created the controller successfully create a entry and add it
271 // to the map. 273 // to the map.
272 entry->stream_id = stream_id; 274 entry->stream_id = stream_id;
273 275
274 audio_entries_.insert(std::make_pair(stream_id, entry.release())); 276 audio_entries_.insert(std::make_pair(stream_id, entry.release()));
275 } 277 }
276 278
279 void AudioInputRendererHost::OnAssociateStreamWithConsumer(int stream_id,
280 int render_view_id) {
281 // TODO(miu): Will use render_view_id in upcoming change.
282 DVLOG(1) << "AudioInputRendererHost@" << this
283 << "::OnAssociateStreamWithConsumer(stream_id=" << stream_id
284 << ", render_view_id=" << render_view_id << ")";
285 }
286
DaleCurtis 2012/11/28 19:29:50 extra line.
miu 2012/11/28 20:59:03 Done.
287
277 void AudioInputRendererHost::OnRecordStream(int stream_id) { 288 void AudioInputRendererHost::OnRecordStream(int stream_id) {
278 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 289 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
279 290
280 AudioEntry* entry = LookupById(stream_id); 291 AudioEntry* entry = LookupById(stream_id);
281 if (!entry) { 292 if (!entry) {
282 SendErrorMessage(stream_id); 293 SendErrorMessage(stream_id);
283 return; 294 return;
284 } 295 }
285 296
286 entry->controller->Record(); 297 entry->controller->Record();
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 for (SessionEntryMap::iterator it = session_entries_.begin(); 442 for (SessionEntryMap::iterator it = session_entries_.begin();
432 it != session_entries_.end(); ++it) { 443 it != session_entries_.end(); ++it) {
433 if (stream_id == it->second) { 444 if (stream_id == it->second) {
434 return it->first; 445 return it->first;
435 } 446 }
436 } 447 }
437 return 0; 448 return 0;
438 } 449 }
439 450
440 } // namespace content 451 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698