libstagefright: Use proper ctts offset

Calculate ctts offset as difference between composition
time and decoding time, and avoid adding kMaxCttsOffsetTimeUs
as it increases the sample timestamp by the same amount
which leads to av sync loss.

CRs-Fixed: 524739
Change-Id: I75a1bb594536623e3a445af2ee1ceb0cf0926a6e
libmedia: Update the DSDA tone frequencies

Change the DSDA tone frequencies to 450 Hz
for Hold Recall, Local Call Waiting
and Supervisory/Local Call Hold tones.

Change-Id: I8cfffdff51c02112ec690bbb26781813c24b8e79
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

Conflicts:

	media/libstagefright/ExtendedCodec.cpp
libstagefright: Add support for AC3 and EC3 playback in tunnel mode

Add support for AC3 and EC3 playback in tunnel mode

Change-Id: If5de26d3ff9e63737d6ed43b904c6094f93fbfc0

Conflicts:

	media/libstagefright/StagefrightMediaScanner.cpp
libstagefright: For interlace, set decoder in arbitrary mode

In arbitrary mode, frame parsers sends individual fields
to core. Once both the field is decoded, output done (FBD)
is sent back to client.
Default frame by frame mode will send both the fields in
a single buffer to core, which might decode only one field
or will throw up error.

CRs-Fixed: 531034
Change-Id: I31844093b6a93d3a62577fc8d799353d30573c17
libstagefright: Use software audio decoder for HEVC video contents

-Tunnel mode audio is not supported for HEVC video contents. This
 is a dsp constraint because HEVC video is decoded in DSP. Use
 software audio decoder for HEVC video content.

Change-Id: I77a30d9ce5e3aaa26389bfc0a14e2b0b2c2e7ced
libstagefright: Use appropriate reset call for amrwb decoder

-onPortFlushCompleted is calling Speech_Decode_Frame_reset
 for both AMRNB and AMRWB clips but Speech_Decode_Frame_reset
 is not used for AMRWB decoding. This is causing corruption
 of AMRWB decoder's state during seeking.
-Fix is to call pvDecoder_AmrWb_Reset during AMRWB Decoding

Change-Id: Ibf0ebc7b154ff4866211eaf178a447f96e33341c
CRs-Fixed: 534094
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: adjust AV sync late margin based on property

- Current AV late margin is 40 ms
- Read system property media.sf.set.late.margin and if
  new AV sync late margin is set then use the same
- Max AV sync late margin allowed is 250 ms
- Min AV sync late margin is default 40 ms

Change-Id: I65cd3dce9b31b87f1488c37af9618669b29c362c
frameworks/av: Audio Resource Manager changes for concurrency

-Do not allow LPA/Tunnel ringtone.
-Use fast track for ringtone/enforced audible/alarm/system sound/notification.
-Audio Flinger changes to suspend /restore direct track
-SetParameter changes in stagefright.
-Identify usecase in stagefright framework.
-Set/reset the use case when the player/recorder instance is created and deleted.
-Set/reset the use case when player/recorder is paused and resumed.
-Add codec flag to differentiate music stream and ULL stream.
-Add pause/resume flag/interface to inform codec about pause/resume.
-Add a new file for concurrency changes in Audio Track.
-Add resource manager macro for audio flinger make file in the correct place.
-Add function to set pcm recording / pcm playback usecase for voip applications using
audio path and also native apps which does not use stagefright framework.
framework/av: Reduce LPA bufsize as to 128KB to save power for SA+

Root cause: SA+ bassboost takes more than two times the MIPS as NXP,
which causes normalized CPU load burst when AP is running, then firing
up 2nd core and consume more power unexpectedly.

Fix: Reducing the LPA buffer size from 256KB to 128KB will decrease the
MIPS required for each round of effect process and keeps the 2nd core
offline.

Change-Id: Ib1982dd2a7544c82971bf6b74ebc58216d247e77
Adding aec ns feature in audio_effects.conf

- Adding support for aec and ns support

Change-Id: Ic3cb6aecbe4862b27bcd9604d9118ef8c39d3da0
libstagefright: Reduce redundant logging

Modify the redundant logging to verbose level

Change-Id: Ib54217028f3a9ee3401791209e101938ca821565
libstagefright:OMXCodec:add QOMX_COLOR_FORMATYUV420PackedSemiPlanar32m

--Qcom encoder component has used the
  QOMX_COLOR_FORMATYUV420PackedSemiPlanar32m as the Qcom aligned YUV420SP
  format type.
  Add this format in related functions which determine the supported
  formats to avoid crash in these functions.

CRs-Fixed: 530956

Change-Id: Ifee4b5553d2900c1c61087f0947a288322c421ba
libstagefright: fix tunnelplayer error log for unsupported types

TunnelPayer unsupported error log was seen for AC3/EAC3 media
types, fix to print this log after checking for these types.

Change-Id: Ib4a7490168a4af7ec6e0681d36e2510d0fc6eebd
frameworks/av: Restrict to one voip direct output thread

As voip driver supports only one instance, restrict
the opening of direct output to one

Change-Id: Ia513622cd118967948d90cc9282530db4f3a0372
CRs-Fixed: 504323
Revert "frameworks/av: AAC CSD support for MediaCodec path"

This reverts commit 74a7b1cb44e10b9c213fb110264b6bab410d8fff.
Currently AAC CSD is retrieved in MediaCodec using
kKeyAacCodecSpecificData. This support was added as part of
commit Id046b0d4bf96f029c1b6b5d78d753073e38ac841.

Change-Id: I54bc6204c1fe88f4e4545f501e6bd1bb2a8beaf9
CRs-Fixed: 527284