audio/msm7x30: perform null checks when calling libhtc_acoustic functions

Fixes null pointer dereference when msm72xx_set_audpre_params and
msm72xx_enable_audpre are called from libhtc_acoustic.so that does
not have those functions (such as those for msm8x60 platform).

Change-Id: I273b312e63f8a95caefce2100c0402a4482da51b
audio/msm7x30: set mRecordState in AudioInputStreamMSM72xx::set

This fixes audio input/recording, including voice dialer and
voice search.

Change-Id: I36b07ce6c1475491689f77f82243559175df7724
audio: set mRecordState in AudioInputStreamMSM72xx::set

This fixes audio input/recording, including voice dialer and
voice search.

Change-Id: Id43c677c0cb2a9fb128b7e7651655e0f4934d1cf
qcom/media: build only legacy audio

mm-core and mm-video are 2 separate repos on ics.
libstagefrighthw is built from hardware/msm7k and is keep
there only for QComOMXMetadata.h inclusion.

Change-Id: I0210bd41ac7c9f4c8969dca52f541af2f5759cdc
audio/msm8660: Fix for no FM audio on BT A2DP headset

- While switching FM audio between Speaker and A2DP headset
  multiple times, audio is lost and ANR is seen in FM app.
- After opening an input stream to read FM data to play on
  A2DP, and before the first read the input device is being
  set to 0 which leads to no audio.
- Fixed the issue by ignoring the input device switch request
  with device 0.

CRs-Fixed: 330311
(cherry picked from commit 6c5c3d2a2604e0e5b8c18c3cb0c26cf920efdf8a)

Change-Id: I379a76c79d025768b54bd1f8fd9635903d58310a
hardware/qcom: msm8660: Fix FM audio getting muted at volume level 1

- FM Volume is getting muted at volume level one
- Corresponding linear value for volume level one is lesser than 0.5 and
  it gets rounded to zero and hence volume gets muted
- Fixed this issue by rounding the valid volume values to the nearest
  higher integer value so that such lower values are not ignored

CRs-Fixed: 337127
(cherry picked from commit 9d22f97b17ddcf4bc3c08b200a3606c6ee1f6e73)

Change-Id: I7845e1612afa1c30fc52196ac340fa2d28ec8303
hardware/qcom: 8660: Fix voice call mute issue after VOIP

- Observe CS voice call become silent after Voip call.
- Incase of mDirectOutput is opened multiple times,
MVS driver is not closed and Rx/Tx devices are not
de-routed even after Voip call terminates.
- Avoid creating mDirectOutput if already exists. This will
close the MVS driver properly,Rx/Tx devices are de-routed
and will not result in any issue for next usecase.

CRs-Fixed: 337952
(cherry picked from commit 078cff577844d25baf70126910f8ba89fbc6c73a)

Change-Id: I2295f85f841fa3c2e8009db39e369046dd2a595f
hardware/qcom: 8660: Fix video gtalk call with no voice issue

- While Video voip call, no voice is heard at all.
- Here, Output Stream open does MVS driver open and increments
the voip stream count. Then Input Stream open checks the
MVS driver is already opened and returning without incrementing
the voip stream count. As a result, standby called after Input
Stream open will use this count to check whether both Input
and Output streams are active. But as count is not incremented
in Input stream open, it assumes only one stream is opened and
results in closing of MVS driver which is not expected and
causing no voice packets sent to downlink and uplink.
- Increment the voip stream count both in Output stream
open and Input Stream open even if MVS driver is already
opened. This will reflect the voip stream count correctly
and avoids failure cases like this.

CRs-Fixed: 340102
(cherry picked from commit e935fb0461269b151c3db74d73de0d349c6701db)

Change-Id: Ifbcfb9ba6c60f49b5f2b8f456c24b5d5b0792cb3
hardware/qcom: 8660: Fix voice uplink distortion in VOIP

-When Gtalk voip call is used, observing distortion on
uplink voice.
-There is a sofware bug in the code while returning the
number of bytes read from HAL StreamInVoip read. The
upper layers rely on this value for calculating the delay
to read the next voice uplink packet. As this value is
returned 1280 bytes instead of 640, it is resulting in
20ms more delay for each packet read and causing
packet drops and disortion in uplink voice.
-Fix the issue by returning the actual number of bytes
that are read from MVS and filled into buffer.

CRs-Fixed: 331850
(cherry picked from commit b2a90147720040d6bdf8df0737370052507be7b0)

Change-Id: I662e3d47b919a20198b0203539ddb5d5bb2073ea
msm7x27: Audio HAL and PolicyManager implementation

BOARD_USES_QCOM_HARDWARE
BOARD_HAVE_BLUETOOTH
BOARD_HAVE_FM_RADIO
BOARD_COMBO_DEVICE_SUPPORTED
BOARD_CDMA_NETWORK

----------------
Patchset 1: Initial commit from CAF
Patchset 2: Add tunnel support
Patchset 3: Add FM radio support
Patchset 4: Enable tunnel support by default
Patchset 5: Add support for combo device if defined BOARD_COMBO_DEVICE_SUPPORTED
Patchset 6-7: Rebase
Patchset 8: Add QCELP and EVRC support if defined BOARD_CDMA_NETWORK
Patchset 9: Enable FM & set fm audio policy if defined BOARD_HAVE_FM_RADIO
Patchset 10: Update supported_devices if defined BOARD_HAVE_BLUETOOTH
Patchset 11: Revert 10. BT audio is handled by audio.a2dp.*.so
Patchset 12: Change target to msm7k from msm7x27
Patchset 13: qcom/media: flags cleanup and return to msm7x27
----------------

QCELP and EVRC support depends on:
http://review.cyanogenmod.com/#change,13830

Change-Id: Ib1dfe9af6e7c8f174a700a615dc9b3f393d5b8d6