libstagefright: support for disabling buffer metadata

- Metada mode video recording is enabled by default.
- use setprop debug.camcorder.disablemeta 1 to disable metadata mode recording.

PS2: Disable metadata mode in timelapse mode too.

Change-Id: I422c49c0ace0c3a3e1f4459c7e4bf29e70af763a
libstagefright: Add msm7x30 to the legacy alsa audio check

Change-Id: Ia936d9b04e99d942ee9af37be81e3b81add6698c
libstagefright: Disable multi slice mode

- Disable multi slice mode video encoding for all
  targets

CRs-Fixed: 573731

Change-Id: I5087cbd2b2932b08e2c663be25104d82fc766ad4
libstagefright: Handle error on allocate buffer failure

Set state to error on allocate buffer failure at start(init)
of decoding.

Change-Id: Ice54f2d3f9cb087dd1f8f14913aacb632c4a8f9a
CRs-Fixed: 332373
libstagefright: Update handling of SBR explict siganlling

In case of SBR explict signalling in the bitstream, the core
AAC sample rate is overwritten by extension sample rate.
HW AAC decoder relies on core sample rate to parse the
bitstream when supplied in raw format.
Do not overwrite core sample rate but store it as separate
field in the meta data.

CRs-fixed: 572242

Change-Id: I5c70cfcc40a44bff9f9da4082c6b4dccd7c6788e
libstagefright: Set the maximums AAC framesize

The maximum AAC frame size is made equal to 8k*4
to handle multiple AAC frames in single buffer.

CRs-Fixed: 505248

Change-Id: I7c7e07620e2da8e1efe3914ebf73832f2f885ec9
frameworks/av: Enable subsystem re-start for LPA/Tunnel

-Audio Daemon in Audio HAL intimates AudioFlinger
 of ADSP status (online/offline) using set_paramaters.
-AudioFlinger send set_parameters to its clients
 which is DirectTrack used for LPA/Tunnel playback.
-In case of ADSP crash during LPA/Tunnel playback,
 clean up of DirectTrack is initiated.

Change-Id: I87f720f305765e00e12032eed3e018aeff952390
(cherry picked from commit 02861e0f092c46640576bb8c700418ed82c266c3)
(cherry picked from commit 5abe97aa9e103420813b87e7abb2b676ffe8d097)
(cherry picked from commit 9a27f1e6c449585095e518f0d2f44e621ef18f52)
camera: Allow any target to use message management

 * Previously this was set for QCOM only, but it has
   value for other cameras who have janky drivers.

Change-Id: I233bbd544388a7f019db48034c21d4406f9e33b4
audioflinger: OffloadThread state fix

When switching from one offload session to another that
reuses the same offload output, audio HAL is paused & flushed in
preparation for the new track.

OffloadThread must reset mHwPaused to allow proper state transitions
for the second track.

CRs-Fixed: 578165
Change-Id: I8173845e1782b5a8b372a82c7d337299a61e0efe
nuplayer: Fixes in nuplayer Renderer

- Fix in AV sync calculation for video only stream's pause
  scenario

Change-Id: Ie4fae760ca485ee21121cf4018a62d5d86eacb57
Nuplayer: Fix no image or image will be delay issue

- Fix no image or image will be delay issue
  while using Wifi VOD RTSP program

Change-Id: I7b32fb2ef80f46557c6c76118783245f8488812f
libstagefright: Fix for video can't be played if BT is connected

-Issue: Video can't be played if BT is connected.
-Rootcause: Source code to handle fallback to software decoder
 if offload audio track creation fails is not present.
-Fix: Add source code to handle fallback to software decoder
 if offload audio track creation fails.

Change-Id: Ie136a2117dd3f028c962b8b73ebc238bc982d79b
CRs-Fixed:  593230
stagefright: Relinquish lock in OMXCodec while waiting for ANW buffers

This lets CallbackDispatcher continue working in the background
to deliver the component's messages to OMXCodec.

Change-Id: I357e2da269671ef365c004276ea0601d696d2efa
libstagefright: customize delay to post video events

Calculate delay as a function of lateness rather
than fixed 10ms.
When video frames are decoded quite early, this
change will delay the wake up of video events.

We save some unwanted wake up of video events
which save power.

Change-Id: I12839b9df62d453f394894b499491e2cac3a0c8a
CRs-Fixed: 578988
libstagefright: set threshold for earliness

Change the threshold value for earliness to 40ms
This fixes the av sync loss issues.

Change-Id: Ib912048987e8e6187dc37d5dbaff5d1ead224c61
CRs-Fixed: 584417
libnbaio: Don't call get_presentation_position for pre KitKat blobs

This fixes a crash with the HTC Tegra3 audio blob where
mStream->get_presentation_position is not NULL but pointing to a unknown
position in memory.

Change-Id: I0ff0ab064c1ac16a128bb3f24d4a473b3164f36d
libstagefright: Return EOS after buffers are released

Return EOS from SurfaceMediaSource after buffers
have been released, due to disconnect from producer..

CRs-Fixed: 550868
Change-Id: I4b2f3ef1c2895f155260baa0c58d90df4b4210d9
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
libstagefright: Add hooks for extended media utils

Add following enhancements:
 - Shell property to disable audio
   property: persist.debug.sf.noaudio
   0 = all audio enabled
   1 = audio decode disabled (AwesomePlayer)
   2 = audio encode disabled (StagefrightRecorder)
   3 = audio encode & decode disabled
 - Shell property to override encoding profiles
   property: encoder.video.profile
   H264 profiles: base, main, high
   MPEG4 profiles: simple, asp

CRs: 573176

Change-Id: Iec32177cae40b0de606b52bbbd41eb24b1643c56
av: Cleanup a lot of QCOM cruft

 * Remove some legacy code to bring us closer to kk_3.5

Change-Id: I5c2ec1b7da9281adfcb1eb6ff9ca71d423a2e07b