ACodec: Add video codec fallback logic

- Check while onAllocate if codec is capable of handling video
  resolution. If not fallback\retry other capable components in the
  list

Change-Id: I3203275be23651dbd9ad7a7397526ac601a3350a
audioflinger: Fix cleanup of asynccallback thread

AsyncCallbackThread will not be spawned if the output
profile does not support non-blocking output or if the HAL does not
support set_callback API.

Add a check for validity of callback thread object before deleting it.

Change-Id: I3943f80abba3fd7f18fbfd6190bb884f773772b5
libstagefright: Fix in AudioPlayer media time mapping

- Use seektime as the play position when player is still
  seeking.

Change-Id: Id92a07e3291280b17b83d53ff2e218acc3ee6020
stagefright: Fix AV sync issue for cached audio sources

Non-HTTP sources may continue to fetch audio data after video has
already seen a seek request causing audio to run ahead. When video
sees a seek request, audio should pause, resuming once it too has
handled the seek request.

Change-Id: Iddbf3d79f29bbe8bcdb4b07338c4a00734acd8e2
AudioFlinger: Offload track transition fix

Trigger state changes in OffloadThread on adding a new offload track.

Bug: 12530661
Change-Id: I95b62764c7ac041d470702e86b951f812eb0e70f
audioflinger: Handle pause /resume in stopping state

-Pre-requisite:
 Perform seek on the clip. After seek the data remaining till EOS
 is little more than the driver and common block buffering.
-Framework state:
 Offload thread is waiting for signal from the HAL for a free
 buffer. Audio Player calls sink stop on reaching EOS. Audio
 track is waiting on obtain buffer for a free space in common
 block to send the last buffer. The track is moved to stopping
 state as input EOS is reached.
-Issue:
 Perform pause/ resume in this state(STOPPING), Audio playback
 does not resume.
-Fix
 Ensure resume is called in stopping state if frames ready is
 greater than zero.

Change-Id: I9268ab2a6cd1cc69a3ff23801f978f7a9f75a11b
AudioFlinger: Modify flush handling for offload path

Do not allow an offload track to directly control the offload thread
behavior. OffloadThread can check for any pending flush reporting
by its active tracks and decide to flush the HW or not.

Bug: 12530661
Change-Id: Ib33f023c942f6c091b618004136b153c38a6eef6
libstagefright: Handle offload fallback for WAV content

- For WAV content there is no OMX Source, use the AudioTrack
  as OMX Source for fallback.

Change-Id: Ifeaeb2cf8dd777d167b74eebd11803b7f130e857
audioflinger: remove unecessary call to HAL

On a flush, OffloadThread resets its state about HAL being paused.
For the sake of consistency, it is now expected that after a flush
as HW is no longer paused, the resume call is unnecessary.

Change-Id: I47d8b685dd23427bb44e24593124b4e42e4a315e
STE Multimedia Fix

Change-Id: I126ca200679dfba224193d91fe55958238f72d31
libstagefright: mkv parser: check for divx format

bailout if divx is disabled and if video format of the clip is DivX

Change-Id: I600a3f8ccd5e3dc464c8c26477731e6a72589b6d
libmediaplayerservice: Fix bug due to operator precedence

Condition check for offload flag returns false always as bitwise
operator has lesser precedence to relational operator.

CRs-Fixed: 629912
Change-Id: I1843c977bd98cf9a807adaa51a073f9fb744d326
AudioFlinger: Introduce CBLK_STREAM_FATAL_ERROR flag

On a fatal error, PlaybackThread (or its derived classes)
can opt to signal an error back to the AudioTrack using
this flag.

Change-Id: Id323df8693c720432a459fe4d844d39033b24598
Framework: Fixing media server crash.

Fixing media server crash when dump() is called
from camera framework after camera HAL instance
has been released.

CRs-fixed: 634328

Change-Id: Ia837f5c0e722db4e6a7187062adc5d8bcfc93dca
audioflinger: OffloadThread fix for resume underrun

AudioFlinger can miss resuming h/w on a pause->resume transition
if sufficient data isn't available.

Change-Id: I3632b44571201bb47155f2ed3ad425fe68e04492
CRs-Fixed: 616599
libmedia: Set the correct audio latency in offload mode

- In offload mode latency is decided by Audio HAL.

Change-Id: I0f46ce9cb43e59907c07e77ec57fda47e841b094
CRs-Fixed: 609259
stagefright: Correct the updation of extension sample rate

For SBR content, the extension sample rate is being overwritten
with incorrect value when sample rate index is 0xf.
Fix the issue by correcting the logic to update the same.

Change-Id: I126e83665319b143fcfa52d1fb434ebbe453e6e1
CRs-Fixed: 636580