diff options
author | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-11 03:07:19 +0000 |
---|---|---|
committer | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-11 03:07:19 +0000 |
commit | 9ade381f46175dead00a1cc9ffc3328230e8c982 (patch) | |
tree | 64c6caf04643408b2e25bce192f03c9b7b93eaa2 /media/audio/audio_input_controller.cc | |
parent | adc19c0eeac9f3caaae4e35bd64e79e6b6e72a0f (diff) | |
download | chromium_src-9ade381f46175dead00a1cc9ffc3328230e8c982.zip chromium_src-9ade381f46175dead00a1cc9ffc3328230e8c982.tar.gz chromium_src-9ade381f46175dead00a1cc9ffc3328230e8c982.tar.bz2 |
Simplified AudioOutputStream interface.
1. Removed packet_size parameter from Open().
2. Removed OnClose() from the callback. Now the callback is guaranteed to be called only between Start() and Stop().
3. Added samples_per_packet in the AudioParameters struct.
BUG=39825
TEST=Unittests
Review URL: http://codereview.chromium.org/4661001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65766 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/audio/audio_input_controller.cc')
-rw-r--r-- | media/audio/audio_input_controller.cc | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/media/audio/audio_input_controller.cc b/media/audio/audio_input_controller.cc index 45ab2c4..b5c9df2b 100644 --- a/media/audio/audio_input_controller.cc +++ b/media/audio/audio_input_controller.cc @@ -8,7 +8,6 @@ namespace { const int kMaxInputChannels = 2; -const int kMaxSamplesPerPacket = media::Limits::kMaxSampleRate; } // namespace @@ -31,15 +30,12 @@ AudioInputController::~AudioInputController() { // static scoped_refptr<AudioInputController> AudioInputController::Create( EventHandler* event_handler, - AudioParameters params, - int samples_per_packet) { - if (!params.IsValid() || - (params.channels > kMaxInputChannels) || - (samples_per_packet > kMaxSamplesPerPacket) || (samples_per_packet < 0)) + AudioParameters params) { + if (!params.IsValid() || (params.channels > kMaxInputChannels)) return NULL; if (factory_) { - return factory_->Create(event_handler, params, samples_per_packet); + return factory_->Create(event_handler, params); } scoped_refptr<AudioInputController> controller(new AudioInputController( @@ -50,7 +46,7 @@ scoped_refptr<AudioInputController> AudioInputController::Create( controller->thread_.message_loop()->PostTask( FROM_HERE, NewRunnableMethod(controller.get(), &AudioInputController::DoCreate, - params, samples_per_packet)); + params)); return controller; } @@ -75,10 +71,8 @@ void AudioInputController::Close() { thread_.Stop(); } -void AudioInputController::DoCreate(AudioParameters params, - uint32 samples_per_packet) { - stream_ = AudioManager::GetAudioManager()->MakeAudioInputStream( - params, samples_per_packet); +void AudioInputController::DoCreate(AudioParameters params) { + stream_ = AudioManager::GetAudioManager()->MakeAudioInputStream(params); if (!stream_) { // TODO(satish): Define error types. |