summaryrefslogtreecommitdiffstats
path: root/libaudio
diff options
context:
space:
mode:
Diffstat (limited to 'libaudio')
-rw-r--r--libaudio/Android.mk10
-rw-r--r--libaudio/AudioHardware.cpp247
-rw-r--r--libaudio/AudioHardware.h7
-rw-r--r--libaudio/AudioPolicyManager.cpp1
-rw-r--r--libaudio/AudioPolicyManager.h8
-rw-r--r--libaudio/audio_policy.conf68
6 files changed, 197 insertions, 144 deletions
diff --git a/libaudio/Android.mk b/libaudio/Android.mk
index d828e89..132ba9a 100644
--- a/libaudio/Android.mk
+++ b/libaudio/Android.mk
@@ -21,25 +21,21 @@ LOCAL_MODULE_TAGS := optional
LOCAL_SHARED_LIBRARIES += libdl
LOCAL_C_INCLUDES += \
external/tinyalsa/include \
- system/media/audio_effects/include \
- system/media/audio_utils/include
+ $(call include-path-for, audio-effects) \
+ $(call include-path-for, audio-utils)
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := AudioPolicyManager.cpp
-LOCAL_SHARED_LIBRARIES := libcutils libutils libmedia
+LOCAL_SHARED_LIBRARIES := libcutils libutils
LOCAL_STATIC_LIBRARIES := libmedia_helper
LOCAL_WHOLE_STATIC_LIBRARIES := libaudiopolicy_legacy
LOCAL_MODULE := audio_policy.aries
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw
LOCAL_MODULE_TAGS := optional
-ifeq ($(BOARD_HAVE_BLUETOOTH),true)
- LOCAL_CFLAGS += -DWITH_A2DP
-endif
-
ifeq ($(BOARD_HAVE_FM_RADIO),true)
LOCAL_CFLAGS += -DHAVE_FM_RADIO
endif
diff --git a/libaudio/AudioHardware.cpp b/libaudio/AudioHardware.cpp
index 4064a95..b14296e 100644
--- a/libaudio/AudioHardware.cpp
+++ b/libaudio/AudioHardware.cpp
@@ -32,7 +32,6 @@
#include <fcntl.h>
#include "AudioHardware.h"
-#include <media/AudioRecord.h>
#include <audio_effects/effect_aec.h>
#include <hardware_legacy/power.h>
@@ -135,10 +134,10 @@ AudioHardware::~AudioHardware()
if (mSecRilLibHandle) {
if (disconnectRILD(mRilClient) != RIL_CLIENT_ERR_SUCCESS)
- LOGE("Disconnect_RILD() error");
+ ALOGE("Disconnect_RILD() error");
if (closeClientRILD(mRilClient) != RIL_CLIENT_ERR_SUCCESS)
- LOGE("CloseClient_RILD() error");
+ ALOGE("CloseClient_RILD() error");
mRilClient = 0;
@@ -159,7 +158,7 @@ void AudioHardware::loadRILD(void)
mSecRilLibHandle = dlopen("libsecril-client.so", RTLD_NOW);
if (mSecRilLibHandle) {
- LOGV("libsecril-client.so is loaded");
+ ALOGV("libsecril-client.so is loaded");
openClientRILD = (HRilClient (*)(void))
dlsym(mSecRilLibHandle, "OpenClient_RILD");
@@ -181,28 +180,28 @@ void AudioHardware::loadRILD(void)
if (!openClientRILD || !disconnectRILD || !closeClientRILD ||
!isConnectedRILD || !connectRILD ||
!setCallVolume || !setCallAudioPath || !setCallClockSync) {
- LOGE("Can't load all functions from libsecril-client.so");
+ ALOGE("Can't load all functions from libsecril-client.so");
dlclose(mSecRilLibHandle);
mSecRilLibHandle = NULL;
} else {
mRilClient = openClientRILD();
if (!mRilClient) {
- LOGE("OpenClient_RILD() error");
+ ALOGE("OpenClient_RILD() error");
dlclose(mSecRilLibHandle);
mSecRilLibHandle = NULL;
}
}
} else {
- LOGE("Can't load libsecril-client.so");
+ ALOGE("Can't load libsecril-client.so");
}
}
status_t AudioHardware::connectRILDIfRequired(void)
{
if (!mSecRilLibHandle) {
- LOGE("connectIfRequired() lib is not loaded");
+ ALOGE("connectIfRequired() lib is not loaded");
return INVALID_OPERATION;
}
@@ -211,7 +210,7 @@ status_t AudioHardware::connectRILDIfRequired(void)
}
if (connectRILD(mRilClient) != RIL_CLIENT_ERR_SUCCESS) {
- LOGE("Connect_RILD() error");
+ ALOGE("Connect_RILD() error");
return INVALID_OPERATION;
}
@@ -262,7 +261,7 @@ void AudioHardware::closeOutputStream(AudioStreamOut* out) {
{
Mutex::Autolock lock(mLock);
if (mOutput == 0 || mOutput.get() != out) {
- LOGW("Attempt to close invalid output stream");
+ ALOGW("Attempt to close invalid output stream");
return;
}
spOut = mOutput;
@@ -315,7 +314,7 @@ AudioStreamIn* AudioHardware::openInputStream(
*status = rc;
}
- LOGV("AudioHardware::openInputStream()%p", in.get());
+ ALOGV("AudioHardware::openInputStream()%p", in.get());
return in.get();
}
@@ -327,13 +326,13 @@ void AudioHardware::closeInputStream(AudioStreamIn* in) {
ssize_t index = mInputs.indexOf((AudioStreamInALSA *)in);
if (index < 0) {
- LOGW("Attempt to close invalid input stream");
+ ALOGW("Attempt to close invalid input stream");
return;
}
spIn = mInputs[index];
mInputs.removeAt(index);
}
- LOGV("AudioHardware::closeInputStream()%p", in);
+ ALOGV("AudioHardware::closeInputStream()%p", in);
spIn.clear();
}
@@ -385,7 +384,7 @@ status_t AudioHardware::setMode(int mode)
int prevMode = mMode;
status = AudioHardwareBase::setMode(mode);
- LOGV("setMode() : new %d, old %d", mMode, prevMode);
+ ALOGV("setMode() : new %d, old %d", mMode, prevMode);
if (status == NO_ERROR) {
// activate call clock in radio when entering in call mode
if (mMode == AudioSystem::MODE_IN_CALL)
@@ -398,15 +397,15 @@ status_t AudioHardware::setMode(int mode)
if (mMode == AudioSystem::MODE_IN_CALL && !mInCallAudioMode) {
if (spOut != 0) {
- LOGV("setMode() in call force output standby");
+ ALOGV("setMode() in call force output standby");
spOut->doStandby_l();
}
if (spIn != 0) {
- LOGV("setMode() in call force input standby");
+ ALOGV("setMode() in call force input standby");
spIn->doStandby_l();
}
- LOGV("setMode() openPcmOut_l()");
+ ALOGV("setMode() openPcmOut_l()");
openPcmOut_l();
openMixer_l();
setInputSource_l(AUDIO_SOURCE_DEFAULT);
@@ -420,22 +419,22 @@ status_t AudioHardware::setMode(int mode)
struct mixer_ctl *ctl= mixer_get_ctl_by_name(mMixer, "Playback Path");
TRACE_DRIVER_OUT
if (ctl != NULL) {
- LOGV("setMode() reset Playback Path to RCV");
+ ALOGV("setMode() reset Playback Path to RCV");
TRACE_DRIVER_IN(DRV_MIXER_SEL)
mixer_ctl_set_enum_by_string(ctl, "RCV");
TRACE_DRIVER_OUT
}
}
- LOGV("setMode() closePcmOut_l()");
+ ALOGV("setMode() closePcmOut_l()");
closeMixer_l();
closePcmOut_l();
if (spOut != 0) {
- LOGV("setMode() off call force output standby");
+ ALOGV("setMode() off call force output standby");
spOut->doStandby_l();
}
if (spIn != 0) {
- LOGV("setMode() off call force input standby");
+ ALOGV("setMode() off call force input standby");
spIn->doStandby_l();
}
@@ -468,7 +467,7 @@ status_t AudioHardware::setMode(int mode)
status_t AudioHardware::setMicMute(bool state)
{
- LOGV("setMicMute(%d) mMicMute %d", state, mMicMute);
+ ALOGV("setMicMute(%d) mMicMute %d", state, mMicMute);
sp<AudioStreamInALSA> spIn;
{
AutoMutex lock(mLock);
@@ -519,7 +518,7 @@ status_t AudioHardware::setParameters(const String8& keyValuePairs)
mBluetoothNrec = true;
} else {
mBluetoothNrec = false;
- LOGD("Turning noise reduction and echo cancellation off for BT "
+ ALOGD("Turning noise reduction and echo cancellation off for BT "
"headset");
}
param.remove(String8(BT_NREC_KEY));
@@ -541,7 +540,7 @@ status_t AudioHardware::setParameters(const String8& keyValuePairs)
}
if (ttyMode != mTTYMode) {
- LOGV("new tty mode %d", ttyMode);
+ ALOGV("new tty mode %d", ttyMode);
mTTYMode = ttyMode;
if (mOutput != 0 && mMode == AudioSystem::MODE_IN_CALL) {
setIncallPath_l(mOutput->device());
@@ -574,7 +573,7 @@ String8 AudioHardware::getParameters(const String8& keys)
AudioParameter request = AudioParameter(keys);
AudioParameter reply = AudioParameter();
- LOGV("getParameters() %s", keys.string());
+ ALOGV("getParameters() %s", keys.string());
return reply.toString();
}
@@ -582,16 +581,16 @@ String8 AudioHardware::getParameters(const String8& keys)
size_t AudioHardware::getInputBufferSize(uint32_t sampleRate, int format, int channelCount)
{
if (format != AudioSystem::PCM_16_BIT) {
- LOGW("getInputBufferSize bad format: %d", format);
+ ALOGW("getInputBufferSize bad format: %d", format);
return 0;
}
if (channelCount < 1 || channelCount > 2) {
- LOGW("getInputBufferSize bad channel count: %d", channelCount);
+ ALOGW("getInputBufferSize bad channel count: %d", channelCount);
return 0;
}
if (sampleRate != getInputSampleRate(sampleRate)) {
- LOGW("getInputBufferSize bad sample rate: %d", sampleRate);
+ ALOGW("getInputBufferSize bad sample rate: %d", sampleRate);
return 0;
}
@@ -609,7 +608,7 @@ status_t AudioHardware::setVoiceVolume(float volume)
void AudioHardware::setVoiceVolume_l(float volume)
{
- LOGD("### setVoiceVolume_l");
+ ALOGD("### setVoiceVolume_l");
mVoiceVol = volume;
@@ -623,33 +622,33 @@ void AudioHardware::setVoiceVolume_l(float volume)
int int_volume = (int)(volume * 5);
SoundType type;
- LOGD("### route(%d) call volume(%f)", device, volume);
+ ALOGD("### route(%d) call volume(%f)", device, volume);
switch (device) {
case AudioSystem::DEVICE_OUT_EARPIECE:
- LOGD("### earpiece call volume");
+ ALOGD("### earpiece call volume");
type = SOUND_TYPE_VOICE;
break;
case AudioSystem::DEVICE_OUT_SPEAKER:
- LOGD("### speaker call volume");
+ ALOGD("### speaker call volume");
type = SOUND_TYPE_SPEAKER;
break;
case AudioSystem::DEVICE_OUT_BLUETOOTH_SCO:
case AudioSystem::DEVICE_OUT_BLUETOOTH_SCO_HEADSET:
case AudioSystem::DEVICE_OUT_BLUETOOTH_SCO_CARKIT:
- LOGD("### bluetooth call volume");
+ ALOGD("### bluetooth call volume");
type = SOUND_TYPE_BTVOICE;
break;
case AudioSystem::DEVICE_OUT_WIRED_HEADSET:
case AudioSystem::DEVICE_OUT_WIRED_HEADPHONE: // Use receive path with 3 pole headset.
- LOGD("### headset call volume");
+ ALOGD("### headset call volume");
type = SOUND_TYPE_HEADSET;
break;
default:
- LOGW("### Call volume setting error!!!0x%08x \n", device);
+ ALOGW("### Call volume setting error!!!0x%08x \n", device);
type = SOUND_TYPE_VOICE;
break;
}
@@ -660,7 +659,7 @@ void AudioHardware::setVoiceVolume_l(float volume)
status_t AudioHardware::setMasterVolume(float volume)
{
- LOGV("Set master volume to %f.\n", volume);
+ ALOGV("Set master volume to %f.\n", volume);
// We return an error code here to let the audioflinger do in-software
// volume on top of the maximum volume that we set through the SND API.
// return error - software mixer will handle it
@@ -673,9 +672,9 @@ status_t AudioHardware::setFmVolume(float v)
mFmVolume = v;
if (mFmFd > 0) {
__u8 fmVolume = (AudioSystem::logToLinear(v) + 5) / 7;
- LOGD("%s %f %d", __func__, v, (int) fmVolume);
+ ALOGD("%s %f %d", __func__, v, (int) fmVolume);
if (ioctl(mFmFd, Si4709_IOC_VOLUME_SET, &fmVolume) < 0) {
- LOGE("set_volume_fm error.");
+ ALOGE("set_volume_fm error.");
return -EIO;
}
}
@@ -759,30 +758,30 @@ status_t AudioHardware::dump(int fd, const Vector<String16>& args)
status_t AudioHardware::setIncallPath_l(uint32_t device)
{
- LOGV("setIncallPath_l: device %x", device);
+ ALOGV("setIncallPath_l: device %x", device);
// Setup sound path for CP clocking
if ((mSecRilLibHandle) &&
(connectRILDIfRequired() == OK)) {
if (mMode == AudioSystem::MODE_IN_CALL) {
- LOGD("### incall mode route (%d)", device);
+ ALOGD("### incall mode route (%d)", device);
AudioPath path;
switch(device){
case AudioSystem::DEVICE_OUT_EARPIECE:
- LOGD("### incall mode earpiece route");
+ ALOGD("### incall mode earpiece route");
path = SOUND_AUDIO_PATH_HANDSET;
break;
case AudioSystem::DEVICE_OUT_SPEAKER:
- LOGD("### incall mode speaker route");
+ ALOGD("### incall mode speaker route");
path = SOUND_AUDIO_PATH_SPEAKER;
break;
case AudioSystem::DEVICE_OUT_BLUETOOTH_SCO:
case AudioSystem::DEVICE_OUT_BLUETOOTH_SCO_HEADSET:
case AudioSystem::DEVICE_OUT_BLUETOOTH_SCO_CARKIT:
- LOGD("### incall mode bluetooth route %s NR", mBluetoothNrec ? "" : "NO");
+ ALOGD("### incall mode bluetooth route %s NR", mBluetoothNrec ? "" : "NO");
if (mBluetoothNrec) {
path = SOUND_AUDIO_PATH_BLUETOOTH;
} else {
@@ -791,15 +790,15 @@ status_t AudioHardware::setIncallPath_l(uint32_t device)
break;
case AudioSystem::DEVICE_OUT_WIRED_HEADPHONE :
- LOGD("### incall mode headphone route");
+ ALOGD("### incall mode headphone route");
path = SOUND_AUDIO_PATH_HEADPHONE;
break;
case AudioSystem::DEVICE_OUT_WIRED_HEADSET :
- LOGD("### incall mode headset route");
+ ALOGD("### incall mode headset route");
path = SOUND_AUDIO_PATH_HEADSET;
break;
default:
- LOGW("### incall mode Error!! route = [%d]", device);
+ ALOGW("### incall mode Error!! route = [%d]", device);
path = SOUND_AUDIO_PATH_HANDSET;
break;
}
@@ -810,9 +809,9 @@ status_t AudioHardware::setIncallPath_l(uint32_t device)
TRACE_DRIVER_IN(DRV_MIXER_GET)
struct mixer_ctl *ctl= mixer_get_ctl_by_name(mMixer, "Voice Call Path");
TRACE_DRIVER_OUT
- LOGE_IF(ctl == NULL, "setIncallPath_l() could not get mixer ctl");
+ ALOGE_IF(ctl == NULL, "setIncallPath_l() could not get mixer ctl");
if (ctl != NULL) {
- LOGV("setIncallPath_l() Voice Call Path, (%x)", device);
+ ALOGV("setIncallPath_l() Voice Call Path, (%x)", device);
TRACE_DRIVER_IN(DRV_MIXER_SEL)
mixer_ctl_set_enum_by_string(ctl, getVoiceRouteFromDevice(device));
TRACE_DRIVER_OUT
@@ -825,10 +824,10 @@ status_t AudioHardware::setIncallPath_l(uint32_t device)
#ifdef HAVE_FM_RADIO
void AudioHardware::enableFMRadio() {
- LOGV("AudioHardware::enableFMRadio() Turning FM Radio ON");
+ ALOGV("AudioHardware::enableFMRadio() Turning FM Radio ON");
if (mMode == AudioSystem::MODE_IN_CALL) {
- LOGV("AudioHardware::enableFMRadio() Call is active. Delaying FM enable.");
+ ALOGV("AudioHardware::enableFMRadio() Call is active. Delaying FM enable.");
mFmResumeAfterCall = true;
}
else {
@@ -837,7 +836,7 @@ void AudioHardware::enableFMRadio() {
setInputSource_l(AUDIO_SOURCE_DEFAULT);
if (mMixer != NULL) {
- LOGV("AudioHardware::enableFMRadio() FM Radio is ON, calling setFMRadioPath_l()");
+ ALOGV("AudioHardware::enableFMRadio() FM Radio is ON, calling setFMRadioPath_l()");
setFMRadioPath_l(mOutput->device());
}
@@ -850,7 +849,7 @@ void AudioHardware::enableFMRadio() {
}
void AudioHardware::disableFMRadio() {
- LOGV("AudioHardware::disableFMRadio() Turning FM Radio OFF");
+ ALOGV("AudioHardware::disableFMRadio() Turning FM Radio OFF");
if (mMixer != NULL) {
// Disable FM radio flag to allow the codec to be turned off
@@ -878,7 +877,7 @@ void AudioHardware::disableFMRadio() {
status_t AudioHardware::setFMRadioPath_l(uint32_t device)
{
- LOGV("setFMRadioPath_l() device %x", device);
+ ALOGV("setFMRadioPath_l() device %x", device);
AudioPath path;
const char *fmpath;
@@ -889,45 +888,45 @@ status_t AudioHardware::setFMRadioPath_l(uint32_t device)
* now is an ORed value and we need to get back its original value.
*/
device -= AudioSystem::DEVICE_OUT_SPEAKER;
- LOGD("setFMRadioPath_l() device removed speaker %x", device);
+ ALOGD("setFMRadioPath_l() device removed speaker %x", device);
}
switch(device){
case AudioSystem::DEVICE_OUT_SPEAKER:
- LOGD("setFMRadioPath_l() fmradio speaker route");
+ ALOGD("setFMRadioPath_l() fmradio speaker route");
fmpath = "FMR_SPK";
break;
case AudioSystem::DEVICE_OUT_BLUETOOTH_SCO:
case AudioSystem::DEVICE_OUT_BLUETOOTH_SCO_HEADSET:
case AudioSystem::DEVICE_OUT_BLUETOOTH_SCO_CARKIT:
- LOGD("setFMRadioPath_l() fmradio bluetooth route");
+ ALOGD("setFMRadioPath_l() fmradio bluetooth route");
break;
case AudioSystem::DEVICE_OUT_WIRED_HEADSET:
case AudioSystem::DEVICE_OUT_WIRED_HEADPHONE:
- LOGD("setFMRadioPath_l() fmradio headphone route");
+ ALOGD("setFMRadioPath_l() fmradio headphone route");
fmpath = "FMR_HP";
break;
default:
- LOGE("setFMRadioPath_l() fmradio error, route = [%d]", device);
+ ALOGE("setFMRadioPath_l() fmradio error, route = [%d]", device);
fmpath = "FMR_HP";
break;
}
if (mMixer != NULL) {
- LOGV("setFMRadioPath_l() mixer is open");
+ ALOGV("setFMRadioPath_l() mixer is open");
TRACE_DRIVER_IN(DRV_MIXER_GET)
struct mixer_ctl *ctl= mixer_get_control(mMixer, "FM Radio Path", 0);
TRACE_DRIVER_OUT
if (ctl != NULL) {
- LOGV("setFMRadioPath_l() FM Radio Path, (%s)", fmpath);
+ ALOGV("setFMRadioPath_l() FM Radio Path, (%s)", fmpath);
TRACE_DRIVER_IN(DRV_MIXER_SEL)
mixer_ctl_select(ctl, fmpath);
TRACE_DRIVER_OUT
} else {
- LOGE("setFMRadioPath_l() could not get FM Radio Path mixer ctl");
+ ALOGE("setFMRadioPath_l() could not get FM Radio Path mixer ctl");
}
TRACE_DRIVER_IN(DRV_MIXER_GET)
@@ -935,17 +934,17 @@ status_t AudioHardware::setFMRadioPath_l(uint32_t device)
TRACE_DRIVER_OUT
const char *route = getOutputRouteFromDevice(device);
- LOGV("setFMRadioPath_l() Playpack Path, (%s)", route);
+ ALOGV("setFMRadioPath_l() Playpack Path, (%s)", route);
if (ctl) {
TRACE_DRIVER_IN(DRV_MIXER_SEL)
mixer_ctl_select(ctl, route);
TRACE_DRIVER_OUT
}
else {
- LOGE("setFMRadioPath_l() could not get Playback Path mixer ctl");
+ ALOGE("setFMRadioPath_l() could not get Playback Path mixer ctl");
}
} else {
- LOGE("setFMRadioPath_l() mixer is not open");
+ ALOGE("setFMRadioPath_l() mixer is not open");
}
return NO_ERROR;
@@ -954,10 +953,10 @@ status_t AudioHardware::setFMRadioPath_l(uint32_t device)
struct pcm *AudioHardware::openPcmOut_l()
{
- LOGD("openPcmOut_l() mPcmOpenCnt: %d", mPcmOpenCnt);
+ ALOGD("openPcmOut_l() mPcmOpenCnt: %d", mPcmOpenCnt);
if (mPcmOpenCnt++ == 0) {
if (mPcm != NULL) {
- LOGE("openPcmOut_l() mPcmOpenCnt == 0 and mPcm == %p\n", mPcm);
+ ALOGE("openPcmOut_l() mPcmOpenCnt == 0 and mPcm == %p\n", mPcm);
mPcmOpenCnt--;
return NULL;
}
@@ -978,7 +977,7 @@ struct pcm *AudioHardware::openPcmOut_l()
mPcm = pcm_open(0, 0, flags, &config);
TRACE_DRIVER_OUT
if (!pcm_is_ready(mPcm)) {
- LOGE("openPcmOut_l() cannot open pcm_out driver: %s\n", pcm_get_error(mPcm));
+ ALOGE("openPcmOut_l() cannot open pcm_out driver: %s\n", pcm_get_error(mPcm));
TRACE_DRIVER_IN(DRV_PCM_CLOSE)
pcm_close(mPcm);
TRACE_DRIVER_OUT
@@ -991,9 +990,9 @@ struct pcm *AudioHardware::openPcmOut_l()
void AudioHardware::closePcmOut_l()
{
- LOGD("closePcmOut_l() mPcmOpenCnt: %d", mPcmOpenCnt);
+ ALOGD("closePcmOut_l() mPcmOpenCnt: %d", mPcmOpenCnt);
if (mPcmOpenCnt == 0) {
- LOGE("closePcmOut_l() mPcmOpenCnt == 0");
+ ALOGE("closePcmOut_l() mPcmOpenCnt == 0");
return;
}
@@ -1007,10 +1006,10 @@ void AudioHardware::closePcmOut_l()
struct mixer *AudioHardware::openMixer_l()
{
- LOGV("openMixer_l() mMixerOpenCnt: %d", mMixerOpenCnt);
+ ALOGV("openMixer_l() mMixerOpenCnt: %d", mMixerOpenCnt);
if (mMixerOpenCnt++ == 0) {
if (mMixer != NULL) {
- LOGE("openMixer_l() mMixerOpenCnt == 0 and mMixer == %p\n", mMixer);
+ ALOGE("openMixer_l() mMixerOpenCnt == 0 and mMixer == %p\n", mMixer);
mMixerOpenCnt--;
return NULL;
}
@@ -1018,7 +1017,7 @@ struct mixer *AudioHardware::openMixer_l()
mMixer = mixer_open(0);
TRACE_DRIVER_OUT
if (mMixer == NULL) {
- LOGE("openMixer_l() cannot open mixer");
+ ALOGE("openMixer_l() cannot open mixer");
mMixerOpenCnt--;
return NULL;
}
@@ -1028,9 +1027,9 @@ struct mixer *AudioHardware::openMixer_l()
void AudioHardware::closeMixer_l()
{
- LOGV("closeMixer_l() mMixerOpenCnt: %d", mMixerOpenCnt);
+ ALOGV("closeMixer_l() mMixerOpenCnt: %d", mMixerOpenCnt);
if (mMixerOpenCnt == 0) {
- LOGE("closeMixer_l() mMixerOpenCnt == 0");
+ ALOGE("closeMixer_l() mMixerOpenCnt == 0");
return;
}
@@ -1160,7 +1159,7 @@ sp <AudioHardware::AudioStreamInALSA> AudioHardware::getActiveInput_l()
status_t AudioHardware::setInputSource_l(audio_source source)
{
- LOGV("setInputSource_l(%d)", source);
+ ALOGV("setInputSource_l(%d)", source);
if (source != mInputSource) {
if ((source == AUDIO_SOURCE_DEFAULT) || (mMode != AudioSystem::MODE_IN_CALL)) {
if (mMixer) {
@@ -1189,7 +1188,7 @@ status_t AudioHardware::setInputSource_l(audio_source source)
default:
return NO_INIT;
}
- LOGV("mixer_ctl_set_enum_by_string, Input Source, (%s)", sourceName);
+ ALOGV("mixer_ctl_set_enum_by_string, Input Source, (%s)", sourceName);
TRACE_DRIVER_IN(DRV_MIXER_SEL)
mixer_ctl_set_enum_by_string(ctl, sourceName);
TRACE_DRIVER_OUT
@@ -1205,7 +1204,7 @@ struct echo_reference_itfe *AudioHardware::getEchoReference(audio_format_t forma
uint32_t channelCount,
uint32_t samplingRate)
{
- LOGV("AudioHardware::getEchoReference %p", mEchoReference);
+ ALOGV("AudioHardware::getEchoReference %p", mEchoReference);
releaseEchoReference(mEchoReference);
if (mOutput != NULL) {
uint32_t wrChannelCount = popcount(mOutput->channels());
@@ -1227,7 +1226,7 @@ struct echo_reference_itfe *AudioHardware::getEchoReference(audio_format_t forma
void AudioHardware::releaseEchoReference(struct echo_reference_itfe *reference)
{
- LOGV("AudioHardware::releaseEchoReference %p", mEchoReference);
+ ALOGV("AudioHardware::releaseEchoReference %p", mEchoReference);
if (mEchoReference != NULL && reference == mEchoReference) {
if (mOutput != NULL) {
mOutput->removeEchoReference(reference);
@@ -1302,7 +1301,7 @@ int AudioHardware::AudioStreamOutALSA::getPlaybackDelay(size_t frames,
buffer->time_stamp.tv_sec = 0;
buffer->time_stamp.tv_nsec = 0;
buffer->delay_ns = 0;
- LOGV("getPlaybackDelay(): pcm_get_htimestamp error, setting playbackTimestamp to 0");
+ ALOGV("getPlaybackDelay(): pcm_get_htimestamp error, setting playbackTimestamp to 0");
return rc;
}
@@ -1313,7 +1312,7 @@ int AudioHardware::AudioStreamOutALSA::getPlaybackDelay(size_t frames,
// sample being written.
long delayNs = (long)(((int64_t)(kernelFr + frames)* 1000000000) /AUDIO_HW_OUT_SAMPLERATE);
- LOGV("AudioStreamOutALSA::getPlaybackDelay delayNs: [%ld], "\
+ ALOGV("AudioStreamOutALSA::getPlaybackDelay delayNs: [%ld], "\
"kernelFr:[%d], frames:[%d], buffSize:[%d], time_stamp:[%ld].[%ld]",
delayNs, (int)kernelFr, (int)frames, pcm_get_buffer_size(mPcm),
(long)buffer->time_stamp.tv_sec, buffer->time_stamp.tv_nsec);
@@ -1325,7 +1324,7 @@ int AudioHardware::AudioStreamOutALSA::getPlaybackDelay(size_t frames,
ssize_t AudioHardware::AudioStreamOutALSA::write(const void* buffer, size_t bytes)
{
- //LOGV("-----AudioStreamInALSA::write(%p, %d) START", buffer, (int)bytes);
+ //ALOGV("-----AudioStreamInALSA::write(%p, %d) START", buffer, (int)bytes);
status_t status = NO_INIT;
const uint8_t* p = static_cast<const uint8_t*>(buffer);
int ret;
@@ -1345,7 +1344,7 @@ ssize_t AudioHardware::AudioStreamOutALSA::write(const void* buffer, size_t byte
if (mStandby) {
AutoMutex hwLock(mHardware->lock());
- LOGD("AudioHardware pcm playback is exiting standby.");
+ ALOGD("AudioHardware pcm playback is exiting standby.");
acquire_wake_lock(PARTIAL_WAKE_LOCK, "AudioOutLock");
sp<AudioStreamInALSA> spIn = mHardware->getActiveInput_l();
@@ -1359,7 +1358,7 @@ ssize_t AudioHardware::AudioStreamOutALSA::write(const void* buffer, size_t byte
// while the mutex is released
if ((spIn == mHardware->getActiveInput_l()) &&
(cnt == spIn->standbyCnt())) {
- LOGV("AudioStreamOutALSA::write() force input standby");
+ ALOGV("AudioStreamOutALSA::write() force input standby");
spIn->close_l();
break;
}
@@ -1399,10 +1398,10 @@ ssize_t AudioHardware::AudioStreamOutALSA::write(const void* buffer, size_t byte
TRACE_DRIVER_OUT
if (ret == 0) {
- //LOGV("-----AudioStreamInALSA::write(%p, %d) END", buffer, (int)bytes);
+ //ALOGV("-----AudioStreamInALSA::write(%p, %d) END", buffer, (int)bytes);
return bytes;
}
- LOGW("write error: %d", errno);
+ ALOGW("write error: %d", errno);
status = -errno;
}
Error:
@@ -1410,7 +1409,7 @@ Error:
// Simulate audio output timing in case of error
usleep((((bytes * 1000) / frameSize()) * 1000) / sampleRate());
- LOGE("AudioStreamOutALSA::write END WITH ERROR !!!!!!!!!(%p, %u)", buffer, bytes);
+ ALOGE("AudioStreamOutALSA::write END WITH ERROR !!!!!!!!!(%p, %u)", buffer, bytes);
return status;
}
@@ -1438,7 +1437,7 @@ void AudioHardware::AudioStreamOutALSA::doStandby_l()
mStandbyCnt++;
if (!mStandby) {
- LOGD("AudioHardware pcm playback is going to standby.");
+ ALOGD("AudioHardware pcm playback is going to standby.");
// stop echo reference capture
if (mEchoReference != NULL) {
mEchoReference->write(mEchoReference, NULL);
@@ -1465,7 +1464,7 @@ void AudioHardware::AudioStreamOutALSA::close_l()
status_t AudioHardware::AudioStreamOutALSA::open_l()
{
- LOGV("open pcm_out driver");
+ ALOGV("open pcm_out driver");
mPcm = mHardware->openPcmOut_l();
if (mPcm == NULL) {
return NO_INIT;
@@ -1473,14 +1472,14 @@ status_t AudioHardware::AudioStreamOutALSA::open_l()
mMixer = mHardware->openMixer_l();
if (mMixer) {
- LOGV("open playback normal");
+ ALOGV("open playback normal");
TRACE_DRIVER_IN(DRV_MIXER_GET)
mRouteCtl = mixer_get_ctl_by_name(mMixer, "Playback Path");
TRACE_DRIVER_OUT
}
if (mHardware->mode() != AudioSystem::MODE_IN_CALL) {
const char *route = mHardware->getOutputRouteFromDevice(mDevices);
- LOGV("write() wakeup setting route %s", route);
+ ALOGV("write() wakeup setting route %s", route);
if (mRouteCtl) {
TRACE_DRIVER_IN(DRV_MIXER_SEL)
mixer_ctl_set_enum_by_string(mRouteCtl, route);
@@ -1539,7 +1538,7 @@ status_t AudioHardware::AudioStreamOutALSA::setParameters(const String8& keyValu
AudioParameter param = AudioParameter(keyValuePairs);
status_t status = NO_ERROR;
int device;
- LOGD("AudioStreamOutALSA::setParameters() %s", keyValuePairs.string());
+ ALOGD("AudioStreamOutALSA::setParameters() %s", keyValuePairs.string());
if (mHardware == NULL) return NO_INIT;
@@ -1585,7 +1584,7 @@ String8 AudioHardware::AudioStreamOutALSA::getParameters(const String8& keys)
param.addInt(key, (int)mDevices);
}
- LOGV("AudioStreamOutALSA::getParameters() %s", param.toString().string());
+ ALOGV("AudioStreamOutALSA::getParameters() %s", param.toString().string());
return param.toString();
}
@@ -1615,7 +1614,7 @@ void AudioHardware::AudioStreamOutALSA::unlock() {
void AudioHardware::AudioStreamOutALSA::addEchoReference(struct echo_reference_itfe *reference)
{
- LOGV("AudioStreamOutALSA::addEchoReference %p", mEchoReference);
+ ALOGV("AudioStreamOutALSA::addEchoReference %p", mEchoReference);
if (mEchoReference == NULL) {
mEchoReference = reference;
}
@@ -1623,7 +1622,7 @@ void AudioHardware::AudioStreamOutALSA::addEchoReference(struct echo_reference_i
void AudioHardware::AudioStreamOutALSA::removeEchoReference(struct echo_reference_itfe *reference)
{
- LOGV("AudioStreamOutALSA::removeEchoReference %p", mEchoReference);
+ ALOGV("AudioStreamOutALSA::removeEchoReference %p", mEchoReference);
if (mEchoReference == reference) {
mEchoReference->write(mEchoReference, NULL);
mEchoReference = NULL;
@@ -1671,7 +1670,7 @@ status_t AudioHardware::AudioStreamInALSA::set(
mHardware = hw;
- LOGV("AudioStreamInALSA::set(%d, %d, %u)", *pFormat, *pChannels, *pRate);
+ ALOGV("AudioStreamInALSA::set(%d, %d, %u)", *pFormat, *pChannels, *pRate);
mBufferSize = getBufferSize(*pRate, AudioSystem::popCount(*pChannels));
mDevices = devices;
@@ -1689,7 +1688,7 @@ status_t AudioHardware::AudioStreamInALSA::set(
&mBufferProvider.mProvider,
&mDownSampler);
if (status != 0) {
- LOGW("AudioStreamInALSA::set() downsampler init failed: %d", status);
+ ALOGW("AudioStreamInALSA::set() downsampler init failed: %d", status);
mDownSampler = NULL;
return status;
}
@@ -1758,7 +1757,7 @@ ssize_t AudioHardware::AudioStreamInALSA::processFrames(void* buffer, ssize_t fr
mProcBufSize = (size_t)frames;
mProcBuf = (int16_t *)realloc(mProcBuf,
mProcBufSize * mChannelCount * sizeof(int16_t));
- LOGV("processFrames(): mProcBuf %p size extended to %d frames",
+ ALOGV("processFrames(): mProcBuf %p size extended to %d frames",
mProcBuf, mProcBufSize);
}
ssize_t framesRd = readFrames(mProcBuf + mProcFramesIn * mChannelCount,
@@ -1815,7 +1814,7 @@ int32_t AudioHardware::AudioStreamInALSA::updateEchoReference(size_t frames)
struct echo_reference_buffer b;
b.delay_ns = 0;
- LOGV("updateEchoReference1 START, frames = [%d], mRefFramesIn = [%d], b.frame_count = [%d]",
+ ALOGV("updateEchoReference1 START, frames = [%d], mRefFramesIn = [%d], b.frame_count = [%d]",
frames, mRefFramesIn, frames - mRefFramesIn);
if (mRefFramesIn < frames) {
if (mRefBufSize < frames) {
@@ -1832,12 +1831,12 @@ int32_t AudioHardware::AudioStreamInALSA::updateEchoReference(size_t frames)
if (mEchoReference->read(mEchoReference, &b) == NO_ERROR)
{
mRefFramesIn += b.frame_count;
- LOGV("updateEchoReference2: mRefFramesIn:[%d], mRefBufSize:[%d], "\
+ ALOGV("updateEchoReference2: mRefFramesIn:[%d], mRefBufSize:[%d], "\
"frames:[%d], b.frame_count:[%d]", mRefFramesIn, mRefBufSize,frames,b.frame_count);
}
}else{
- LOGV("updateEchoReference3: NOT enough frames to read ref buffer");
+ ALOGV("updateEchoReference3: NOT enough frames to read ref buffer");
}
return b.delay_ns;
}
@@ -1869,7 +1868,7 @@ void AudioHardware::AudioStreamInALSA::pushEchoReference(size_t frames)
mRefFramesIn -= refBuf.frameCount;
if (mRefFramesIn) {
- LOGV("pushEchoReference5: shifting mRefBuf down by = %d frames", mRefFramesIn);
+ ALOGV("pushEchoReference5: shifting mRefBuf down by = %d frames", mRefFramesIn);
memcpy(mRefBuf,
mRefBuf + refBuf.frameCount * mChannelCount,
mRefFramesIn * mChannelCount * sizeof(int16_t));
@@ -1887,7 +1886,7 @@ status_t AudioHardware::AudioStreamInALSA::setPreProcessorEchoDelay(effect_handl
*(uint32_t *)param->data = AEC_PARAM_ECHO_DELAY;
*((int32_t *)param->data + 1) = delayUs;
- LOGV("setPreProcessorEchoDelay: %d us", delayUs);
+ ALOGV("setPreProcessorEchoDelay: %d us", delayUs);
return setPreprocessorParam(handle, param);
}
@@ -1922,7 +1921,7 @@ void AudioHardware::AudioStreamInALSA::getCaptureDelay(size_t frames,
buffer->time_stamp.tv_sec = 0;
buffer->time_stamp.tv_nsec = 0;
buffer->delay_ns = 0;
- LOGW("read getCaptureDelay(): pcm_htimestamp error");
+ ALOGW("read getCaptureDelay(): pcm_htimestamp error");
return;
}
@@ -1944,7 +1943,7 @@ void AudioHardware::AudioStreamInALSA::getCaptureDelay(size_t frames,
buffer->time_stamp = tstamp;
buffer->delay_ns = delayNs;
- LOGV("AudioStreamInALSA::getCaptureDelay TimeStamp = [%ld].[%ld], delayCaptureNs: [%d],"\
+ ALOGV("AudioStreamInALSA::getCaptureDelay TimeStamp = [%ld].[%ld], delayCaptureNs: [%d],"\
" kernelDelay:[%ld], bufDelay:[%ld], rsmpDelay:[%ld], kernelFr:[%d], "\
"mInputFramesIn:[%d], mProcFramesIn:[%d], frames:[%d]",
buffer->time_stamp.tv_sec , buffer->time_stamp.tv_nsec, buffer->delay_ns,
@@ -1954,7 +1953,7 @@ void AudioHardware::AudioStreamInALSA::getCaptureDelay(size_t frames,
ssize_t AudioHardware::AudioStreamInALSA::read(void* buffer, ssize_t bytes)
{
- //LOGV("-----AudioStreamInALSA::read(%p, %d) START", buffer, (int)bytes);
+ //ALOGV("-----AudioStreamInALSA::read(%p, %d) START", buffer, (int)bytes);
status_t status = NO_INIT;
if (mHardware == NULL) return NO_INIT;
@@ -1971,7 +1970,7 @@ ssize_t AudioHardware::AudioStreamInALSA::read(void* buffer, ssize_t bytes)
if (mStandby) {
AutoMutex hwLock(mHardware->lock());
- LOGD("AudioHardware pcm capture is exiting standby.");
+ ALOGD("AudioHardware pcm capture is exiting standby.");
sp<AudioStreamOutALSA> spOut = mHardware->output();
while (spOut != 0) {
spOut->prepareLock();
@@ -1992,13 +1991,13 @@ ssize_t AudioHardware::AudioStreamInALSA::read(void* buffer, ssize_t bytes)
// open output before input
if (spOut != 0) {
if (!spOut->checkStandby()) {
- LOGV("AudioStreamInALSA::read() force output standby");
+ ALOGV("AudioStreamInALSA::read() force output standby");
spOut->close_l();
if (spOut->open_l() != NO_ERROR) {
spOut->doStandby_l();
}
}
- LOGV("AudioStreamInALSA exit standby mNeedEchoReference %d mEchoReference %p",
+ ALOGV("AudioStreamInALSA exit standby mNeedEchoReference %d mEchoReference %p",
mNeedEchoReference, mEchoReference);
if (mNeedEchoReference && mEchoReference == NULL) {
mEchoReference = mHardware->getEchoReference(AUDIO_FORMAT_PCM_16_BIT,
@@ -2026,11 +2025,11 @@ ssize_t AudioHardware::AudioStreamInALSA::read(void* buffer, ssize_t bytes)
}
if (framesRd >= 0) {
- //LOGV("-----AudioStreamInALSA::read(%p, %d) END", buffer, (int)bytes);
+ //ALOGV("-----AudioStreamInALSA::read(%p, %d) END", buffer, (int)bytes);
return framesRd * mChannelCount * sizeof(int16_t);
}
- LOGW("read error: %d", (int)framesRd);
+ ALOGW("read error: %d", (int)framesRd);
status = framesRd;
}
@@ -2040,7 +2039,7 @@ Error:
// Simulate audio output timing in case of error
usleep((((bytes * 1000) / frameSize()) * 1000) / sampleRate());
- LOGE("-----AudioStreamInALSA::read(%p, %d) END ERROR", buffer, (int)bytes);
+ ALOGE("-----AudioStreamInALSA::read(%p, %d) END ERROR", buffer, (int)bytes);
return status;
}
@@ -2067,7 +2066,7 @@ void AudioHardware::AudioStreamInALSA::doStandby_l()
mStandbyCnt++;
if (!mStandby) {
- LOGD("AudioHardware pcm capture is going to standby.");
+ ALOGD("AudioHardware pcm capture is going to standby.");
if (mEchoReference != NULL) {
// stop reading from echo reference
mEchoReference->read(mEchoReference, NULL);
@@ -2129,12 +2128,12 @@ status_t AudioHardware::AudioStreamInALSA::open_l()
silence_threshold : 0,
};
- LOGV("open pcm_in driver");
+ ALOGV("open pcm_in driver");
TRACE_DRIVER_IN(DRV_PCM_OPEN)
mPcm = pcm_open(0, 0, flags, &config);
TRACE_DRIVER_OUT
if (!pcm_is_ready(mPcm)) {
- LOGE("cannot open pcm_in driver: %s\n", pcm_get_error(mPcm));
+ ALOGE("cannot open pcm_in driver: %s\n", pcm_get_error(mPcm));
TRACE_DRIVER_IN(DRV_PCM_CLOSE)
pcm_close(mPcm);
TRACE_DRIVER_OUT
@@ -2161,7 +2160,7 @@ status_t AudioHardware::AudioStreamInALSA::open_l()
if (mHardware->mode() != AudioSystem::MODE_IN_CALL) {
const char *route = mHardware->getInputRouteFromDevice(mDevices);
- LOGV("read() wakeup setting route %s", route);
+ ALOGV("read() wakeup setting route %s", route);
if (mRouteCtl) {
TRACE_DRIVER_IN(DRV_MIXER_SEL)
mixer_ctl_set_enum_by_string(mRouteCtl, route);
@@ -2219,7 +2218,7 @@ status_t AudioHardware::AudioStreamInALSA::setParameters(const String8& keyValue
status_t status = NO_ERROR;
int value;
- LOGD("AudioStreamInALSA::setParameters() %s", keyValuePairs.string());
+ ALOGD("AudioStreamInALSA::setParameters() %s", keyValuePairs.string());
if (mHardware == NULL) return NO_INIT;
@@ -2273,25 +2272,25 @@ String8 AudioHardware::AudioStreamInALSA::getParameters(const String8& keys)
param.addInt(key, (int)mDevices);
}
- LOGV("AudioStreamInALSA::getParameters() %s", param.toString().string());
+ ALOGV("AudioStreamInALSA::getParameters() %s", param.toString().string());
return param.toString();
}
status_t AudioHardware::AudioStreamInALSA::addAudioEffect(effect_handle_t effect)
{
- LOGV("AudioStreamInALSA::addAudioEffect() %p", effect);
+ ALOGV("AudioStreamInALSA::addAudioEffect() %p", effect);
effect_descriptor_t desc;
status_t status = (*effect)->get_descriptor(effect, &desc);
if (status == 0) {
if (memcmp(&desc.type, FX_IID_AEC, sizeof(effect_uuid_t)) == 0) {
- LOGV("AudioStreamInALSA::addAudioEffect() mNeedEchoReference true");
+ ALOGV("AudioStreamInALSA::addAudioEffect() mNeedEchoReference true");
mNeedEchoReference = true;
standby();
}
- LOGV("AudioStreamInALSA::addAudioEffect() name %s", desc.name);
+ ALOGV("AudioStreamInALSA::addAudioEffect() name %s", desc.name);
} else {
- LOGV("AudioStreamInALSA::addAudioEffect() get_descriptor() error");
+ ALOGV("AudioStreamInALSA::addAudioEffect() get_descriptor() error");
}
AutoMutex lock(mLock);
@@ -2302,7 +2301,7 @@ status_t AudioHardware::AudioStreamInALSA::addAudioEffect(effect_handle_t effect
status_t AudioHardware::AudioStreamInALSA::removeAudioEffect(effect_handle_t effect)
{
status_t status = INVALID_OPERATION;
- LOGV("AudioStreamInALSA::removeAudioEffect() %p", effect);
+ ALOGV("AudioStreamInALSA::removeAudioEffect() %p", effect);
{
AutoMutex lock(mLock);
for (size_t i = 0; i < mPreprocessors.size(); i++) {
@@ -2318,7 +2317,7 @@ status_t AudioHardware::AudioStreamInALSA::removeAudioEffect(effect_handle_t eff
effect_descriptor_t desc;
if ((*effect)->get_descriptor(effect, &desc) == 0) {
if (memcmp(&desc.type, FX_IID_AEC, sizeof(effect_uuid_t)) == 0) {
- LOGV("AudioStreamInALSA::removeAudioEffect() mNeedEchoReference false");
+ ALOGV("AudioStreamInALSA::removeAudioEffect() mNeedEchoReference false");
mNeedEchoReference = false;
standby();
}
@@ -2392,7 +2391,7 @@ size_t AudioHardware::AudioStreamInALSA::getBufferSize(uint32_t sampleRate, int
}
// this should never happen as getBufferSize() is always called after getInputSampleRate()
// that checks for valid sampling rates.
- LOGE("AudioStreamInALSA::getBufferSize() invalid sampling rate %d", sampleRate);
+ ALOGE("AudioStreamInALSA::getBufferSize() invalid sampling rate %d", sampleRate);
return 0;
}
diff --git a/libaudio/AudioHardware.h b/libaudio/AudioHardware.h
index 2fcf4f3..4d2e2eb 100644
--- a/libaudio/AudioHardware.h
+++ b/libaudio/AudioHardware.h
@@ -24,7 +24,6 @@
#include <utils/SortedVector.h>
#include <hardware_legacy/AudioHardwareBase.h>
-#include <media/mediarecorder.h>
#include <hardware/audio_effect.h>
#include "secril-client.h"
@@ -48,7 +47,7 @@ namespace android_audio_legacy {
using android::Vector;
// TODO: determine actual audio DSP and hardware latency
-// Additionnal latency introduced by audio DSP and hardware in ms
+// Additional latency introduced by audio DSP and hardware in ms
#define AUDIO_HW_OUT_LATENCY_MS 0
// Default audio output sample rate
#define AUDIO_HW_OUT_SAMPLERATE 44100
@@ -57,8 +56,8 @@ namespace android_audio_legacy {
// Default audio output sample format
#define AUDIO_HW_OUT_FORMAT (AudioSystem::PCM_16_BIT)
// Kernel pcm out buffer size in frames at 44.1kHz
-#define AUDIO_HW_OUT_PERIOD_SZ 1024
-#define AUDIO_HW_OUT_PERIOD_CNT 4
+#define AUDIO_HW_OUT_PERIOD_SZ 880
+#define AUDIO_HW_OUT_PERIOD_CNT 2
// Default audio output buffer size in bytes
#define AUDIO_HW_OUT_PERIOD_BYTES (AUDIO_HW_OUT_PERIOD_SZ * 2 * sizeof(int16_t))
diff --git a/libaudio/AudioPolicyManager.cpp b/libaudio/AudioPolicyManager.cpp
index bfa6c00..ce99972 100644
--- a/libaudio/AudioPolicyManager.cpp
+++ b/libaudio/AudioPolicyManager.cpp
@@ -18,7 +18,6 @@
//#define LOG_NDEBUG 0
#include <utils/Log.h>
#include "AudioPolicyManager.h"
-#include <media/mediarecorder.h>
namespace android_audio_legacy {
diff --git a/libaudio/AudioPolicyManager.h b/libaudio/AudioPolicyManager.h
index d660e78..5062ff0 100644
--- a/libaudio/AudioPolicyManager.h
+++ b/libaudio/AudioPolicyManager.h
@@ -34,13 +34,5 @@ public:
virtual ~AudioPolicyManager() {}
-protected:
- // true is current platform implements a back microphone
- virtual bool hasBackMicrophone() const { return false; }
-#ifdef WITH_A2DP
- // true is current platform supports duplication of notifications and ringtones over A2DP output
- virtual bool a2dpUsedForSonification() const { return true; }
-#endif
-
};
};
diff --git a/libaudio/audio_policy.conf b/libaudio/audio_policy.conf
new file mode 100644
index 0000000..9e980a0
--- /dev/null
+++ b/libaudio/audio_policy.conf
@@ -0,0 +1,68 @@
+# Global configuration section: lists input and output devices always present on the device
+# as well as the output device selected by default.
+# Devices are designated by a string that corresponds to the enum in audio.h
+
+global_configuration {
+ attached_output_devices AUDIO_DEVICE_OUT_EARPIECE|AUDIO_DEVICE_OUT_SPEAKER
+ default_output_device AUDIO_DEVICE_OUT_SPEAKER
+ attached_input_devices AUDIO_DEVICE_IN_BUILTIN_MIC
+}
+
+# audio hardware module section: contains descriptors for all audio hw modules present on the
+# device. Each hw module node is named after the corresponding hw module library base name.
+# For instance, "primary" corresponds to audio.primary.<device>.so.
+# The "primary" module is mandatory and must include at least one output with
+# AUDIO_OUTPUT_FLAG_PRIMARY flag.
+# Each module descriptor contains one or more output profile descriptors and zero or more
+# input profile descriptors. Each profile lists all the parameters supported by a given output
+# or input stream category.
+# The "channel_masks", "formats", "devices" and "flags" are specified using strings corresponding
+# to enums in audio.h and audio_policy.h. They are concatenated by use of "|" without space or "\n".
+
+audio_hw_modules {
+ primary {
+ outputs {
+ primary {
+ sampling_rates 44100
+ channel_masks AUDIO_CHANNEL_OUT_STEREO
+ formats AUDIO_FORMAT_PCM_16_BIT
+ devices AUDIO_DEVICE_OUT_EARPIECE|AUDIO_DEVICE_OUT_SPEAKER|AUDIO_DEVICE_OUT_WIRED_HEADSET|AUDIO_DEVICE_OUT_WIRED_HEADPHONE|AUDIO_DEVICE_OUT_ALL_SCO
+ flags AUDIO_OUTPUT_FLAG_PRIMARY
+ }
+ }
+ inputs {
+ primary {
+ sampling_rates 8000|11025|16000|22050|32000|44100
+ channel_masks AUDIO_CHANNEL_IN_MONO|AUDIO_CHANNEL_IN_STEREO
+ formats AUDIO_FORMAT_PCM_16_BIT
+ devices AUDIO_DEVICE_IN_BUILTIN_MIC|AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET|AUDIO_DEVICE_IN_WIRED_HEADSET
+ }
+ }
+ }
+ a2dp {
+ outputs {
+ a2dp {
+ sampling_rates 44100
+ channel_masks AUDIO_CHANNEL_OUT_STEREO
+ formats AUDIO_FORMAT_PCM_16_BIT
+ devices AUDIO_DEVICE_OUT_ALL_A2DP
+ }
+ }
+ }
+ usb {
+ outputs {
+ usb_accessory {
+ sampling_rates 44100
+ channel_masks AUDIO_CHANNEL_OUT_STEREO
+ formats AUDIO_FORMAT_PCM_16_BIT
+ devices AUDIO_DEVICE_OUT_USB_ACCESSORY
+ }
+ usb_device {
+ sampling_rates 44100
+ channel_masks AUDIO_CHANNEL_OUT_STEREO
+ formats AUDIO_FORMAT_PCM_16_BIT
+ devices AUDIO_DEVICE_OUT_USB_DEVICE
+ }
+ }
+ }
+}