blob: d141c9ef0a658673443dc67b2840c19ae59fef84 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "media/audio/test_audio_input_controller_factory.h"
#include "media/audio/audio_io.h"
namespace media {
TestAudioInputController::TestAudioInputController(
TestAudioInputControllerFactory* factory,
EventHandler* event_handler,
SyncWriter* sync_writer)
: AudioInputController(event_handler, sync_writer),
factory_(factory),
event_handler_(event_handler) {
}
TestAudioInputController::~TestAudioInputController() {
// Inform the factory so that it allows creating new instances in future.
factory_->OnTestAudioInputControllerDestroyed(this);
}
TestAudioInputControllerFactory::TestAudioInputControllerFactory()
: controller_(NULL) {
}
AudioInputController* TestAudioInputControllerFactory::Create(
AudioInputController::EventHandler* event_handler,
AudioParameters params) {
DCHECK(!controller_); // Only one test instance managed at a time.
controller_ = new TestAudioInputController(this, event_handler, NULL);
return controller_;
}
void TestAudioInputControllerFactory::OnTestAudioInputControllerDestroyed(
TestAudioInputController* controller) {
DCHECK_EQ(controller_, controller);
controller_ = NULL;
}
} // namespace media
|