From 391bf29ad1177d973cb6a9daea13677373204176 Mon Sep 17 00:00:00 2001 From: Kalyani polepeddy Date: Sat, 29 Dec 2012 17:48:55 +0530 Subject: frameworks/av : Playing AAC and MP3 clips using LPA. -AAC and MP3 clips are not playing. -AAC and MP3 are not using LPA path. -Enable LPA decoder path and implement LPAPlayer class. Change-Id: I76438319fc72c4898fad5910f8de874f89287687 --- services/audioflinger/AudioFlinger.cpp | 38 +++++++++++++++++++++++++++++++++- services/audioflinger/AudioFlinger.h | 1 + 2 files changed, 38 insertions(+), 1 deletion(-) (limited to 'services') diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp index bf94efe..724b1e3 100644 --- a/services/audioflinger/AudioFlinger.cpp +++ b/services/audioflinger/AudioFlinger.cpp @@ -255,6 +255,9 @@ AudioFlinger::AudioFlinger() void AudioFlinger::onFirstRef() { int rc = 0; +#ifdef QCOM_HARDWARE + mA2DPHandle = -1; +#endif Mutex::Autolock _l(mLock); @@ -866,6 +869,9 @@ status_t AudioFlinger::setMasterVolume(float value) return PERMISSION_DENIED; } +#ifdef QCOM_HARDWARE + mA2DPHandle = -1; +#endif Mutex::Autolock _l(mLock); mMasterVolume = value; @@ -1351,7 +1357,7 @@ void AudioFlinger::registerClient(const sp& client) sp notificationClient = new NotificationClient(this, client, binder); - ALOGV("registerClient() client %p, binder %d", notificationClient.get(), binder.get); + ALOGV("registerClient() client %p, binder %d", notificationClient.get(), binder.get()); mNotificationClients.add(binder, notificationClient); @@ -1368,6 +1374,13 @@ void AudioFlinger::registerClient(const sp& client) mRecordThreads.valueAt(i)->sendIoConfigEvent(AudioSystem::INPUT_OPENED); } } +#ifdef QCOM_HARDWARE + // Send the notification to the client only once. + if (mA2DPHandle != -1) { + ALOGV("A2DP active. Notifying the registered client"); + client->ioConfigChanged(AudioSystem::A2DP_OUTPUT_STATE, mA2DPHandle, &mA2DPHandle); + } +#endif } #ifdef QCOM_HARDWARE @@ -7675,6 +7688,15 @@ audio_io_handle_t AudioFlinger::openOutput(audio_module_handle_t module, #endif mPlaybackThreads.add(id, thread); +#ifdef QCOM_HARDWARE + // if the device is a A2DP, then this is an A2DP Output + if ( true == audio_is_a2dp_device((audio_devices_t) *pDevices) ) + { + mA2DPHandle = id; + ALOGV("A2DP device activated. The handle is set to %d", mA2DPHandle); + } +#endif + if (pSamplingRate != NULL) *pSamplingRate = config.sample_rate; if (pFormat != NULL) *pFormat = config.format; if (pChannelMask != NULL) *pChannelMask = config.channel_mask; @@ -7775,6 +7797,14 @@ status_t AudioFlinger::closeOutput_nonvirtual(audio_io_handle_t output) } audioConfigChanged_l(AudioSystem::OUTPUT_CLOSED, output, NULL); mPlaybackThreads.removeItem(output); +#ifdef QCOM_HARDWARE + if (mA2DPHandle == output) + { + mA2DPHandle = -1; + ALOGV("A2DP OutputClosed Notifying Client"); + audioConfigChanged_l(AudioSystem::A2DP_OUTPUT_STATE, mA2DPHandle, &mA2DPHandle); + } +#endif } thread->exit(); // The thread entity (active unit of execution) is no longer running here, @@ -7960,6 +7990,12 @@ status_t AudioFlinger::setStreamOutput(audio_stream_type_t stream, audio_io_hand PlaybackThread *thread = mPlaybackThreads.valueAt(i).get(); thread->invalidateTracks(stream); } +#ifdef QCOM_HARDWARE + if ( mA2DPHandle == output ) { + ALOGV("A2DP Activated and hence notifying the client"); + audioConfigChanged_l(AudioSystem::A2DP_OUTPUT_STATE, mA2DPHandle, &output); + } +#endif return NO_ERROR; } diff --git a/services/audioflinger/AudioFlinger.h b/services/audioflinger/AudioFlinger.h index d2daae7..dcdc55c 100644 --- a/services/audioflinger/AudioFlinger.h +++ b/services/audioflinger/AudioFlinger.h @@ -2234,6 +2234,7 @@ mutable Mutex mLock; // mutex for process, commands and handl bool mBtNrecIsOff; #ifdef QCOM_HARDWARE DefaultKeyedVector mDirectAudioTracks; + int mA2DPHandle; // Handle to notify A2DP connection status #endif // protected by mLock #ifdef QCOM_HARDWARE -- cgit v1.1