| 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 "media/audio/audio_input_controller.h" | 5 #include "media/audio/audio_input_controller.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/threading/thread_restrictions.h" | 8 #include "base/threading/thread_restrictions.h" |
| 9 #include "media/base/limits.h" | 9 #include "media/base/limits.h" |
| 10 #include "media/base/scoped_histogram_timer.h" | 10 #include "media/base/scoped_histogram_timer.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 base::Bind(&AudioInputController::DoCreate, controller, | 106 base::Bind(&AudioInputController::DoCreate, controller, |
| 107 base::Unretained(audio_manager), params, device_id))) { | 107 base::Unretained(audio_manager), params, device_id))) { |
| 108 controller = NULL; | 108 controller = NULL; |
| 109 } | 109 } |
| 110 | 110 |
| 111 return controller; | 111 return controller; |
| 112 } | 112 } |
| 113 | 113 |
| 114 // static | 114 // static |
| 115 scoped_refptr<AudioInputController> AudioInputController::CreateForStream( | 115 scoped_refptr<AudioInputController> AudioInputController::CreateForStream( |
| 116 AudioManager* audio_manager, | 116 const scoped_refptr<base::MessageLoopProxy>& message_loop, |
| 117 EventHandler* event_handler, | 117 EventHandler* event_handler, |
| 118 AudioInputStream* stream, | 118 AudioInputStream* stream, |
| 119 SyncWriter* sync_writer) { | 119 SyncWriter* sync_writer) { |
| 120 DCHECK(audio_manager); | |
| 121 DCHECK(sync_writer); | 120 DCHECK(sync_writer); |
| 122 DCHECK(stream); | 121 DCHECK(stream); |
| 123 | 122 |
| 124 // Create the AudioInputController object and ensure that it runs on | 123 // Create the AudioInputController object and ensure that it runs on |
| 125 // the audio-manager thread. | 124 // the audio-manager thread. |
| 126 scoped_refptr<AudioInputController> controller(new AudioInputController( | 125 scoped_refptr<AudioInputController> controller(new AudioInputController( |
| 127 event_handler, sync_writer)); | 126 event_handler, sync_writer)); |
| 128 controller->message_loop_ = audio_manager->GetMessageLoop(); | 127 controller->message_loop_ = message_loop; |
| 129 | 128 |
| 130 // TODO(miu): See TODO at top of file. Until that's resolved, we need to | 129 // TODO(miu): See TODO at top of file. Until that's resolved, we need to |
| 131 // disable the error auto-detection here (since the audio mirroring | 130 // disable the error auto-detection here (since the audio mirroring |
| 132 // implementation will reliably report error and close events). Note, of | 131 // implementation will reliably report error and close events). Note, of |
| 133 // course, that we're assuming CreateForStream() has been called for the audio | 132 // course, that we're assuming CreateForStream() has been called for the audio |
| 134 // mirroring use case only. | 133 // mirroring use case only. |
| 135 if (!controller->message_loop_->PostTask( | 134 if (!controller->message_loop_->PostTask( |
| 136 FROM_HERE, | 135 FROM_HERE, |
| 137 base::Bind(&AudioInputController::DoCreateForStream, controller, | 136 base::Bind(&AudioInputController::DoCreateForStream, controller, |
| 138 stream, false))) { | 137 stream, false))) { |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 | 371 |
| 373 void AudioInputController::SetDataIsActive(bool enabled) { | 372 void AudioInputController::SetDataIsActive(bool enabled) { |
| 374 base::subtle::Release_Store(&data_is_active_, enabled); | 373 base::subtle::Release_Store(&data_is_active_, enabled); |
| 375 } | 374 } |
| 376 | 375 |
| 377 bool AudioInputController::GetDataIsActive() { | 376 bool AudioInputController::GetDataIsActive() { |
| 378 return (base::subtle::Acquire_Load(&data_is_active_) != false); | 377 return (base::subtle::Acquire_Load(&data_is_active_) != false); |
| 379 } | 378 } |
| 380 | 379 |
| 381 } // namespace media | 380 } // namespace media |
| OLD | NEW |