summaryrefslogtreecommitdiffstats
path: root/libs/audioflinger
diff options
context:
space:
mode:
Diffstat (limited to 'libs/audioflinger')
-rw-r--r--libs/audioflinger/A2dpAudioInterface.cpp15
-rw-r--r--libs/audioflinger/A2dpAudioInterface.h1
-rw-r--r--libs/audioflinger/AudioFlinger.cpp17
-rw-r--r--libs/audioflinger/AudioFlinger.h5
-rw-r--r--libs/audioflinger/AudioHardwareGeneric.h2
5 files changed, 19 insertions, 21 deletions
diff --git a/libs/audioflinger/A2dpAudioInterface.cpp b/libs/audioflinger/A2dpAudioInterface.cpp
index d1b7af3..eb00f8c 100644
--- a/libs/audioflinger/A2dpAudioInterface.cpp
+++ b/libs/audioflinger/A2dpAudioInterface.cpp
@@ -131,8 +131,7 @@ status_t A2dpAudioInterface::dump(int fd, const Vector<String16>& args)
// ----------------------------------------------------------------------------
A2dpAudioInterface::A2dpAudioStreamOut::A2dpAudioStreamOut() :
- mFd(-1), mStandby(true), mStartCount(0), mRetryCount(0), mData(NULL),
- mInitialized(false)
+ mFd(-1), mStandby(true), mStartCount(0), mRetryCount(0), mData(NULL)
{
// use any address by default
strncpy(mA2dpAddress, "00:00:00:00:00:00", sizeof(mA2dpAddress));
@@ -167,13 +166,14 @@ ssize_t A2dpAudioInterface::A2dpAudioStreamOut::write(const void* buffer, size_t
status_t status = NO_INIT;
size_t remaining = bytes;
- if (!mInitialized) {
- status = a2dp_init(mA2dpAddress, 44100, 2, &mData);
+ if (!mData) {
+ status = a2dp_init(44100, 2, &mData);
if (status < 0) {
LOGE("a2dp_init failed err: %d\n", status);
+ mData = NULL;
goto Error;
}
- mInitialized = true;
+ a2dp_set_sink(mData, mA2dpAddress);
}
while (remaining > 0) {
@@ -191,7 +191,6 @@ ssize_t A2dpAudioInterface::A2dpAudioStreamOut::write(const void* buffer, size_t
return bytes;
Error:
- close();
// Simulate audio output timing in case of error
usleep(bytes * 1000000 / frameSize() / sampleRate());
@@ -218,7 +217,8 @@ status_t A2dpAudioInterface::A2dpAudioStreamOut::setAddress(const char* address)
if (strcmp(address, mA2dpAddress)) {
strcpy(mA2dpAddress, address);
- close();
+ if (mData)
+ a2dp_set_sink(mData, mA2dpAddress);
}
return NO_ERROR;
@@ -229,7 +229,6 @@ status_t A2dpAudioInterface::A2dpAudioStreamOut::close()
if (mData) {
a2dp_cleanup(mData);
mData = NULL;
- mInitialized = false;
}
return NO_ERROR;
}
diff --git a/libs/audioflinger/A2dpAudioInterface.h b/libs/audioflinger/A2dpAudioInterface.h
index 5bef5da..a56e8a0 100644
--- a/libs/audioflinger/A2dpAudioInterface.h
+++ b/libs/audioflinger/A2dpAudioInterface.h
@@ -96,7 +96,6 @@ private:
int mRetryCount;
char mA2dpAddress[20];
void* mData;
- bool mInitialized;
};
Mutex mLock;
diff --git a/libs/audioflinger/AudioFlinger.cpp b/libs/audioflinger/AudioFlinger.cpp
index 557d93b..92c40e9 100644
--- a/libs/audioflinger/AudioFlinger.cpp
+++ b/libs/audioflinger/AudioFlinger.cpp
@@ -171,13 +171,6 @@ AudioFlinger::AudioFlinger()
} else {
LOGE("Couldn't even initialize the stubbed audio hardware!");
}
-
- char value[PROPERTY_VALUE_MAX];
- property_get("ro.audio.silent", value, "0");
- if (atoi(value)) {
- LOGD("Silence is golden");
- setMasterMute(true);
- }
}
AudioFlinger::~AudioFlinger()
@@ -995,6 +988,16 @@ bool AudioFlinger::MixerThread::threadLoop()
IPCThreadState::self()->flushCommands();
mWaitWorkCV.wait(mLock);
LOGV("Audio hardware exiting standby, output %d\n", mOutputType);
+
+ if (mMasterMute == false) {
+ char value[PROPERTY_VALUE_MAX];
+ property_get("ro.audio.silent", value, "0");
+ if (atoi(value)) {
+ LOGD("Silence is golden");
+ setMasterMute(true);
+ }
+ }
+
standbyTime = systemTime() + kStandbyTimeInNsecs;
continue;
}
diff --git a/libs/audioflinger/AudioFlinger.h b/libs/audioflinger/AudioFlinger.h
index dfbb1e9..77f064b 100644
--- a/libs/audioflinger/AudioFlinger.h
+++ b/libs/audioflinger/AudioFlinger.h
@@ -223,10 +223,7 @@ private:
enum track_flags {
STEPSERVER_FAILED = 0x01, // StepServer could not acquire cblk->lock mutex
SYSTEM_FLAGS_MASK = 0x0000ffffUL,
-
- AUDIO_IN_AGC_ENABLE = AudioSystem::AGC_ENABLE << 16,
- AUDIO_IN_NS_ENABLE = AudioSystem::NS_ENABLE << 16,
- AUDIO_IN_IIR_ENABLE = AudioSystem::TX_IIR_ENABLE << 16
+ // The upper 16 bits are used for track-specific flags.
};
TrackBase(const sp<MixerThread>& mixerThread,
diff --git a/libs/audioflinger/AudioHardwareGeneric.h b/libs/audioflinger/AudioHardwareGeneric.h
index 1d58389..c949aa1 100644
--- a/libs/audioflinger/AudioHardwareGeneric.h
+++ b/libs/audioflinger/AudioHardwareGeneric.h
@@ -47,7 +47,7 @@ public:
virtual size_t bufferSize() const { return 4096; }
virtual int channelCount() const { return 2; }
virtual int format() const { return AudioSystem::PCM_16_BIT; }
- virtual uint32_t latency() const { return 0; }
+ virtual uint32_t latency() const { return 20; }
virtual status_t setVolume(float volume) { return INVALID_OPERATION; }
virtual ssize_t write(const void* buffer, size_t bytes);
virtual status_t standby();