audioflinger: decline track to be offloaded if there's active one

-If multiple offload tracks are activated at the same time,
 status of the tracks can be affected by each other and results
 in unexpected behavior
-Deny subsequent track to be offloaded and fall back to sw decoder
 if there's already actived one

Change-Id: Idaa9213d54b9bcdd0e5c25c1dec516d994ae006f
CRs-Fixed: 704382
stagefright: Fix NULL pointer access issues

Fix NULL pointer access issues in stagefright & move printFileName
to ExtendedUtils.

CRs-Fixed: 694900
Change-Id: I390f692b72fcb40e31a095abbb412afebde0a64f
frameworks/av: Avoid timestamp query to AudioPlayer during reset

-Timestamp query while in reset leads to ANR in few cases.
-Destruction of mutex in AudioTrack destructor during reset and
trying to lock the destroyed mutex as part of getPosition() call
in parallel leads to ANR.
-Avoid querying for timestamp in case reset operation is in progress.
Instead use mAudioTearDownPosition to retrieve current playback
position.

Change-Id: Ifaa7f6236ebce1b27a0cca621bbb188c94af142d
audio: Update timestamp for offload playback after EOS.

- After EOS of offload playback,audioplayer was not
  updating the timestamp.
- Query the HAL for the last rendered timestamp when
  HAL sends EOS notification.

Change-Id: Ifa25e0a9a1a245cc74c92294ab0a322db0ab4bec
stagefright: Fix compilation when ! ENABLE_AV_ENHANCEMENTS

Change-Id: I1418b563dcbb0a4709e64e406dd09a98947759d7
MatroskaExtractor: Letting the error be correctly handled

Do not blow up when parsing the header fails (like, say, a
corrupt or zero-byte file) and let the error handling that's
already in place exit the extractor cleanly

Change-Id: I457574d4279efdd3a08e159e755b563d6d98fbc6
SampleTable: check integer overflow during table alloc

Bug: 15328708
Bug: 15342615
Bug: 15342751
Change-Id: I6bb110a1eba46506799c73be8ff9a4f71c7e7053
(cherry picked from commit edd4a76eb4747bd19ed122df46fa46b452c12a0d)
stagefright: Allow devices to use older widevine blobs

Devices may have widevine plugins built with an older MediaSource
interface.  Trying to use them fails because of the change in
interface in the object (it calls the destructor in the blob when
attempting to call setBuffers).

This commit restores the interface for ! QCOM_HARDWARE devices.

Fixes: JIRA-4944.

Change-Id: I4ce24a16f3eceab0c4def4b09850ed569eb392ab
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
Audio stops after seeking AVI clip with MP3 audio (special contents without proper key samples)

During seek in AVI, nearest Sync sample was searched both for
audio and video. Sync samples are useful only in case of
video. We can ignore Sync field for non-video tracks.

Change-Id: Ibaeda8f14afb83905e19087625a7d72fb1b3c8d6
Signed-off-by: Arulselvan M <arulselvan.m@intel.com>
Signed-off-by: Jin Wei <wei.a.jin@intel.com>
Correct the time returned by AudioPlayer::getMediaTime

The change 80a68deec52c9a1b47215ed68526206ec88197f8 was added to
eliminate returning negative media positions.

In the change all negative values of realTimeOffset were discarded.
The value realTimeOffset accounts for the latency and the
number of samples played since last feeding the AudioTrack and is
generally negative. By discarding this value for negative values the
time returned does not account for latency or the number of samples
played.

Change-Id: I470450934228732e34539c227365a225be74ccc8
stagefright: Fix seeking in MPEG4 container - do not merge

- seek based on user-visible timestamp
- seek to previous, next and closest exactly
- also update OggExtractor seek to same logic

Bug: 12786906
Change-Id: I2d5e1fbff6469b6f081a284be2222a4cb50aa754
stagefright: Enable 24-bit mode for DTS audio

 * FFMPEG will convert floating point samples to 24-bit PCM
   if the system is capable of it.

Change-Id: I14fb015468166e567a17bf8758474788e1c285e9