diff options
author | Steve Kondik <steve@cyngn.com> | 2014-07-11 10:39:59 -0700 |
---|---|---|
committer | Steve Kondik <steve@cyngn.com> | 2016-01-19 12:21:19 -0800 |
commit | b56a2b2fc76d9d7e69012efb1c4d7321726a5707 (patch) | |
tree | 8871edc188c329aabd075fde8f378b6ee582a8ef /hal/audio_extn/audio_extn.c | |
parent | 9f78676f577ac731943299c9860d1c899aa018be (diff) | |
download | hardware_qcom_audio-b56a2b2fc76d9d7e69012efb1c4d7321726a5707.tar.gz hardware_qcom_audio-b56a2b2fc76d9d7e69012efb1c4d7321726a5707.tar.bz2 hardware_qcom_audio-b56a2b2fc76d9d7e69012efb1c4d7321726a5707.zip |
hal: Squashed support for new offload features
hal: add extended audio definitions in hal
- Add audio_defs.h in hal for extended audio
definitions.
hal: Add support for PCM in offload path
- Translate PCM Offload format to pcm codec id
- Set 16/24 sub format id in compress params format
- Calculate offload fragment size for pcm
- Move offload calculation functions to platform file
- Update audio policy manager isOffloadSupported
for pcm offload profile. Use audio.offload.pcm.enable
hal: set gapless metadata for compress offload playback
-If any of the metadata parameters are set from the framework.
set the gapless metadata to one.
CRs-Fixed: 588353
hal: Support for FLAC 24 bit format in offload path
- Add flac in supported codecs list
- Set FLAC codec specific parameters
- Set fragment size based on bit width and sampling rate
for flac
- Configure backend to 24/16 bit based on the current
usecases running
hal: Fix backend configuration for 24 bit offload playback
Backend sample rate configuration follows:
16 bit playback - 48khz for streams at any valid sample rate
24 bit playback - 48khz for stream sample rate upto 48khz
24 bit playback - 96khz for sample rate range of 48khz to 96khz
24 bit playback - 192khz for sample rate range of 96khz to 192 khz
For invalid or out of range sample rate, default rate is 48K
Upper limit is inclusive in the sample rate range
audio: Update error number in HAL
- Error number is not propagated from pcm/compress driver on
pcm/compress error
- Read error number in HAL from errno define
hal: Fix backend configuration during stream switch
-Currently, input stream sample rate and/or bit width is compared
with current backend sample rate and/or bit width. Backend is
re-configured only if input stream's rate/width is higher. This
causes incorrect sampling rate during stream switch of varying
sample rates.
-The backend is configured at highest bit width and/or sample rate
amongst all active playback usecases.
-By setting the backend re-configuration flag only when the selected
sample rate and/or bit width differ with current backend sample rate
and/or bit width, re-routing is enabled and backend is re-configured.
-Exception: 16 bit playbacks is allowed through 16/48 backend only.
-Enable logs for app type, acdb id and sample rate.
hal: fix 24bit compilation error with extended flag disabled
- use PCM_OUTPUT_BIT_WIDTH instead of out->bit_width to fix
compilation errors while it is not defined in audio.h
hal: Fix backend for 24 bit playback on speaker
Configure backend at 48khz for 24 bit playback on speakers.
Currently, ADM can be configured only at the begining of stream
playback. During device switch, in the middle of a playback, the
backend remains at the previous configuration.
By allowing ADM and backend re-configuration during playback, 24-bit
playback is enforced on appropriate backend.
hal: Fix combo device configuration for 24 bit playback on speaker
-Fix combo device configuration for 24 bit playback on speaker
-Move exception hadndling code to audio_extn
hal: Remove checks for 24 bit platform support
Check for 24 bit in HAL is not needed as the check for 24 bit
platform support is achieved through flags in frameworks.
hal: fix voice call mute issue
The backend is always configured with default bit width and sample
rate for voice calls. The backend reconfiguration should not be done
when a new stream starts during voice call.
CRs-fixed: 747001
hal: bug fixes for PCM offload
When pcm offload is done, override the buffer size
that was calculated and use the value from the system property
Make write call blocking if small buffers are used in offload
Update latency value for pcm offload with small buffer hint based
on period size and period count.
hal: send additional param for gapless flac
Currently, metadata such as min/max block size is sent only for first
stream in FLAC gapless playback. This causes incorrect configuration
and, subsequently, framedrops in decoding of second stream and onwards
Sending additional parameters
CRs-Fixed: 781837
hal: align fragment size to 24 instead of 1024 for PCM offload
Aligning PCM buffer size to 1024 bytes is not required in case
of PCM offloading. It actually creates problem when playing
6 ch, 96KHz, 16-bit stream PCM in offload mode, due to aligning
PCM data becomes unequal for the six channels.
Align the buffer to LCM of 2, 4, 6, 8 i.e. 24.
CRs-fixed: 780001
hal: Fix bit width for 24 bit PCM offload playback
PCM offload bit width is selected as 16 bit even for 24 bit pcm offload
playback streams if QTI_FLAC_DECODER flag is not defined. Fix this issue
by defining appropriate flag PCM_OFFLOAD_ENABLED_24.
hal: Reduce offload latency and log spam
Offload latency is set to 96. Change
it to 50 to reflect the rendering latency more correctly
Modify pcm offload latency to return offload
latency rather than the latency based on buffering
since volume is applied immediately for offload use
cases. Also reduce log spam in offload use cases
CRs-Fixed: 787448
hal: Fix alignement of of buffer sent to DSP
Currently, ALIGN macro can align properly only if the buffer size
is a power of 2.
To have same PCM samples for all channels, the buffer size requires to
be multiple of (number of channels * bytes per sample).
For writes to succeed, the buffer must be written at address which is
multiple of 32.
Alignment of 96 satsfies both of the above requirements.
CRs-Fixed: 795936
hal : Avoid use of small buf flag and bit width info.
-small buf flag and bit width info are not member of offload into
structure.
-avoid use of small buf flag and bit width info, use PCM offload
format.
audio: hal: Add support to send codec specific data in gapless
Codec specific metadata is sent only for first stream in gapless
playback.
This causes incorrect configuration to be set for second
stream and distortions are observed due to framedrops in adsp.
Add support to send codec specific format data of second stream
during gapless playback.
Use vorbis bitstream format info from metadata instead of hardcoding.
This avoids sending gapless metadata each time set parameters
is called during vorbis playback.
Set flag to send new metadata at start of session for first track
and for the next stream in gapless after return from partial drain.
hal: set output bitwidth to 24 bit for 32 bit data.
- parser gives 32 bit data for 24 bit AIFF playback and same
is sent down to HAL.
- So update bit width to 24 bit if offload info bit width is 32 bit
to configure back end to 24 bit for 24 bit e2e playback.
hal: check offload_callback not NULL before calling
- in case when offload o/p stream is created in blocking mode
flinger do not sets the callback pointer. So check for offload
callback pointer before calling.
hal: Increase PCM offload buffering
Increase PCM offload buffering to 40ms
Change-Id: I13fbab3518a1e7e4314ce112d673469f0a30d457
CRs-Fixed: 924443
Diffstat (limited to 'hal/audio_extn/audio_extn.c')
-rw-r--r-- | hal/audio_extn/audio_extn.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/hal/audio_extn/audio_extn.c b/hal/audio_extn/audio_extn.c index 7583f835..c9d805bf 100644 --- a/hal/audio_extn/audio_extn.c +++ b/hal/audio_extn/audio_extn.c @@ -29,7 +29,50 @@ #include "platform.h" #include "platform_api.h" +#include "sound/compress_params.h" +#ifndef COMPRESS_METADATA_NEEDED +#define audio_extn_parse_compress_metadata(out, parms) (0) +#else +int audio_extn_parse_compress_metadata(struct stream_out *out, + struct str_parms *parms) +{ + int ret = 0; + char value[32]; + +#ifdef FLAC_OFFLOAD_ENABLED + if (out->format == AUDIO_FORMAT_FLAC) { + ret = str_parms_get_str(parms, AUDIO_OFFLOAD_CODEC_FLAC_MIN_BLK_SIZE, value, sizeof(value)); + if (ret >= 0) { + out->compr_config.codec->options.flac_dec.min_blk_size = atoi(value); + out->is_compr_metadata_avail = true; + } + ret = str_parms_get_str(parms, AUDIO_OFFLOAD_CODEC_FLAC_MAX_BLK_SIZE, value, sizeof(value)); + if (ret >= 0) { + out->compr_config.codec->options.flac_dec.max_blk_size = atoi(value); + out->is_compr_metadata_avail = true; + } + ret = str_parms_get_str(parms, AUDIO_OFFLOAD_CODEC_FLAC_MIN_FRAME_SIZE, value, sizeof(value)); + if (ret >= 0) { + out->compr_config.codec->options.flac_dec.min_frame_size = atoi(value); + out->is_compr_metadata_avail = true; + } + ret = str_parms_get_str(parms, AUDIO_OFFLOAD_CODEC_FLAC_MAX_FRAME_SIZE, value, sizeof(value)); + if (ret >= 0) { + out->compr_config.codec->options.flac_dec.max_frame_size = atoi(value); + out->is_compr_metadata_avail = true; + } + ALOGV("FLAC metadata: min_blk_size %d, max_blk_size %d min_frame_size %d max_frame_size %d", + out->compr_config.codec->options.flac_dec.min_blk_size, + out->compr_config.codec->options.flac_dec.max_blk_size, + out->compr_config.codec->options.flac_dec.min_frame_size, + out->compr_config.codec->options.flac_dec.max_frame_size); + } +#endif + + return ret; +} +#endif #ifdef KPI_OPTIMIZE_ENABLED typedef int (*perf_lock_acquire_t)(int, int, int*, int); |