frameworks/av: enable voip flag based on channelcount

voip flag should be enabled based on channelcount instead of
channelmask. Some of voip apps like viber may not use
AUDIO_CHANNEL_OUT_MONO but still configures to single channel
like by using AUDIO_CHANNEL_OUT_FRONT_CENTER.

Change-Id: I3f69a5c50b6e1bb9336e08eb9619e15de2d8a532
CRs-Fixed: 511713
audio: fix meta MIME type failure in MPEG4Writer

- MIME type info included in source->getFormat()
  is not updated properly because only temp
  variable is updated in AudioSource::getFormat().
  MIME type string contains garbage value and it
  results in invalid audio formats.
  MPEG4Writer returns ERROR_UNSUPPORTED and tunnel
  mode recording with 3gpp format fails
- Fix this issue by assigning return value of
  getFormat() to a local variable, and check the
  return value of findCString.

Change-Id: I242fa25a5d4f7b7e2c88fdd855208dcd42883b6c
audioflinger: Fix for removing noise while resuming playback after pause

-Issue: While resuming playback after pausing and seeking to backward,
there is a noise.
-Rootcause: When Resuming a Playback after Pausing and seeking,
AudioResampler's reset() function is resetting their member
variables but derived classes' s member variable are not resetting.
This is causing a noise in Playback because AudioResamplerSinc,
AudioResamplerOrder1 and AudioResamplerCubic's member variables
pointing to some previous state/values.
-Fix: To reset the derived class member variables,
override the reset function in all the derived classes.

Change-Id: I0584947ac203f9470cdc4a680ebccadf60e4e7db
CRs-Fixed: 482838
audioflinger: Fix buffer size for VOIP

 * Crazy ternary is crazy.

Change-Id: I9d076bf8c72f4266be054b093889ec763bf2bb00
libstagefright: Add legacy LPAPlayer

Change-Id: Ie2551345bbf047c022d1fecbb7cb2cc4a4c97d72
libstagefright: Fix to free buffers in error scenarios

MediaBuffer objects are not freed if component transition from
IDLE->EXECUTING or EXECUTING->LOADED fails (or if the
OMX_CmdComplete messages are dropped due to an earlier error)
Additionally with native buffers, the corresponding
ANativeWindowBuffers are not cancelled back in the above scenarios.

Change-Id: Idad02f7bb6bbfcd30947624148ea996a4a8f18b3
libstagefright: Add 2 APIs (suspend and resume) in Mediaplayer

- API:suspend() will just pause the player and release all the decoders
  instead of release the whole player
- API:resume() will just init the decoders again
- Add a check in onVideoEvent()
  to make sure the first seek operation will seek the next i-frame

Signed-off-by: jmeng <jmeng@codeaurora.org>

Change-Id: If16dc1c9dae2f28df8a969b1044ca67d23a8846b
libstagefright: HTTP Streaming fixes

- Stop fetching on reaching EOS
- Disconnect datasource in player's reset
- Send buffering complete when seek is issued
  when player is in buffering state

Change-Id: If1650f02ffda10e0d8ca4a9c7fd0a5681d05e75e
Signed-off-by: jmeng <jmeng@codeaurora.org>
libstagefright: Fix AV sync issues

- Add edit list support for video playback.

Change-Id: I67cb9026255ddfe2d946a6e5972705b1b0c8a527
CRs-Fixed: 362885
libstagefright - Fix timestamp overflow

 - change time related variables to 64 bit to avoid overflow
 - composition time calculations were having overflow in
   SampleIterator and it propagates to the rest of the time
   related information for the frames

Change-Id: I035cbfaced1215eb1afd2c6cb900116e46006994
libstagefright: Add fix for mpeg4 data partition clips

- QC firmware does not support mpeg4 clips with data partition,
  but Google software decoders support these clips.
- Add logic in OMXCodec to parse the VOL header passed from
  QC parser to OMXCodec through kKeyRawCodecSpecificData
  for data partition bit and fallback to software codec if it
  is found.

CRs-fixed: 488740
Signed-off-by: jmeng <jmeng@codeaurora.org>

Change-Id: I04772d7173a075b70f7a34bef2d2877b280c7f07
libstagefright: Fallback to software encoder for high resolutions

Add error check conditions to fallback to software encoder if
q6 encoder fails in configure codec. Q6 encoder fails
for resolutions greater than FWVGA

CRs-Fixed: 511608

Change-Id: I4d765f45cd3b9c128260e7c96f139b671950d0ce
libstagefright: dynamic port reconfig handling

- Add support for dynamic port reconfiguration handling in OMXCodec

CRs-Fixed: 500703
Change-Id: I711d4b1114be791789607bc5dabc6d4496c182c0
libstagefright: Checks before freeing buffers on a port

- OMXCodec calls dequeueBuffer on the NativeWindow in a loop
  and registers output buffers with the OMX component.
- If a dequeueBuffer fails, the buffers already registered
  with the OMX component were not getting freed laeding
  to a memory leak.
- On an error, check state of OMXCodec before freeing buffers on a port.

CRs-Fixed: 393352

(cherry picked from commit f2e982497c5d16db14812ee09cef5cbdf0d96331)

Change-Id: Ib4eb48c189197d253e4175708ce1778b9c92f315
audio: Add A2DP notification support

 * Forward porting this code.
 * Sends notifications to legacy LPAPlayer for routing A2DP thru LPA.

Change-Id: I53eebda30b2e5cd60eeac5eb2a4cdb53e38381c9
Merge branch 'cm-10.2' of https://github.com/CyanogenMod/android_frameworks_av into cm-10.2