libeffect: Fix enabled effect count calculation error

When switching from tunnel to arm effects, effect chain will be moved
from offload thread to mixer thread. During this procedure effect instance
is not destroyed, instead it's preserved and mounted onto new chain.

The migrant sequence is 1) disable instance -> 2) move to new effect
chain -> 3) enable instance again. However, the accumulated effect
enabled count is not decreased when effect instance is disabled.

As a result, LvmBundle_process() is only called once when Effect_process()
called twice, which causes input buffer get processed alternately and
glitch sound appears.

Change-Id: Idd3b8753a73694cc36617ed55b40fda93155abed
CRs-Fixed: 636353
audioflinger: Do not apply effect on multichannel content

-Do not apply effect on multichannel content.
-Effects are applied only for mono or stereo.
CRs-Fixed: 484078

Change-Id: I4af38ccb5e081e740121fd387d290e4f439c84ae
libstagefright: Decrease reference count before deleting AudioPlayer

-Reference count of AudioSource is not decreased to 1 before deleting
 AudioPlayer, and thus cause the thread blocked in an infinite loop
 due to the AudioSource object is not deleted
-Decrease the strong reference value of AudioSource before
 deleting AudioPlayer

Change-Id: I804211dcca91213c62a4d622baf2001f3cc9955b
CRs-Fixed: 691668
NuPlayer: Fix parsing RTSP play response from special server

- In some non-standard server, a different play response will be returned,
  which will cause CHECK failure
- Change in parsePlayResponse(), to get the current track index

Change-Id: I467e3000732cf1506095b17dc29eed25e6701150
CRs-Fixed: 621854
RTSP: Fix crash issue while repeated pause/resume

While doing repeated pause-resume operation in RTSP streaming,
some times, the accessunit timeout check is being posted when
the streaming paused, and even after receving the EOS.
Due to this check, after the EOS, the number of packets received
will be zero and the session gets Teardown while the
streaming is paused. Upon resume, it leads to check failure and crash.

Changes are done such that the accessunit timeout check will
not be done in pause/seek state.

CRs-Fixed: 636312

Change-Id: I60d09d5394eed59a8e2bbf5556628f1ea26f7807
stagefright: Handle missing text track language

Only set timed text language if kKeyMediaLanguage is found.

Crs-Fixed: 641896

Change-Id: Ie471bc458e42f5728064e447ac5c33b07311d3fd
Audio: fix stop issue for compress capture using MPEG4Writer

- Return stop status for mSource in MPEG4Writer::stop.
- Stop audio source after pthread_join to avoid ANRs, same logic
  is used in all other writers.

Change-Id: I5edc6a6d5aaf363abc7e86e9ed12f1f9a4bdc85a
stagefright: Move B-frame enablement to ACodec

Remove B-frames related code from OMXCodec since
MediaRecorder now uses ACodec.

Calculate nBFrames and nPFrames to configure requisite
number of B-Frames per P-Frame.

CRs-Fixed: 701344
Change-Id: I66f279f42ea79499e9e6b5c4f288ea82eb868dda
libstagefright: Fix crash while setting buffer size

The format returned from MakeAVCCodecSpecificData may be
NULL and will crash on trying to set buffer size.

Add NULL check to avoid crash

Change-Id: I45485f820a6aa657e63aeeb6dd43061a2e3575e3
CRs-Fixed: 644331
libstagefright: stop audio source before deleting AudioPlayer

-audio source won't be stopped during AudioPlayer destruction
 due to start failed and AUDIOPLAYER_STARTED not set
-handle audio source stop in AwesomePlayer if AUDIOPLAYER_STARTED
 not set

Change-Id: I395c045a0a8a5d5b6ea8cc762d6a2636bb885b0e
CRs-Fixed: 704605
libstagefright: Do not offload HEVC AV decoding

- Add compress offload exception for HEVC audio
  decoding.

Change-Id: Ic78cb1587b869c5e329b47fcd5b4a5bc199a9b18
CRs-Fixed: 599669
NuPlayer: Fix ANR while resetting RTSP playback

- When network is poor, the response of RTSP teardown won't be received
  in time, so ANR will happen.
- With this patch, a teardown message will be sent when timeout expires,
  in order to avoid ANR.

Change-Id: I3f9efd9fefa66104ad452559ced5ff5218d73a66
CRs-Fixed: 650866
NuPlayer_RTSP: Add "Range" in the request "PLAY" while starting to play

- As default, no "Range" item in the request "PLAY" which is sent at
  starting to play the streaming. The streaming source will be played
  from the very beginning.
- Now, add "Range = 0- \r\n" in the request "PLAY" while starting to
  play the streaming, in order to meet the requirement of China
  operator.

Change-Id: I7e78050beaf576fab1f5eb75565ca5f300776e72
CRs-Fixed: 576084
libstagefright : Allow seek in RTSP VOD streaming using Helix Server

- In the current design,when the server sends npt=0- in Play response,
we treat it as live stream, without cross verifying in SDP.
- Helix server specifically sends npt=0- for the Play Response
- This change cross verifies the npt in SDP and if it is a VOD
clip, the duration returned is greater than Zero, and we allow seek.

Change-Id: Ic76510fa4d80ef9051a5d6d923bd5d757c279f19
CRs-Fixed: 498057
rtsp: Add a property "rtsp.transport.TCP"

- Add property "rtsp.transport.TCP"
  Value "true" - TCP
  Value "false" - UDP
  default value - false

Change-Id: Ic27b440067af49e7e3bcc45d86eb7a17ae9db54f
CRs-Fixed: 435538
libstagefright: Get rtp port range and cache size from system properties

- Operators require setting rtp/rtcp network port range and cache size.
- Parse rtp network port range from persistent system property
  "persist.sys.media.rtp-ports".
- Get cache size from persistent system property
  "persist.sys.media.cache-params", in order to store the value.

Change-Id: Ie044682c422d71f018e509a89a19d976f313e27c
libstagefright: Disable multi slice mode for video encode

Currently framework sets slices per frame as 256. This impacts video
performance and bit rate heavily. Hence disabling multi slice mode
video encoding for all targets.

CRs-Fixed: 705887
Change-Id: I2734c8ca7f72b89d16d41eae33aa69a6cde62bfc
RTSP: Don't post AUTimeout check during pause when EOS is nearing

RTSPSource will not issue pause to MyHandler when streaming is about
to finish even when streaming is paused. Thus, in this case,
the accessunit timeout check will continue to see if any packets are
received or not from the server. As there will not be any more
access units coming from server after EOS, the session gets terminated.
In this scenario if resume is issued, the player crashes.

Set the AuTimeoutcheck flag to false in case if pause is not
issued to MyHandler when nearing EOS. Based on the value of the flag,
the access unit timeout check will be performed.

Change-Id: I9bdbc6bb21e441e22ed431a9e433b232df56a69e
CRs-Fixed: 676054
NuPlayer: Check if video input format is NULL

Adds null check on querying for video input format metadata.
CRs-Fixed: 582533

Conflicts:
	media/libmediaplayerservice/nuplayer/NuPlayer.cpp

Change-Id: I3832de56f67bf8e6b4abb426c6e539dd66009fa5
audio: Add support for compress voip

Add support for compress voip path where voip driver
is used instead of audio playback/record path for voip
applications.

Conflicts:
	media/libmedia/AudioTrack.cpp

Change-Id: If4084e8fd5d374b2159cf0e222ba1a7e139aac49