OLD | NEW |
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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(stream_id, |
295 kAudioStreamError)); | 295 media::kAudioStreamError)); |
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 21 matching lines...) Expand all Loading... |
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(stream_id, |
337 kAudioStreamPaused)); | 337 media::kAudioStreamPaused)); |
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 Loading... |
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 } |
OLD | NEW |