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)
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
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
libstagefright: Fix intermittent pause during tunnel A-V playback

-Media time is used in onVideoEvent for A-V sync. In offload
 playback we only use realtime(time from DSP).
-Media time should be same as real time. If media time is not
 updated with the real time value A-V sync issues are seen.
-Update media time to real time value to avoid intermittent pause
 during playback.

CRs-Fixed: 572060
Change-Id: Ib1123b7554f3508230ca67cd20a68fa32c753057
Revert "frameworks/av: rendering statistics for Stagefright."

This reverts commit 1a65f74eebe15e1533ebde98268a454a8b14f815.

Change-Id: I755e293705a72d90a4a855343439b625226c050b

Revert "libstagefright: adjust AV sync late margin based on property"

This reverts commit 14b0bb438a8b3291edd10fb068656e707a31cfb5.

Change-Id: Ibcc3573283282b3f52a813c789f8586965bbc088

Revert "libstagefright: post video events dynamically - calculate amount of time to delay video event after renderusing the formula: delay = (us between frames)-(us taken by event)-(lateness)"

This reverts commit 1ac2a4f83f7d14b3a4d9c4691a5d6bb62fcc5522.

Change-Id: I06b8023d45a2ea1497a87d5adf7bfa7e74dc0710
stagefright: add rendering statistics

 - adds extra fps statistics
 - report via dumpsys
 - prints statistics before reset at the end of playback onto
   logcat
 - adds resume latency, from play_l to render
 - adds seek latency, from seek_l to render
 - enables using persist.debug.sf.statistics 1
 - prints all statistics when seek or resume is issued

Change-Id: I6fa34f3d0180c1b8bbad40da42bd241fb89e6866
libstagefright: print seek statistics even when paused

 - if seek is issued during paused state, SEEK_PREVIEW flag is set
   and statistics needs to be printed even if that happens.

Change-Id: Ida5040d2961bff4dfb8a53b50be01609aaac9976
CRs-Fixed: 512801
libstagefright: Filewrite in seperate thread for single video track

For files with single video track, the filewrite() and OMXRead()
operations are happening in the samethread. It impacts the
recording performance.

Hence moving filewrite to seperate thread for files with single
video track.

CRs-Fixed: 574807

Change-Id: I3a9bf7869e197973a85783510254cf66b8d1d91b