alsa_sound: handle in call sonification even when refcount is not one

- If two back to back notifications are started immediately during a
  call, the second notification is still heard sometimes though it
  should be muted
- When startOutput() of second notification and stopOutput() of first
  notification are called almost at the same time respectively,
  startOutput() will not handle in call sonification as refcount is
  not equal to 1 and will not increment the mute count. But
  stopOutput() of first notification will decrement the mute count to
  0 and will result in unmuting the stream which results in this issue
- Fix this issue by handling in call sonification even when refcount
  of output is 1, so that mute count is properly maintained in such
  scenarios

Change-Id: I43304f861760a331e6bb5ecd9218ea9e184d1c50
CRs-Fixed: 501013
Revert "alsa_sound: Add initial volume setting for USB headset"

This reverts commit 18e59b2c19134b32f46399592ff818cbaa3870af.

Change-Id: Ic039e3452e10140afc2b0a657daa23a02a7a69d3
alsa_sound: Add initial volume setting for USB headset

Some USB headsets start at 0 volume because of this even
if the Media Player volume is maximum cannot hear any audio.
Initialize device volume before starting the playback.

CRs-Fixed: 478906
Change-Id: Ib7d598996fe88199493c429f10ff2b6ebe37fbe3
alsa_sound: Set voip volume explicitly in voice volume api

- Volume is not applied if playback is done on direct output
  with stream as VOICE_CALL and mode value set to MODE_NORMAL
- Voip volume is not applied in HAL if mode is not set
- Set voip volume explicitly in HAL everytime

Change-Id: I956c79aaac4e30e3ed632ba553e7f41def0974b2
CRs-Fixed: 493282
alsa_sound: Changed mDevices to mCurRxDevice for StreamOut

- mDevices will be updated during route call and
  current device can change in between the start
  and write call of stream.
- In which case only the mCurRxDevice was updated
  and during write the device would not be updated
- This would create problem when switch device happens
  in session where it was alreasy set and device switch
  is ignored.
- here we use mCurRxDevice so even if there is a switch
  device in between the cur device will be used for
  routing in Stream

Change-Id: I0edc08e3b8ab4fc664570fa0ce498a7b4c4f004f
libalsa-intf: Fix for no audio on specific USB device

- Playback volume is not initialized for USB device due to this
  on some specific headsets no audio heard even if we increase
  the playback volume to maximum.
- Fix is to explicitly initialize the volume for USB headset
  before starting the playback using mixer control. As USB
  driver supports DB_MINMAX for volume control add support
  for same in alsa_mixer.

CRs-Fixed: 478906
Change-Id: I4ebb9d8b96069f628c772da57e22478cac815c45
alsa_sound: Move pcm device node open to read function

- GTalk call doesn't work if call is started during an existing
  recording session. All subsequent calls are failing after this
  scenario
- GTalk tries to open a normal recording session initially and
  as pcm device node is busy with existing recording session it
  fails in openInputStream call and GTalk doesn't recover from
  this error again.
- Move the pcm device node open to read() call instead which will
  avoid opening the pcm device node of normal recording session
  and doesn't go into the error state. This will allow GTalk call
  to work and also all the subsequent calls to work

Change-Id: I4e2e2041c9cb8252cd059916337ce82f2a34ce50
mm-audio: Fix openmax encoder hang during flush

Flush issued by command thread should unblock the read/write calls
in openmax component.
There is race condition between input/output thread and command
thread in openmax component due to which read/write is not unblocked
which results in a hang.
This change makes command thread to issue multiple flush when it is
wait for ack to avoid a hang.

Change-Id: Ia4486f2e53f56a8413c2115b7f418b29b4bc54c5
CRs-fixed: 466764
alsa_sound: Increase delay in tempmute for BT,USB,WFD devices

-WFD to BT switch while playing media causing  audio loss/noise on BT

-Before BT routing, stream is unmuted because of less latency time

-Increased temp mute time to ensure unmute after device switch

CRs-Fixed: 493835

Change-Id: I337088814258fcce060f1b139773bb63b6f21635
Merge commit 'refs/changes/17/45817/1' of http://review.cyanogenmod.org/CyanogenMod/android_hardware_qcom_audio-caf into cm-10.1