Adding framework support for multichannel audio

Add the libmedia and libstagefright changes required for the
proper integration of the Dolby Digital DD+ Decoder. This patch
contains only the non-proprietary changes. The codec and prebuilt
binaries should be obtained separately and legally.

To enable the use of DD+ Decoder to playback AC3/EC3 formatted content,
please set the required environment variables prior to building.
These could be added in device/<vendor>/<product>/BoardConfig.mk for
example. Secondly, the prebuilt binaries and codec headers that match
the target platform should be copied into the proper location within
media/libstagefright/codecs/ddp

Change-Id: I27d9450dee51def2163dc8d60f39d1519232318b
Signed-off-by: Chris Kelly <c-kelly@ti.com>
Signed-off-by: Barry Woodward <a0270655@ti.com>

Conflicts:

	include/media/stagefright/MediaDefs.h
	media/libstagefright/AudioPlayer.cpp
	media/libstagefright/MPEG4Extractor.cpp
	media/libstagefright/OMXCodec.cpp
SF: Added correct handling for malformed mpeg2ts stream

Modified CHECK_EQ/CHECK_GE comparison (that contain exit 1;) to return ERROR_MALFORMED status.
Corrected size for skipping bits for BitReader in parseAdaptationField
Added check for correct processing ERROR_MALFORMED status in MPEG2TSExtractor.
Increased counter for parsed packets (using 10000 we can't get succes for VideoStream detection)
Because there are a lot of broken data in a beginning of stream.

Change-Id: I20a5641dd9e86f99c51d2f96a0b838e36aac9657
Signed-off-by: Sergii Doroshenko <x0163979@ti.com>
StageFright: Skip the TimeInterpolator FIRST_ROLLING state.

The TimeInterpolator's FIRST_ROLLING state was a scheme to start the
AudioPlayer's clock immediately.  For the length of the latency, it
would roll along using the system's monotonic clock.  The normal
TimeInterpolator algorithm kicked in after the latency had elapsed.
When the TimeInterpolator algorithm engaged, it would typically slow
down the clock for a short period (about .5 sec) until the clock
aligned with the start-up latency.  (The start-up latency is usually
not the same as the latency.)

The result is that the first 1-2 secs of video aren't synchronized as
well as the rest of the video.

This patch bypasses the FIRST_ROLLING state.  Suppose the video time
is at 0.  When the video starts rolling, m_pos0 is moved from 0 to
-latency/2.  For a while, the TimeInterpolator provides negative
timestamps.

In practice, good sync is typically achieved within 3-4 video frames.
This is partly due to using latency/2 as an estimate of the start-up
latency.

This is an intermediate patch.  The following patch will totally
remove the FIRST_ROLLING and FIRST_PAUSED states.

Change-Id: Iea3f3c15efa17e7f2df9418645b2c98f42abb167
Signed-off-by: Gabriel M. Beddingfield <gabrbedd@ti.com>

Conflicts:

	media/libstagefright/AudioPlayer.cpp
StageFright: TimeInterpolator: Completely remove FIRST_ROLLING and FIRST_PAUSED.

These states have been obsoleted by the previous patch.

Change-Id: I667a04e3d7c456014a35d8d24269a79c05e116cb
Signed-off-by: Gabriel M. Beddingfield <gabrbedd@ti.com>
StageFright: TimeInterpolator: Remove m_overruns

The idea behind m_overruns is that if they happen, then we can recover
by tweaking the value of m_latency in the TimeInterpolator formulas.
In reality, it usually made things worse.  Removing.

Change-Id: If31d6fa309218539acde4796f03daf0de2e9aea5
Signed-off-by: Gabriel M. Beddingfield <gabrbedd@ti.com>
StageFright: TimeInterpolator: Short circuit set_state() when not changing

Reduces log verbosity.

Change-Id: If745fa3b8b98686266b368e5df57e64970354c3f
Signed-off-by: Gabriel M. Beddingfield <gabrbedd@ti.com>

Conflicts:

	media/libstagefright/AudioPlayer.cpp
StageFright: TimeInterpolator: Do not give negative time-stamps.

This is required to pass
android.media.cts.MediaPlayerTest#testPlayAudio.  It prevents
AwesomePlayer from accurately predicting when the first frame should
be scheduled, but the negative effect only lasts for 2-3 frames.

Change-Id: I5bd79fc1dd1b74b951988b54163b0166764a5e64
Signed-off-by: Gabriel M. Beddingfield <gabrbedd@ti.com>
AudioFlinger: Adding supported for WFD audio HAL

Adding WFD HAL support that will be used based on
AudioPolicyManagerBase changes

Change-Id: Ief5ef70dd30f49c286f31d2fbc23ca0b13ad8f17
Signed-off-by: Priyesh Bisla <a0271372@ti.com>
Wifi Display: Adding new stream type for cinema mode support

Initial set of minimal changes to add new audio stream type
Added for Cinema mode support
Changes done to java level audio code

Change-Id: I9a42e823a535609db4d0bdb92da51e548728b8b6
Signed-off-by: Priyesh Bisla <a0271372@ti.com>

Conflicts:

	media/java/android/media/AudioManager.java
	media/java/android/media/AudioService.java
	media/java/android/media/AudioSystem.java
	media/java/android/media/AudioTrack.java
MatroskaExtractor: Workaround for playback for mkv files with lacing.

Most mkv files having 'lacing' in their audio section to save space.
Android did not handle this properly, sending all frames in the block
with the same time code, which causes stuttery playback.

Ported from CyanogenMod. Change-Id: I4dc76e7c2a53126c7fbdd3628fe7d339d2e3364e
Original author: Pawit Pornkitprasan <p.pawit@gmail.com>

Change-Id: Ia70bdbc9d7ffe9bf12f48690683f60a90b697829
Signed-off-by: Illia Ragozin <x0160199@ti.com>
AACExtractor: Added support for APE tag

To support aac audio with APE tag we need parse
this tag. Otherwise AACExtractor stops reading of
audio file.

DR: OMAPS00267689

Change-Id: I4e8b9e65df1b200d07eddf8111d8161ba5834c85
Signed-off-by: Volodymyr Makhitko <x0158990@ti.com>

Conflicts:

	media/libstagefright/Android.mk
Use correct domx include directory

choose the correct domx include directory for the
build. just clean-up.

Change-Id: Icb7ffb58b1a48fe592c99b168b4d0ab61b5a3446
Signed-off-by: Vladimir Petrov <vppetrov@mm-sol.com>

Conflicts:

	media/jni/mediaeditor/Android.mk
	media/libstagefright/Android.mk