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

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

Issue 10790121: First step towards moving AudioDevice from content/ to media/audio. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: relaxing the notreached back to log(error) since nacl tests will otherwise fail 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 #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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 AudioEntry* entry = LookupById(stream_id); 284 AudioEntry* entry = LookupById(stream_id);
285 if (!entry) { 285 if (!entry) {
286 SendErrorMessage(stream_id); 286 SendErrorMessage(stream_id);
287 return; 287 return;
288 } 288 }
289 289
290 entry->controller->SetVolume(volume); 290 entry->controller->SetVolume(volume);
291 } 291 }
292 292
293 void AudioInputRendererHost::SendErrorMessage(int stream_id) { 293 void AudioInputRendererHost::SendErrorMessage(int stream_id) {
294 Send(new AudioInputMsg_NotifyStreamStateChanged(stream_id, 294 Send(new AudioInputMsg_NotifyStreamStateChanged(
295 kAudioStreamError)); 295 stream_id, media::AudioInputDeviceIPCDelegate::kError));
296 } 296 }
297 297
298 void AudioInputRendererHost::DeleteEntries() { 298 void AudioInputRendererHost::DeleteEntries() {
299 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 299 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
300 300
301 for (AudioEntryMap::iterator i = audio_entries_.begin(); 301 for (AudioEntryMap::iterator i = audio_entries_.begin();
302 i != audio_entries_.end(); ++i) { 302 i != audio_entries_.end(); ++i) {
303 CloseAndDeleteStream(i->second); 303 CloseAndDeleteStream(i->second);
304 } 304 }
305 } 305 }
(...skipping 20 matching lines...) Expand all
326 if (it == session_entries_.end()) 326 if (it == session_entries_.end())
327 return; 327 return;
328 328
329 int stream_id = it->second; 329 int stream_id = it->second;
330 AudioEntry* entry = LookupById(stream_id); 330 AudioEntry* entry = LookupById(stream_id);
331 331
332 if (entry) { 332 if (entry) {
333 // Device has been stopped, close the input stream. 333 // Device has been stopped, close the input stream.
334 CloseAndDeleteStream(entry); 334 CloseAndDeleteStream(entry);
335 // Notify the renderer that the state of the input stream has changed. 335 // Notify the renderer that the state of the input stream has changed.
336 Send(new AudioInputMsg_NotifyStreamStateChanged(stream_id, 336 Send(new AudioInputMsg_NotifyStreamStateChanged(
337 kAudioStreamPaused)); 337 stream_id, media::AudioInputDeviceIPCDelegate::kStopped));
338 } 338 }
339 339
340 // Delete the session entry. 340 // Delete the session entry.
341 session_entries_.erase(it); 341 session_entries_.erase(it);
342 } 342 }
343 343
344 void AudioInputRendererHost::StopAndDeleteDevice(int session_id) { 344 void AudioInputRendererHost::StopAndDeleteDevice(int session_id) {
345 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 345 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
346 346
347 media_stream_manager_->audio_input_device_manager()->Stop(session_id); 347 media_stream_manager_->audio_input_device_manager()->Stop(session_id);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 407 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
408 408
409 for (SessionEntryMap::iterator it = session_entries_.begin(); 409 for (SessionEntryMap::iterator it = session_entries_.begin();
410 it != session_entries_.end(); ++it) { 410 it != session_entries_.end(); ++it) {
411 if (stream_id == it->second) { 411 if (stream_id == it->second) {
412 return it->first; 412 return it->first;
413 } 413 }
414 } 414 }
415 return 0; 415 return 0;
416 } 416 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698