diff options
author | 2008-12-17 18:05:43 -0800 | |
---|---|---|
committer | 2008-12-17 18:05:43 -0800 | |
commit | e09fd9e819c23dc90bca68375645e15544861330 (patch) | |
tree | 9a9fdadd1301625f875a3c126c986c79e3363ac4 /libs/audioflinger/AudioHardwareGeneric.cpp | |
parent | 7c1b96a165f970a09ed239bb4fb3f1b0d8f2a407 (diff) |
Code drop from //branches/cupcake/...@124589
Diffstat (limited to 'libs/audioflinger/AudioHardwareGeneric.cpp')
-rw-r--r-- | libs/audioflinger/AudioHardwareGeneric.cpp | 46 |
1 files changed, 32 insertions, 14 deletions
diff --git a/libs/audioflinger/AudioHardwareGeneric.cpp b/libs/audioflinger/AudioHardwareGeneric.cpp index b1e5b7f334..e6a163b7c6 100644 --- a/libs/audioflinger/AudioHardwareGeneric.cpp +++ b/libs/audioflinger/AudioHardwareGeneric.cpp @@ -2,16 +2,16 @@ ** ** Copyright 2007, The Android Open Source Project ** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at ** -** http://www.apache.org/licenses/LICENSE-2.0 +** http://www.apache.org/licenses/LICENSE-2.0 ** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and ** limitations under the License. */ @@ -68,16 +68,25 @@ status_t AudioHardwareGeneric::standby() } AudioStreamOut* AudioHardwareGeneric::openOutputStream( - int format, int channelCount, uint32_t sampleRate) + int format, int channelCount, uint32_t sampleRate, status_t *status) { AutoMutex lock(mLock); // only one output stream allowed - if (mOutput) return 0; + if (mOutput) { + if (status) { + *status = INVALID_OPERATION; + } + return 0; + } // create new output stream AudioStreamOutGeneric* out = new AudioStreamOutGeneric(); - if (out->set(this, mFd, format, channelCount, sampleRate) == NO_ERROR) { + status_t lStatus = out->set(this, mFd, format, channelCount, sampleRate); + if (status) { + *status = lStatus; + } + if (lStatus == NO_ERROR) { mOutput = out; } else { delete out; @@ -90,16 +99,25 @@ void AudioHardwareGeneric::closeOutputStream(AudioStreamOutGeneric* out) { } AudioStreamIn* AudioHardwareGeneric::openInputStream( - int format, int channelCount, uint32_t sampleRate) + int format, int channelCount, uint32_t sampleRate, status_t *status) { AutoMutex lock(mLock); // only one input stream allowed - if (mInput) return 0; + if (mInput) { + if (status) { + *status = INVALID_OPERATION; + } + return 0; + } // create new output stream AudioStreamInGeneric* in = new AudioStreamInGeneric(); - if (in->set(this, mFd, format, channelCount, sampleRate) == NO_ERROR) { + status_t lStatus = in->set(this, mFd, format, channelCount, sampleRate); + if (status) { + *status = lStatus; + } + if (lStatus == NO_ERROR) { mInput = in; } else { delete in; |