summaryrefslogtreecommitdiffstats
path: root/libs/audioflinger
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2009-08-12 05:49:58 -0700
committerEric Laurent <elaurent@google.com>2009-08-12 05:49:58 -0700
commitfe4fc91260af3c640e434c2c98516a703588ca60 (patch)
tree617394c6ff4f0f69b11a1c58a90ac3f43209a941 /libs/audioflinger
parent2ec8458c5fd5b1bfad2d6e16b606f5acbcfa34cc (diff)
downloadframeworks_base-fe4fc91260af3c640e434c2c98516a703588ca60.zip
frameworks_base-fe4fc91260af3c640e434c2c98516a703588ca60.tar.gz
frameworks_base-fe4fc91260af3c640e434c2c98516a703588ca60.tar.bz2
Workaround for issue 2046783.
Apparently the problem is caused by the fact that A2dpAudioStreamOut::standby() calls a2dp_stop() after the headset has been powered down. The workaround consists in indicating to A2DP audio hardware that a close request is pending and that stanby() must be bypassed.
Diffstat (limited to 'libs/audioflinger')
-rw-r--r--libs/audioflinger/A2dpAudioInterface.cpp14
-rw-r--r--libs/audioflinger/A2dpAudioInterface.h1
2 files changed, 13 insertions, 2 deletions
diff --git a/libs/audioflinger/A2dpAudioInterface.cpp b/libs/audioflinger/A2dpAudioInterface.cpp
index 20db8a5..57a29f2 100644
--- a/libs/audioflinger/A2dpAudioInterface.cpp
+++ b/libs/audioflinger/A2dpAudioInterface.cpp
@@ -204,7 +204,7 @@ A2dpAudioInterface::A2dpAudioStreamOut::A2dpAudioStreamOut() :
mFd(-1), mStandby(true), mStartCount(0), mRetryCount(0), mData(NULL),
// assume BT enabled to start, this is safe because its only the
// enabled->disabled transition we are worried about
- mBluetoothEnabled(true), mDevice(0)
+ mBluetoothEnabled(true), mDevice(0), mClosing(false)
{
// use any address by default
strcpy(mA2dpAddress, "00:00:00:00:00:00");
@@ -258,7 +258,7 @@ ssize_t A2dpAudioInterface::A2dpAudioStreamOut::write(const void* buffer, size_t
size_t remaining = bytes;
status_t status = -1;
- if (!mBluetoothEnabled) {
+ if (!mBluetoothEnabled || mClosing) {
LOGW("A2dpAudioStreamOut::write(), but bluetooth disabled");
goto Error;
}
@@ -307,6 +307,11 @@ status_t A2dpAudioInterface::A2dpAudioStreamOut::standby()
{
int result = 0;
+ if (mClosing) {
+ LOGV("Ignore standby, closing");
+ return result;
+ }
+
Mutex::Autolock lock(mLock);
if (!mStandby) {
@@ -335,6 +340,11 @@ status_t A2dpAudioInterface::A2dpAudioStreamOut::setParameters(const String8& ke
}
param.remove(key);
}
+ key = String8("closing");
+ if (param.get(key, value) == NO_ERROR) {
+ mClosing = (value == "true");
+ param.remove(key);
+ }
key = AudioParameter::keyRouting;
if (param.getInt(key, device) == NO_ERROR) {
if (AudioSystem::isA2dpDevice((AudioSystem::audio_devices)device)) {
diff --git a/libs/audioflinger/A2dpAudioInterface.h b/libs/audioflinger/A2dpAudioInterface.h
index d6709e2..35a6e11 100644
--- a/libs/audioflinger/A2dpAudioInterface.h
+++ b/libs/audioflinger/A2dpAudioInterface.h
@@ -112,6 +112,7 @@ private:
Mutex mLock;
bool mBluetoothEnabled;
uint32_t mDevice;
+ bool mClosing;
};
friend class A2dpAudioStreamOut;