diff options
author | Eric Laurent <elaurent@google.com> | 2010-10-13 18:51:22 -0700 |
---|---|---|
committer | Eric Laurent <elaurent@google.com> | 2010-10-13 18:51:22 -0700 |
commit | aa862dd87fe988c9173aefde3dde1855e478c883 (patch) | |
tree | 643ca47d016c2c1c08d6e47647377f7a27b28115 /libaudio | |
parent | 91b91173c677119b36e158e13bcfc014b43db77c (diff) | |
download | device_samsung_crespo-aa862dd87fe988c9173aefde3dde1855e478c883.zip device_samsung_crespo-aa862dd87fe988c9173aefde3dde1855e478c883.tar.gz device_samsung_crespo-aa862dd87fe988c9173aefde3dde1855e478c883.tar.bz2 |
Several Audio HAL fixes:
Lakkyung Jung <lakkyung.jung@samsung.com>:
S5PC11X: SOUND: Change h/w parameters setting in setDevice().
Audio input/output stream will be used snd_pcm_hw_params_set_period_size()
and snd_pcm_hw_params_get_period_size() when setting h/w params.
because we already know period values by bufferSize / periodSize.
So we don't need to set period values.
audio input stream will be used period value 4.
Anton Rogozin<ant.rogozin@samsung.com>
libaudio: RIL clock functionality
RIL clock functionality was added.
Change-Id: I9f8f8d8b2851562e3c1bed3e4c7ae896d7865331
Diffstat (limited to 'libaudio')
-rwxr-xr-x | libaudio/AudioHardwareALSA.cpp | 49 | ||||
-rwxr-xr-x | libaudio/AudioHardwareALSA.h | 6 |
2 files changed, 36 insertions, 19 deletions
diff --git a/libaudio/AudioHardwareALSA.cpp b/libaudio/AudioHardwareALSA.cpp index b3d05d2..770b2b6 100755 --- a/libaudio/AudioHardwareALSA.cpp +++ b/libaudio/AudioHardwareALSA.cpp @@ -209,7 +209,8 @@ AudioHardwareALSA::AudioHardwareALSA() : mInput(0), mSecRilLibHandle(NULL), mRilClient(0), - mVrModeEnabled(false) + mVrModeEnabled(false), + mActivatedCP(false) { snd_lib_error_set_handler(&ALSAErrorHandler); mMixer = new ALSAMixer; @@ -259,10 +260,12 @@ void AudioHardwareALSA::loadRILD(void) dlsym(mSecRilLibHandle, "SetCallVolume"); setCallAudioPath = (int (*)(HRilClient, AudioPath)) dlsym(mSecRilLibHandle, "SetCallAudioPath"); + setCallClockSync = (int (*)(HRilClient, SoundClockCondition)) + dlsym(mSecRilLibHandle, "SetCallClockSync"); if (!openClientRILD || !disconnectRILD || !closeClientRILD || !isConnectedRILD || !connectRILD || - !setCallVolume || !setCallAudioPath) { + !setCallVolume || !setCallAudioPath || !setCallClockSync) { LOGE("Can't load all functions from libsecril-client.so"); dlclose(mSecRilLibHandle); @@ -298,7 +301,7 @@ status_t AudioHardwareALSA::connectRILDIfRequired(void) return INVALID_OPERATION; } - if (isConnectedRILD(mRilClient) == 0) { + if (isConnectedRILD(mRilClient)) { return OK; } @@ -571,6 +574,21 @@ status_t AudioHardwareALSA::doRouting_l(uint32_t device, bool force) ret = mOutput->setDevice(mode, device, PLAYBACK, force); + if (mSecRilLibHandle && (connectRILDIfRequired() == OK) ) { + if (AudioSystem::MODE_IN_CALL == mode) { + if (!mActivatedCP) { + setCallClockSync(mRilClient, SOUND_CLOCK_START); + mActivatedCP = true; + } + } + + if (AudioSystem::MODE_NORMAL == mode) { + if(mActivatedCP) + mActivatedCP = false; + } + } + + return ret; } @@ -1188,21 +1206,18 @@ status_t ALSAStreamOps::setDevice(int mode, uint32_t device, uint audio_mode) return NO_INIT; } -// if(audio_mode == PLAYBACK) { -// period_val = PERIODS_PLAYBACK; -// } -// else { -// period_val = PERIODS_CAPTURE; -// } - // not working for capture ? - if (mDefaults->direction == SND_PCM_STREAM_PLAYBACK) { - if(snd_pcm_hw_params_set_periods(mHandle, mHardwareParams, - period_val, mDefaults->direction) < 0) { - LOGE("Fail to set period size %d for %d direction", - period_val, mDefaults->direction); - return NO_INIT; - } + err = snd_pcm_hw_params_set_period_size (mHandle, mHardwareParams, periodSize, NULL); + if (err < 0) { + LOGE("Unable to set the period size for latency: %s", snd_strerror(err)); + return NO_INIT; } + + err = snd_pcm_hw_params_get_period_size (mHardwareParams, &periodSize, NULL); + if (err < 0) { + LOGE("Unable to get the period size for latency: %s", snd_strerror(err)); + return NO_INIT; + } + // err = snd_pcm_hw_params_get_period_size (mHardwareParams, &periodSize, NULL); // if (err < 0) { // LOGE("Unable to get the period size for latency: %s", snd_strerror(err)); diff --git a/libaudio/AudioHardwareALSA.h b/libaudio/AudioHardwareALSA.h index 22821ab..c5721c2 100755 --- a/libaudio/AudioHardwareALSA.h +++ b/libaudio/AudioHardwareALSA.h @@ -40,8 +40,8 @@ #define LATENCY_PLAYBACK_MS ((BUFFER_SZ_PLAYBACK * 1000 / DEFAULT_SAMPLE_RATE) * 1000) #define CAPTURE 1 -#define PERIOD_SZ_CAPTURE 2048 -#define PERIODS_CAPTURE 2 +#define PERIOD_SZ_CAPTURE 1024 +#define PERIODS_CAPTURE 4 #define BUFFER_SZ_CAPTURE (PERIODS_CAPTURE * PERIOD_SZ_CAPTURE) #define LATENCY_CAPTURE_MS ((BUFFER_SZ_CAPTURE * 1000 / DEFAULT_SAMPLE_RATE) * 1000) @@ -344,6 +344,7 @@ namespace android void *mSecRilLibHandle; HRilClient mRilClient; bool mVrModeEnabled; + bool mActivatedCP; HRilClient (*openClientRILD) (void); int (*disconnectRILD) (HRilClient); @@ -352,6 +353,7 @@ namespace android int (*connectRILD) (HRilClient); int (*setCallVolume) (HRilClient, SoundType, int); int (*setCallAudioPath)(HRilClient, AudioPath); + int (*setCallClockSync)(HRilClient, SoundClockCondition); void loadRILD(void); status_t connectRILDIfRequired(void); |