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

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

Issue 17508005: Minor cleanup to remove the static thread-safe methods on BrowserMainLoop. Initially I thought this… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: revert PostTask change 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 (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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 AudioInputRendererHost::AudioEntry::AudioEntry() 43 AudioInputRendererHost::AudioEntry::AudioEntry()
44 : stream_id(0), 44 : stream_id(0),
45 shared_memory_segment_count(0), 45 shared_memory_segment_count(0),
46 pending_close(false) { 46 pending_close(false) {
47 } 47 }
48 48
49 AudioInputRendererHost::AudioEntry::~AudioEntry() {} 49 AudioInputRendererHost::AudioEntry::~AudioEntry() {}
50 50
51 AudioInputRendererHost::AudioInputRendererHost( 51 AudioInputRendererHost::AudioInputRendererHost(
52 media::AudioManager* audio_manager, 52 media::AudioManager* audio_manager,
53 MediaStreamManager* media_stream_manager) 53 MediaStreamManager* media_stream_manager,
54 AudioMirroringManager* audio_mirroring_manager)
54 : audio_manager_(audio_manager), 55 : audio_manager_(audio_manager),
55 media_stream_manager_(media_stream_manager) { 56 media_stream_manager_(media_stream_manager),
57 audio_mirroring_manager_(audio_mirroring_manager) {
56 } 58 }
57 59
58 AudioInputRendererHost::~AudioInputRendererHost() { 60 AudioInputRendererHost::~AudioInputRendererHost() {
59 DCHECK(audio_entries_.empty()); 61 DCHECK(audio_entries_.empty());
60 } 62 }
61 63
62 void AudioInputRendererHost::OnChannelClosing() { 64 void AudioInputRendererHost::OnChannelClosing() {
63 BrowserMessageFilter::OnChannelClosing(); 65 BrowserMessageFilter::OnChannelClosing();
64 66
65 // Since the IPC channel is gone, close all requested audio streams. 67 // Since the IPC channel is gone, close all requested audio streams.
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 } 266 }
265 267
266 // If we have successfully created the SyncWriter then assign it to the 268 // If we have successfully created the SyncWriter then assign it to the
267 // entry and construct an AudioInputController. 269 // entry and construct an AudioInputController.
268 entry->writer.reset(writer.release()); 270 entry->writer.reset(writer.release());
269 if (WebContentsCaptureUtil::IsWebContentsDeviceId(device_id)) { 271 if (WebContentsCaptureUtil::IsWebContentsDeviceId(device_id)) {
270 entry->controller = media::AudioInputController::CreateForStream( 272 entry->controller = media::AudioInputController::CreateForStream(
271 audio_manager_->GetWorkerLoop(), 273 audio_manager_->GetWorkerLoop(),
272 this, 274 this,
273 WebContentsAudioInputStream::Create( 275 WebContentsAudioInputStream::Create(
274 device_id, audio_params, audio_manager_->GetWorkerLoop()), 276 device_id, audio_params, audio_manager_->GetWorkerLoop(),
277 audio_mirroring_manager_),
275 entry->writer.get()); 278 entry->writer.get());
276 } else { 279 } else {
277 // TODO(henrika): replace CreateLowLatency() with Create() as soon 280 // TODO(henrika): replace CreateLowLatency() with Create() as soon
278 // as satish has ensured that Speech Input also uses the default low- 281 // as satish has ensured that Speech Input also uses the default low-
279 // latency path. See crbug.com/112472 for details. 282 // latency path. See crbug.com/112472 for details.
280 entry->controller = media::AudioInputController::CreateLowLatency( 283 entry->controller = media::AudioInputController::CreateLowLatency(
281 audio_manager_, 284 audio_manager_,
282 this, 285 this,
283 audio_params, 286 audio_params,
284 device_id, 287 device_id,
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 // TODO(hclam): Implement a faster look up method. 398 // TODO(hclam): Implement a faster look up method.
396 for (AudioEntryMap::iterator i = audio_entries_.begin(); 399 for (AudioEntryMap::iterator i = audio_entries_.begin();
397 i != audio_entries_.end(); ++i) { 400 i != audio_entries_.end(); ++i) {
398 if (controller == i->second->controller.get()) 401 if (controller == i->second->controller.get())
399 return i->second; 402 return i->second;
400 } 403 }
401 return NULL; 404 return NULL;
402 } 405 }
403 406
404 } // namespace content 407 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698