diff options
| author | 2008-12-19 08:31:54 -0800 | |
|---|---|---|
| committer | 2008-12-19 08:31:54 -0800 | |
| commit | 772a89695f179b51d16b26c1b0d946aa3e850e70 (patch) | |
| tree | 9a9fdadd1301625f875a3c126c986c79e3363ac4 /libs/audioflinger/AudioHardwareGeneric.cpp | |
| parent | d34e59679f6a98e9e67ef4bd18da6e5a86d386bc (diff) | |
| parent | e09fd9e819c23dc90bca68375645e15544861330 (diff) | |
Merge commit 'remotes/korg/cupcake'
Conflicts:
	core/java/com/android/internal/app/AlertController.java
	core/res/res/values/strings.xml
	media/java/android/media/AudioSystem.java
	services/java/com/android/server/LocationManagerService.java
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; |