[StageFright]: WiFi/Ethernet streaming cache fix.

If audio and video positions data were separated with some gap,
issues like frames dropping and video glitches might arise.
This patch is intended to fix those issues.

Now the using the cache source module kepts two access
positions: minimal and maximal. To release unneeded anymore
cache pages the module refers to minimal access position while
to expand the cache - to maximal one. Actually, they are video
and sound data positions. Low water value is changed to
7 * 1024 * 1024 to fit AwesomePlayer cached duration value.

Another change is releasing of cache pages at every data read,
not only on approximating of maximal access position to upper
bound of the cache.

Change-Id: Id62e7be1d40172557746b116ace0abe18a0246d7
Signed-off-by: Sergii Iegorov <x0155539@ti.com>
LiveSession: checking meta for playlist in live session.

This is necessary to check if mMeta is already exists in mPlaylist
before try to get any data from it in timeToRefreshPlaylist method.

Change-Id: I93ea089f470e921ab19fa78bafbf63dc77b1c817
Signed-off-by: Illia Ragozin <x0160199@ti.com>
StageFright: enable mp3 audio for mp4 container.

Enabling mp3 audio in mp4 container, which was not supported in HC.

Change-Id: Ia8ee105a9bcf6d898be259aeb51b8ec2aa7f5b79
Signed-off-by: Illia Ragozin <x0160199@ti.com>
AVI extractor: Save fps information

Calculating fps (dwRate/dwScale) in .avi container and
saving it as kKeyVideoFPS for future reference.
This information was missing, hence VC1 60fps clips were
playing at 30fps, hence resulting in issues for 60fps.
Fix the same.

Change-Id: I5d1de853807f92c33ef976e97a2c83ad80184213
Signed-off-by: Anviksha Khare <anviksha@ti.com>
AudioFlinger: Add resampler using Speex library

In addition to earlier quality settings there is a new setting, which
uses libspeexresampler from external/speex directory. The output
quality with SPEEX_QUALITY is better than with HIGH_QUALITY
setting due to a proper anti-aliasing filter.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
Change-Id: I64aef1fbf3f0802d9f1948328b9864c603c878a0
AudioFlinger: Move sample-rate conversion check to resampler class

This patch moves the resampling ratio checks to AudioResampler
class. With this patch it is possible to exploit Speex resampler's
flexibility of selecting any resampling ratio.

Change-Id: I7cfadb540291be0c5ec7fe13d0c42fb54c98ef50
Signed-off-by: Jyri Sarha <jsarha@ti.com>
[StageFright]: WiFi/Ethernet streaming cache tuning.

Enhancing gray area to 2 MB as some Windows Media Files need for
smooth streaming and preventing the cache from unlimited
enlargement. Even if the stream is accessed strictly sequentially
so minimum accessed position is always 0, the highwater threshold
will limit cache expansion.

Change-Id: Ife9a52e2114e1c2896624a74d1fd3e15616a47f2
Signed-off-by: Sergii Iegorov <x0155539@ti.com>
[AudioFlinger]: Adding postprocessing hooks

Adding hooks for a suite of 3rd party postprocessing algorithms

Change-Id: I59177bb58088f83bf4b2953f78f65eb303105339
Signed-off-by: Barry Woodward <a0270655@ti.com>
st: add takeCurrentBuffer() and releaseBuffer()

SurfaceTexture owners should use these new APIs to get and
take a reference to buffers. This will allow owners to
grab multiple buffers and make sure clients can't
dequeue them.

Change-Id: I2348f0c91cb19c5119e843e732701261322cbd21
Signed-off-by: David Schleef <ds@ti.com>
Signed-off-by: Tyler Luu <tluu@ti.com>
st: sdk: expose api to get metadata

This exposes a hidden getMetadata API in the SurfaceTexture SDK
for applications to get metadata set by SurfaceTexture clients

Change-Id: I7bbf4151d3745899ae454848ebbe4737795b9e3a
Signed-off-by: Herve Marechal <h-marechal@ti.com>
Signed-off-by: Tyler Luu <tluu@ti.com>
st: fix updateTexImage Autolock

Changes to updateTexImage for CPCam resulted in some faulty code
that didn't actually keep mMutex locked in the function resulting
in some random behavior involving all usecases that require surfaces.

This change keeps the Autolock within the proper scope and sets the
graphic buffer within updateTexImage instead of updateAndGetCurrent.

Change-Id: I2104118025c64b3660f2c880834b293b3db6d2ff
Signed-off-by: Tyler Luu <tluu@ti.com>
MP3Extractor: Calculate duration when XING and VBRI headers are invalid

XING and VBRI headers can contain number of frames value
equal to 0. Number of frames affects the duration value.
As a result, the audio player shows the total  duration
as 0 and track can not seek.

This patch checks if the duration is valid (>0).
If not, the duration is calculated another way.

Change-Id: If3168736aee943c5c9ef2c5268161dd4d4dfc601
Signed-off-by: Volodymyr Makhitko <x0158990@ti.com>
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>