libstagefright: Fix ANR issue in HTTP Streaming

The root cause of the ANRs during this usecase is the
blocking nature of the read calls on the network data
source due to which application thread gets blocked on
some lock in framework.

Fixes ANR during seek/pause during HTTP streaming
* Non-blocking read implmentation for NuCachedSource2
* Other framework related changes to handle underruns

Change-Id: Ief280b7e23727606746e1ca2bf4caa4a3044b7bc
Add 2 APIs (suspend/resume) in MediaPlayer

- API:suspend() will just pause the player and release all the decoders
  to replace release() which will release the whole player
- API:resume() will just init the decoders again,
  then start() will be called to start to play the streaming
- Add a check in AwesomePlayer::onVideoEvent()
  to make sure the first seek operation will always seek the next i-frame

Change-Id: Ie4c82906a2a056378119921a656128ebdc1007c4
[libstagefright] : camcorder pause-resume implementation

- Added pause resume feature in camcorder app.so that
  user pause recording and resume later which results
  in a single recorded clip.
CRs-Fixed: 587051

Change-Id: Ib82a93009348d997a4b8343b8b417b433be4c9df
libstagefright: Fix crash during seek

OMXCodec state is changed to EXECUTING when flush
is complete. Update assert condition to check
EXECUTING state instead of FLUSHING.

CRs-Fixed: 607762
Change-Id: I12b3eedfc83e00578d70af3ef903c5a26ccde3eb
 libstagefright: Signal input EOS after last buffer is released

-In offload playback, sink stop is called at EOS from the sink call
 back when input EOS is reached. This is called before the last
 buffer is released.
-During seek to the end of clip ,drain can complete even before
 last buffer is released. This can cause playback to switch to
 next stream.
-Fix by ensuring sink stop is called only after the last buffer is
 released.

CRs-Fixed: 607104
Change-Id: I9cc45cc25b5f87dd878b26f76ea741323a0242a6
AwesomePlayer: Enable audio offload for widevine

- Set offload parameter for ADTS compressed data
- Remove offload audio check for drm content
  so that widevine goes through tunnel mode

Change-Id: I383fd315becc714f5bad08ef11ab1da4730b55fc
libstagefright: Do not offload HEVC AV decoding

- Add compress offload exception for HEVC audio
  decoding.

Change-Id: Id0831ec779ca1704533e3f24f0b6d72968edb44d
CRs-Fixed: 599669
libstagefright: fix force close issue when mute MPEG4 clips

- Forgot to get ESDS when convert message to MetaData for MPEG4 decoded
  clips
CRs-Fixed: 600462

Change-Id: I2e73f42b641b0224cdf37a81fee611e9856235f0
stagefright: do not offload LD-AAC decoding

For now, do not offload LD and ELD AAC decoding because there
is no way to know if it is supported by the audio DSP implementation.
The longer term fix will be to have mapMimeToAudioFormat() use the
audio object type in track metadata to refine the AAC format and the
audio HAL list supported AAC profiles.

Change-Id: Iaa88ecf3f4ae42ad48c1b42a9b007dd80eb88147
stagefright: do not offload MAIN-AAC decoding

-Disable compress offload playback for AAC-MAIN
 format

Change-Id: Id0bc9da7c35d2b7b6913fd0793e06622df326e9c
libstagefright: Fix DP Parsing issue with mpeg4 SP,ASP

- DP partition logic returns true for mpeg4 clips with SP ,ASP
  profiles.
- Fix the issue by parsing additional fields in the ESDS atom

CRs-fixed: 556619

Change-Id: I69c719011e1a0d2a0b0ae5a9b504b7cce443866b
Audio: Add Pause/Resume in AMR-WB tunnel recording

- Stopping AudioSource will be implemented when
  Pausing the SoundRecorder. However, it will
  be redone when stopping the SoundRecorder which
  will cause the exception.
- When it stays at Pause state, avoid to redo Stopping
  AudioSource

Change-Id: I2aeddd1ce4e3366660012b39241546ee305667fb
stagefright: Various cleanups

Revert "framewroks/av:Fix ANR at the end of video recording"

This reverts commit 0868da69c72a30f46bd333adac86e93de7625709.

Change-Id: I5ace469719ed8552c89ddf7939b6e033bb30dc77

stagefright: Add missing include

Change-Id: I27dff95c5307db50d0d53dc4aa76b9827df56599
stagefright: Use pause/flush logic for all targets

 * This is needed by the encoder pause/resume support.

Change-Id: I9f1a14da4b9755fd307495cdba0dc94dbc8c78ff
Merge remote-tracking branch 'CyanogenMod/cm-11.0' into cm-11.0