diff options
author | Mingming Yin <mingming@codeaurora.org> | 2012-12-09 21:31:33 -0800 |
---|---|---|
committer | Steve Kondik <shade@chemlab.org> | 2012-12-20 23:08:26 -0800 |
commit | bae0a96f4121b9a61db5e5b2629d9364c54403a0 (patch) | |
tree | 9265845301c93ede36e29f1d5a1c93c4f5e362fa /include/hardware | |
parent | 1966e40a05a795cdfdfa6160468cdcb8e46dd619 (diff) | |
download | hardware_libhardware-bae0a96f4121b9a61db5e5b2629d9364c54403a0.zip hardware_libhardware-bae0a96f4121b9a61db5e5b2629d9364c54403a0.tar.gz hardware_libhardware-bae0a96f4121b9a61db5e5b2629d9364c54403a0.tar.bz2 |
audio: add support for VOIP
Change-Id: I5dbddd245c0b20b15505dabd65c5f6d3084115cd
Diffstat (limited to 'include/hardware')
-rw-r--r-- | include/hardware/audio.h | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/include/hardware/audio.h b/include/hardware/audio.h index ba82c62..f72aba9 100644 --- a/include/hardware/audio.h +++ b/include/hardware/audio.h @@ -409,30 +409,23 @@ static inline size_t audio_stream_frame_size(const struct audio_stream *s) size_t chan_samp_sz; uint32_t chan_mask = s->get_channels(s); int format = s->get_format(s); - char *tmpparam; - int isParamEqual; #ifdef QCOM_HARDWARE + if (!s) + return 0; + if (audio_is_input_channel(chan_mask)) { chan_mask &= (AUDIO_CHANNEL_IN_STEREO | \ - AUDIO_CHANNEL_IN_MONO ); + AUDIO_CHANNEL_IN_MONO | \ + AUDIO_CHANNEL_IN_5POINT1); } - tmpparam = s->get_parameters(s, "voip_flag"); - isParamEqual = !strcmp(tmpparam,"voip_flag=1"); - free(tmpparam); - if(isParamEqual) { + if(!strncmp(s->get_parameters(s, "voip_flag"),"voip_flag=1",sizeof("voip_flag=1"))) { if(format != AUDIO_FORMAT_PCM_8_BIT) return popcount(chan_mask) * sizeof(int16_t); else return popcount(chan_mask) * sizeof(int8_t); } - - if (audio_is_input_channel(chan_mask)) { - chan_mask &= (AUDIO_CHANNEL_IN_STEREO | \ - AUDIO_CHANNEL_IN_MONO | \ - AUDIO_CHANNEL_IN_5POINT1); - } #endif switch (format) { |