| 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/test_audio_input_controller_factory.h" | 5 #include "media/audio/test_audio_input_controller_factory.h" |
| 6 #include "media/audio/audio_file_writer.h" | 6 #include "media/audio/audio_file_writer.h" |
| 7 #include "media/audio/audio_io.h" | 7 #include "media/audio/audio_io.h" |
| 8 | 8 |
| 9 namespace media { | 9 namespace media { |
| 10 | 10 |
| 11 TestAudioInputController::TestAudioInputController( | 11 TestAudioInputController::TestAudioInputController( |
| 12 TestAudioInputControllerFactory* factory, | 12 TestAudioInputControllerFactory* factory, |
| 13 AudioManager* audio_manager, | 13 AudioManager* audio_manager, |
| 14 const AudioParameters& audio_parameters, | 14 const AudioParameters& audio_parameters, |
| 15 EventHandler* event_handler, | 15 EventHandler* event_handler, |
| 16 SyncWriter* sync_writer, | 16 SyncWriter* sync_writer, |
| 17 UserInputMonitor* user_input_monitor) | 17 UserInputMonitor* user_input_monitor, |
| 18 StreamType type) |
| 18 : AudioInputController(audio_manager->GetTaskRunner(), | 19 : AudioInputController(audio_manager->GetTaskRunner(), |
| 19 event_handler, | 20 event_handler, |
| 20 sync_writer, | 21 sync_writer, |
| 21 nullptr, | 22 nullptr, |
| 22 user_input_monitor, | 23 user_input_monitor, |
| 23 false), | 24 type), |
| 24 audio_parameters_(audio_parameters), | 25 audio_parameters_(audio_parameters), |
| 25 factory_(factory), | 26 factory_(factory), |
| 26 event_handler_(event_handler), | 27 event_handler_(event_handler), |
| 27 sync_writer_(sync_writer) {} | 28 sync_writer_(sync_writer) {} |
| 28 | 29 |
| 29 TestAudioInputController::~TestAudioInputController() { | 30 TestAudioInputController::~TestAudioInputController() { |
| 30 // Inform the factory so that it allows creating new instances in future. | 31 // Inform the factory so that it allows creating new instances in future. |
| 31 factory_->OnTestAudioInputControllerDestroyed(this); | 32 factory_->OnTestAudioInputControllerDestroyed(this); |
| 32 } | 33 } |
| 33 | 34 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 50 TestAudioInputControllerFactory::~TestAudioInputControllerFactory() { | 51 TestAudioInputControllerFactory::~TestAudioInputControllerFactory() { |
| 51 DCHECK(!controller_); | 52 DCHECK(!controller_); |
| 52 } | 53 } |
| 53 | 54 |
| 54 AudioInputController* TestAudioInputControllerFactory::Create( | 55 AudioInputController* TestAudioInputControllerFactory::Create( |
| 55 scoped_refptr<base::SingleThreadTaskRunner> task_runner, | 56 scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
| 56 AudioInputController::SyncWriter* sync_writer, | 57 AudioInputController::SyncWriter* sync_writer, |
| 57 AudioManager* audio_manager, | 58 AudioManager* audio_manager, |
| 58 AudioInputController::EventHandler* event_handler, | 59 AudioInputController::EventHandler* event_handler, |
| 59 AudioParameters params, | 60 AudioParameters params, |
| 60 UserInputMonitor* user_input_monitor) { | 61 UserInputMonitor* user_input_monitor, |
| 62 AudioInputController::StreamType type) { |
| 61 DCHECK(!controller_); // Only one test instance managed at a time. | 63 DCHECK(!controller_); // Only one test instance managed at a time. |
| 62 controller_ = | 64 controller_ = |
| 63 new TestAudioInputController(this, audio_manager, params, event_handler, | 65 new TestAudioInputController(this, audio_manager, params, event_handler, |
| 64 sync_writer, user_input_monitor); | 66 sync_writer, user_input_monitor, type); |
| 65 return controller_; | 67 return controller_; |
| 66 } | 68 } |
| 67 | 69 |
| 68 void TestAudioInputControllerFactory::OnTestAudioInputControllerDestroyed( | 70 void TestAudioInputControllerFactory::OnTestAudioInputControllerDestroyed( |
| 69 TestAudioInputController* controller) { | 71 TestAudioInputController* controller) { |
| 70 DCHECK_EQ(controller_, controller); | 72 DCHECK_EQ(controller_, controller); |
| 71 controller_ = NULL; | 73 controller_ = NULL; |
| 72 } | 74 } |
| 73 | 75 |
| 74 } // namespace media | 76 } // namespace media |
| OLD | NEW |