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
Merge branch 'ics' of git://github.com/CyanogenMod/android_hardware_qcom_media into ics

Conflicts:
	Android.mk
	mm-core/omxcore/inc/OMX_QCOMExtns.h
	mm-core/omxcore/src/common/omx_core_cmp.cpp
	mm-video/vidc/vdec/Android.mk
	mm-video/vidc/vdec/inc/decoder_driver_test.h
	mm-video/vidc/vdec/inc/frameparser.h
	mm-video/vidc/vdec/inc/h264_utils.h
	mm-video/vidc/vdec/inc/message_queue.h
	mm-video/vidc/vdec/inc/omx_vdec.h
	mm-video/vidc/vdec/src/frameparser.cpp
	mm-video/vidc/vdec/src/h264_utils.cpp
	mm-video/vidc/vdec/src/message_queue.c
	mm-video/vidc/vdec/src/omx_vdec.cpp
	mm-video/vidc/vdec/test/decoder_driver_test.c
	mm-video/vidc/vdec/test/omx_vdec_test.cpp
	mm-video/vidc/venc/Android.mk
	mm-video/vidc/venc/inc/camera_test.h
	mm-video/vidc/venc/inc/fb_test.h
	mm-video/vidc/venc/inc/omx_video_base.h
	mm-video/vidc/venc/inc/omx_video_encoder.h
	mm-video/vidc/venc/inc/queue.h
	mm-video/vidc/venc/inc/venc_util.h
	mm-video/vidc/venc/inc/video_encoder_device.h
	mm-video/vidc/venc/inc/video_encoder_test.h
	mm-video/vidc/venc/src/omx_video_base.cpp
	mm-video/vidc/venc/src/omx_video_encoder.cpp
	mm-video/vidc/venc/src/video_encoder_device.cpp
	mm-video/vidc/venc/test/camera_test.cpp
	mm-video/vidc/venc/test/fb_test.c
	mm-video/vidc/venc/test/queue.c
	mm-video/vidc/venc/test/venc_test.cpp
	mm-video/vidc/venc/test/venc_util.c
	mm-video/vidc/venc/test/video_encoder_test.c