summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPawit Pornkitprasan <p.pawit@gmail.com>2012-02-23 19:08:06 +0700
committerPawit Pornkitprasan <p.pawit@gmail.com>2012-02-23 19:08:06 +0700
commit1d85478a3cbffc1325669764496dfca96a8cc5c0 (patch)
tree12a47472f26d107c9638a6a190610f4439c5d36b
parent7ceadddfbd7a8b38ac6c0bb27bb7aecefa93bfcb (diff)
downloaddevice_samsung_aries-common-1d85478a3cbffc1325669764496dfca96a8cc5c0.zip
device_samsung_aries-common-1d85478a3cbffc1325669764496dfca96a8cc5c0.tar.gz
device_samsung_aries-common-1d85478a3cbffc1325669764496dfca96a8cc5c0.tar.bz2
aries-common: libaudio: Port fixes from Gingerbread Branch
- Properly set "Voice Communication" audio channel (it's not set in crespo ics branch for whatever reason. Changelog says it wasn't added in the first place.) - Add AudioOut wakelock (not sure why it was removed, changelog for ics branch says it wasn't added in the first place. Adding it won't hurt.)
-rw-r--r--libaudio/AudioHardware.cpp14
-rw-r--r--libaudio/AudioHardware.h1
2 files changed, 11 insertions, 4 deletions
diff --git a/libaudio/AudioHardware.cpp b/libaudio/AudioHardware.cpp
index 3d1ed1e..ac2e65d 100644
--- a/libaudio/AudioHardware.cpp
+++ b/libaudio/AudioHardware.cpp
@@ -34,6 +34,7 @@
#include "AudioHardware.h"
#include <media/AudioRecord.h>
#include <audio_effects/effect_aec.h>
+#include <hardware_legacy/power.h>
extern "C" {
#include <tinyalsa/asoundlib.h>
@@ -84,6 +85,7 @@ enum {
const char *AudioHardware::inputPathNameDefault = "Default";
const char *AudioHardware::inputPathNameCamcorder = "Camcorder";
const char *AudioHardware::inputPathNameVoiceRecognition = "Voice Recognition";
+const char *AudioHardware::inputPathNameVoiceCommunication = "Voice Communication";
AudioHardware::AudioHardware() :
mInit(false),
@@ -1171,13 +1173,13 @@ status_t AudioHardware::setInputSource_l(audio_source source)
const char* sourceName;
switch (source) {
case AUDIO_SOURCE_DEFAULT: // intended fall-through
- case AUDIO_SOURCE_MIC: // intended fall-through
- case AUDIO_SOURCE_VOICE_COMMUNICATION:
- sourceName = inputPathNameDefault;
- break;
+ case AUDIO_SOURCE_MIC:
case AUDIO_SOURCE_CAMCORDER:
sourceName = inputPathNameCamcorder;
break;
+ case AUDIO_SOURCE_VOICE_COMMUNICATION:
+ sourceName = inputPathNameVoiceCommunication;
+ break;
case AUDIO_SOURCE_VOICE_RECOGNITION:
sourceName = inputPathNameVoiceRecognition;
break;
@@ -1344,6 +1346,8 @@ ssize_t AudioHardware::AudioStreamOutALSA::write(const void* buffer, size_t byte
AutoMutex hwLock(mHardware->lock());
LOGD("AudioHardware pcm playback is exiting standby.");
+ acquire_wake_lock(PARTIAL_WAKE_LOCK, "AudioOutLock");
+
sp<AudioStreamInALSA> spIn = mHardware->getActiveInput_l();
while (spIn != 0) {
int cnt = spIn->prepareLock();
@@ -1375,6 +1379,7 @@ ssize_t AudioHardware::AudioStreamOutALSA::write(const void* buffer, size_t byte
spIn->unlock();
}
if (mPcm == NULL) {
+ release_wake_lock("AudioOutLock");
goto Error;
}
mStandby = false;
@@ -1438,6 +1443,7 @@ void AudioHardware::AudioStreamOutALSA::doStandby_l()
if (mEchoReference != NULL) {
mEchoReference->write(mEchoReference, NULL);
}
+ release_wake_lock("AudioOutLock");
mStandby = true;
}
diff --git a/libaudio/AudioHardware.h b/libaudio/AudioHardware.h
index d191f3f..2fcf4f3 100644
--- a/libaudio/AudioHardware.h
+++ b/libaudio/AudioHardware.h
@@ -86,6 +86,7 @@ public:
static const char *inputPathNameDefault;
static const char *inputPathNameCamcorder;
static const char *inputPathNameVoiceRecognition;
+ static const char *inputPathNameVoiceCommunication;
AudioHardware();
virtual ~AudioHardware();