diff options
author | Richard Fitzgerald <rf@opensource.wolfsonmicro.com> | 2013-03-25 16:18:26 +0000 |
---|---|---|
committer | Eric Laurent <elaurent@google.com> | 2013-06-27 17:16:25 -0700 |
commit | b4d07b97d23cfaffe22c7859ad7c45e168a7df0e (patch) | |
tree | 1f36a97d335c3d7b597a43f89434e8e4691267ad /audio | |
parent | 324157de1a8dd109bcc2fb2e8163939dfbf1e860 (diff) | |
download | platform_hardware_libhardware_legacy-b4d07b97d23cfaffe22c7859ad7c45e168a7df0e.tar.gz platform_hardware_libhardware_legacy-b4d07b97d23cfaffe22c7859ad7c45e168a7df0e.tar.bz2 platform_hardware_libhardware_legacy-b4d07b97d23cfaffe22c7859ad7c45e168a7df0e.zip |
Add audio policy API changes for audio offload
Changes to the API of audio policy for audio offload support:
- Add isOffloadSupported() function
- Add OUTPUT_FLAG_OFFLOAD
- Extend AudioOutputDescriptor to include a sharing count for direct outputs
- Pass audio_offload_info_t when opening output streams
Change-Id: I5ad26418fdb286eb7ae299d586dd1fd525d48ab9
Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
Signed-off-by: Eric Laurent <elaurent@google.com>
Diffstat (limited to 'audio')
-rw-r--r-- | audio/AudioPolicyCompatClient.cpp | 5 | ||||
-rw-r--r-- | audio/AudioPolicyCompatClient.h | 3 | ||||
-rw-r--r-- | audio/AudioPolicyManagerBase.cpp | 17 | ||||
-rw-r--r-- | audio/audio_policy_hal.cpp | 14 |
4 files changed, 31 insertions, 8 deletions
diff --git a/audio/AudioPolicyCompatClient.cpp b/audio/AudioPolicyCompatClient.cpp index 4c80428..162968c 100644 --- a/audio/AudioPolicyCompatClient.cpp +++ b/audio/AudioPolicyCompatClient.cpp @@ -41,11 +41,12 @@ audio_io_handle_t AudioPolicyCompatClient::openOutput(audio_module_handle_t modu audio_format_t *pFormat, audio_channel_mask_t *pChannelMask, uint32_t *pLatencyMs, - audio_output_flags_t flags) + audio_output_flags_t flags, + const audio_offload_info_t *offloadInfo) { return mServiceOps->open_output_on_module(mService, module, pDevices, pSamplingRate, pFormat, pChannelMask, pLatencyMs, - flags); + flags, offloadInfo); } audio_io_handle_t AudioPolicyCompatClient::openDuplicateOutput(audio_io_handle_t output1, diff --git a/audio/AudioPolicyCompatClient.h b/audio/AudioPolicyCompatClient.h index 5399c8c..494c8af 100644 --- a/audio/AudioPolicyCompatClient.h +++ b/audio/AudioPolicyCompatClient.h @@ -43,7 +43,8 @@ public: audio_format_t *pFormat, audio_channel_mask_t *pChannelMask, uint32_t *pLatencyMs, - audio_output_flags_t flags); + audio_output_flags_t flags, + const audio_offload_info_t *offloadInfo); virtual audio_io_handle_t openDuplicateOutput(audio_io_handle_t output1, audio_io_handle_t output2); virtual status_t closeOutput(audio_io_handle_t output); diff --git a/audio/AudioPolicyManagerBase.cpp b/audio/AudioPolicyManagerBase.cpp index 236bf69..176b631 100644 --- a/audio/AudioPolicyManagerBase.cpp +++ b/audio/AudioPolicyManagerBase.cpp @@ -508,7 +508,8 @@ audio_io_handle_t AudioPolicyManagerBase::getOutput(AudioSystem::stream_type str uint32_t samplingRate, uint32_t format, uint32_t channelMask, - AudioSystem::output_flags flags) + AudioSystem::output_flags flags, + const audio_offload_info_t *offloadInfo) { audio_io_handle_t output = 0; uint32_t latency = 0; @@ -537,7 +538,8 @@ audio_io_handle_t AudioPolicyManagerBase::getOutput(AudioSystem::stream_type str &outputDesc->mFormat, &outputDesc->mChannelMask, &outputDesc->mLatency, - outputDesc->mFlags); + outputDesc->mFlags, + offloadInfo); if (mTestOutputs[mCurOutput]) { AudioParameter outputCmd = AudioParameter(); outputCmd.addInt(String8("set_id"),mCurOutput); @@ -582,7 +584,8 @@ audio_io_handle_t AudioPolicyManagerBase::getOutput(AudioSystem::stream_type str outputDesc->mFormat = (audio_format_t)format; outputDesc->mChannelMask = (audio_channel_mask_t)channelMask; outputDesc->mLatency = 0; - outputDesc->mFlags = (audio_output_flags_t)(flags | AUDIO_OUTPUT_FLAG_DIRECT);; + outputDesc->mFlags =(audio_output_flags_t) + (outputDesc->mFlags | flags | AUDIO_OUTPUT_FLAG_DIRECT); outputDesc->mRefCount[stream] = 0; outputDesc->mStopTime[stream] = 0; outputDesc->mDirectOpenCount = 1; @@ -1316,6 +1319,12 @@ status_t AudioPolicyManagerBase::dump(int fd) return NO_ERROR; } +bool AudioPolicyManagerBase::isOffloadSupported(const audio_offload_info_t& offloadInfo) +{ + // Stub implementation + return false; +} + // ---------------------------------------------------------------------------- // AudioPolicyManagerBase // ---------------------------------------------------------------------------- @@ -3455,6 +3464,8 @@ const struct StringToEnum sFlagNameToEnumTable[] = { STRING_TO_ENUM(AUDIO_OUTPUT_FLAG_PRIMARY), STRING_TO_ENUM(AUDIO_OUTPUT_FLAG_FAST), STRING_TO_ENUM(AUDIO_OUTPUT_FLAG_DEEP_BUFFER), + STRING_TO_ENUM(AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD), + STRING_TO_ENUM(AUDIO_OUTPUT_FLAG_NON_BLOCKING), }; const struct StringToEnum sFormatNameToEnumTable[] = { diff --git a/audio/audio_policy_hal.cpp b/audio/audio_policy_hal.cpp index 1604809..0e03358 100644 --- a/audio/audio_policy_hal.cpp +++ b/audio/audio_policy_hal.cpp @@ -138,14 +138,16 @@ static audio_io_handle_t ap_get_output(struct audio_policy *pol, uint32_t sampling_rate, audio_format_t format, audio_channel_mask_t channelMask, - audio_output_flags_t flags) + audio_output_flags_t flags, + const audio_offload_info_t *offloadInfo) { struct legacy_audio_policy *lap = to_lap(pol); ALOGV("%s: tid %d", __func__, gettid()); return lap->apm->getOutput((AudioSystem::stream_type)stream, sampling_rate, (int) format, channelMask, - (AudioSystem::output_flags)flags); + (AudioSystem::output_flags)flags, + offloadInfo); } static int ap_start_output(struct audio_policy *pol, audio_io_handle_t output, @@ -321,6 +323,13 @@ static int ap_dump(const struct audio_policy *pol, int fd) return lap->apm->dump(fd); } +static bool ap_is_offload_supported(const struct audio_policy *pol, + const audio_offload_info_t *info) +{ + const struct legacy_audio_policy *lap = to_clap(pol); + return lap->apm->isOffloadSupported(*info); +} + static int create_legacy_ap(const struct audio_policy_device *device, struct audio_policy_service_ops *aps_ops, void *service, @@ -368,6 +377,7 @@ static int create_legacy_ap(const struct audio_policy_device *device, lap->policy.is_stream_active_remotely = ap_is_stream_active_remotely; lap->policy.is_source_active = ap_is_source_active; lap->policy.dump = ap_dump; + lap->policy.is_offload_supported = ap_is_offload_supported; lap->service = service; lap->aps_ops = aps_ops; |