libstagefright: Add support for H/W AAC decoder

- Currently, only software AAC decoding is supported.
- Add support for H/W AAC decoding by including it in the
  list of available decoders and use it for decoding only
  if the property 'media.aaccodectype' is set to 0.

Change-Id: I4bb9df1bd10bd8ee91e63dadd6c473fc4e29813a
CRs-Fixed: 449145
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

Change-Id: I4d765f45cd3b9c128260e7c96f139b671950d0ce

CRs-Fixed: 511608
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
libstagefright: Add Dolby UDC decoder support

Add support for ARM based AC3/EAC3 decoder

Change-Id: I63e994fca23479ea9f7c68d5f008eed00cbafffd
audioflinger: Fix for race conditions in direct audio track

-Issue: Mediaserver crash is observed in direct track functions.
-Rootcause: Between write and flush functions, write and destructor
effectpool buffers are accessed without any synchronization that
might lead to operations on null buffers and cause crash.
-Fix: Use mEffectLock to synchronize access of effectpool buffers.

CRs-Fixed: 515107
cherrypicked from Ib071361c65b390f9486c0a080a9391f176392b30

Change-Id: Id9e14a054d699ec803e23619ef475696b0021d4f
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.

CRs-Fixed: 482838

Change-Id: Ie023cb005b3085da411971a543f5a4290daab137
(cherry picked from commit 685bc9eac4bed32dd00fcb1e71f042b7e52e6958)
frameworks/av: Add support for EVRCNW voip format.

Add changes needed to support EVRCNW audio format for voip calls.

Change-Id: I18ef3d208853b533ab5fd1d6ea655396de2d3a49
libstagefright: Create Extended Extractor for HEVC and AMRWB+

- Create Extended extractor when
  . Audio format is AMRWB OR
  . Default extractor not able to find any track OR
  . Default extractor finds one track and is Video OR
  . Default extractor finds one track and is neither Audio nor
    Video OR
  . Default extractor finds two or more track, and either Video
    or Audio or both tracks(s) not present OR
  . Default extractor finds both Audio and Video track found and
    Audio format is AMRWB

Change-Id: I17d56c72d8f76314be9bb7ac4fc1b7ac88f2d762
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
libstagefright: Add support for AC3 and EC3 playback in tunnel mode

Add support for AC3 and EC3 playback in tunnel mode

Change-Id: If5de26d3ff9e63737d6ed43b904c6094f93fbfc0
libstagefright: Add support for WMA in ACodec

- WMA support is not there in ACodec
- In the case of wma format, since not getting the complete information of
wma version so instead of allocating the component in onAllocateComponent
function it will create in onConfigureCompoenent function.
bitspersample is find as "bsps" from AMessage while configuring the
WMA10PRO and WMALOSSLESS format

CRs-Fixed: 453951
Change-Id: I98baa701dbf8a5c012f4be5e83831c0be2111dcc
Merge "libstagefright: Create Extended Extractor for HEVC and AMRWB+"
Merge "libstagefright: Fallback to software encoder for high resolutions"
Merge "audio: fix meta MIME type failure in MPEG4Writer"
Merge "libstagefright: Add Dolby UDC decoder support"
Merge "frameworks/av: enable voip flag based on channelcount"
libstagefright: optimize thumbnail generation path

- Checking for YUV420SP format support is not intended for software
  decoders and can be skipped. This avoids unnecessary creation of
  hardware decoders for checking supported output formats.
- Change the flag from kPreferSoftwareCodecs to kSoftwareCodecsOnly.
  This will force software codecs to be tried first and not just "prefer"
  which helps when a software codec for a particular type of codec (like
  divx) doesn't exist and avods creation of hardware codecs twice in case
  of hardware failure.

Change-Id: I682bca5b6bac5a56f46fe3655cd722fe5f08e1e6
Merge "libstagefright: Add support for H/W AAC decoder"
Merge "libstagefright: Add support for AC3 and EC3 playback in tunnel mode"
Merge "audioflinger: Fix for race conditions in direct audio track"