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
Merge branch "cm-11.0" into kylin
Screenrecord: allow force mic for audio

Some older devices audio blobs do not support audio submix,
allow those devices to force using the mic for audio while
screenrecording.
https://gerrit.omnirom.org/#/c/6063

Change-Id: I2fa895a1faa431d2b007ff9a0b735b09371999ae
Merge pull request #1 from KylinMod/kitkat

 Merge pull request  from KylinMod/kitkat …