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: I74855a4c3123a520379a54310d8674e381357e8b
stagefright: Add legacy MediaBuffer::acquireBuffer symbol

Needed by endeavoru libwvm.so.

Change-Id: I8c324f6b0f99d0ea360e875739a2bd564a815cbe
camera: Don't segfault if we get a NULL parameter

 * Values end up NULL on some drivers, don't crash.

Change-Id: Ic897dbd4629cf3af98c85f93be202c382dde806b
FLAC coded file does not play (single metadata block files)

FLAC files which has the last metadata block flag set in
STREAMINFO were not playing. Sniff of FLAC is modified to
accomodate this set flag.

Change-Id: I76f216cc2cde6e10958324afbc704fc3e5a0e2bf
Author: Gurudatta Bhakte <gurudattax.bhakte@intel.com>
Signed-off-by: Gurudatta Bhakte <gurudattax.bhakte@intel.com>
Signed-off-by: Shuo Gao <shuo.gao@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Author-tracking-BZ: 32421
stagefright: ExtendedExtractor is for QCOM_HARDWARE

Change-Id: I81a3c3a0b6b24a3e2fd5ce2808924f3cd4dc8e24
av: Use QCOM_BSP_LEGACY ifdefs for interlace handling

 * This demolished video playback on 8974.

Change-Id: Ifca5319669c463993fca05218c06ccf49cbe6c06
Clean some intermediates for BSP update

* Clean libstagefright, libmedia and libmediaplayerservice.

Change-Id: I3a8b35828c64f1e6452a29461809b1663987b61e
camera: Disable extra HDR frame on QCOM_HARDWARE

Qualcomm camera HALs default to adding an extra zero-exposure frame
to HDR snapshots; this is breaking third-party apps, and we don't
use it in system-bundled apps, so disable it unless explicitly
requested by the client

Change-Id: Iecb868c5c344d972de7f36dc1bd9cc9fdbabaf4e
accelerate camera recording start up speed

When do initial buffer submit, if do drainInputBuffers() first, it will always wait all input buffers reached,
and then start fillOutputBuffers().During this time, nothing to do in level codec, all time is cost on waiting,
it is especially severe for Camera recording case, for example, in 30fps case, If 3 input buffers are required,
HW codec will wait at least 99ms to start video encoding, since no outport buffer ready at this
time.

After change call sequence, fillOutputBuffers() is done fast firstly, then do drainInputBuffers(),
when receive one input buffer in HW codec, it can start working immediately, because the working condition is reached,
both input port and out port buffers are ready.

Change-Id: If74fd839f2bb0cae6c7d8ae0912d47abb2cdc045
Signed-off-by: jiguoliang <guoliang.ji@intel.com>
Signed-off-by: ywan171 <yi.a.wang@intel.com>
stagefright: Fix 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.

Change-Id: I4dc76e7c2a53126c7fbdd3628fe7d339d2e3364e
Set the correct audio bit rate for camera recorded content

Remove the hard coded value for bit rate and replace the value
with the information from meta data.

Change-Id: Ib643c79bbdddaafb3dc703448645606267f7ca4d
Can't play AAC file with ID3 tag.

When the file is scanned, the ID3 tag is found to have a
footer at the end of audio data. And getAdtsFrameLength
return zero after reading the footer. As a result, the
duration and mInitCheck are not set. The current change
considers the data till footer and sets the duration based
on no. of frames read till the footer/corrupt frame.

Change-Id: Ie8f898435f0d4ca31fdd355146c4db7b37c0b988
Signed-off-by: Arulselvan M <arulselvan.m@intel.com>
Signed-off-by: Jin Wei <wei.a.jin@intel.com>
Stop thread before deleting object reference

If setPeriodicCapture is called Visualizer will start a thread
and do periodic callbacks. When native_finalize is called the
reference to the class is deleted. If a callback happens after
this the reference is no longer valid and when used from the
callback method the vm crashes. With this patch the thread will
be terminated before deleting the reference.

Change-Id: I30f331437ddad05f8d52c244cdbecb1859a0abd2
Disconnect the mediaplayer when reset

When the mediaplayer is reset the strong pointer to the
media service client is destroyed and the client should
deconstruct. However this could take some time and if a new
client is connected before the old client is disconnected
there could be problems. By assuring that the client disconnects
these problems can be avoided.

Change-Id: I5d2cf6d22860aa616b14397b1f523ddc35197b83
Audio streaming error when playing a stream that contains "end of file".

Although EOS is being posted upon receipt of BYE message from RTSP
server, still it didn't reach the media framework and application.
This happens because the Nuplayer::Renderer::onDrainAudioQueue() funtion
returns false after mAudioSink->getPosition() call , and the EOS message
present in mAudioQueue was lost.The mAudioSink->getPosition() returns
NO_INIT as mAudioSink->open() is not yet called,
hence no audio track exists in MediaPlayerService::AudioOutput.

Change-Id: I905e8f3af87dc778952eeef3904c4e2a6a75ca7a
Signed-off-by: Arulselvan M <arulselvan.m@intel.com>
Signed-off-by: Jin Wei <wei.a.jin@intel.com>
Support MPEG4 codec in Matroska files

For MPEG4 the matroska parser must handle files with and without
configinfo in the codec private data.

Change-Id: I7025772c87ee24bc074bd3837f6877552245e389
Support AAC audio (WaveFormat = 0xFF) in AVI container.

Present AVIExtractor doesn't support AAC audio. So some AVI clip with AAC,
AAC-HEv1, AAC-HEv2 audio, can't be played from gallery.
With this fix, added support for AAC audio (WaveFormat = 0xFF) in AVI container.
Also added a condition to check the sampling rates which are supported and return
error if unsupported sampling rate is encountered, to avoid tombstone crash.

Change-Id: Ic8f081ed254ce8c0b3c0cbd1c3811b89b18c6e8e
Signed-off-by: gbhakteX <gurudattax.bhakte@intel.com>
Signed-off-by: Mazhar <mazharx.sameullah@intel.com>
Support MP2 contents in AVI container.

In present code only "Wave Format = 0x55 (MPEG Layer 3)" is supported in AVI container.
With this fix, adding support for "Wave Format = 0x50 (MPEG)".
As per "RFC 2361 - WAVE and AVI Codec Registries":
A.45 MPEG
WAVE form Registration Number (hex): 0x0050
Codec ID in the IANA Namespace:      audio/vnd.wave;codec=50
WAVE form wFormatTag ID:             WAVE_FORMAT_MPEG

Change-Id: I7cc9d3c8bd8da7a079ac8d50a6d61ccbdedb6f82
Signed-off-by: gbhakteX <gurudattax.bhakte@intel.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: Ic697b90dbc9f2b93aeb227411359c36c113cb71e
Signed-off-by: Daniel Levin <dendy@ti.com>
libstagefright: Adds some parsing capability

o Adds AC3, EAC3 and DTS mime types
o Adds AC3/EAC3 support in MP4 parser
o Adds MPEG4 video, MPEG Audio, AC3, DTS, EAC3 support
in mkv extractor.

Change-Id: I9895c0e40e5ad38976004a9569200f1340d525de