audioflinger: Power hints for audio activity

 * Take 2, now with 100% less crashes!

Change-Id: I48fb0d2e3cfc64f46d99f177b4cf3fe842d06df4
(cherry picked from commit ff7ae18ca39ced274f37856b8da9dc1e446f69dd)
Revert "camera: Add a few missing legacy camera params."

Either we keep legacy stuff, or remove ALL parts
of it, but not partly leaving dead code.

This reverts commit 12c66985ae4177feb73bbcc709ef80a18660ebec.

Change-Id: I0bbd47b0328114672f798864d04f2e9bdaa1f91e
(cherry picked from commit 0f9769ec2b341811d18df6be71424bf7a37433e5)
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
(cherry picked from commit 2a7ee7df43dbbfde3b5d08d054905a3c43b2383a)
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
(cherry picked from commit 45acc10495719b30e68feb6c8cf5bfac27119f1b)
[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
(cherry picked from commit 1f348eb12a631bbe6c3288c797354da6d425e64d)
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
(cherry picked from commit 938d59763ff7c6838df3043d30c3af39301dd03e)
 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
(cherry picked from commit 6e0ccbf5d32ec49a7ef27ff41cf49136e63f3a6e)
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
(cherry picked from commit 2364610daa8e076648f533f265a595474e5d5834)
libstagefright: Do not offload HEVC AV decoding

- Add compress offload exception for HEVC audio
  decoding.

Change-Id: Id0831ec779ca1704533e3f24f0b6d72968edb44d
CRs-Fixed: 599669
(cherry picked from commit 1eec4467fb12ee1ae88aa9c1374c79fbf4d03e68)
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
(cherry picked from commit ebdb207a3b52fad458622c133a45acad5b45bba5)
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
(cherry picked from commit f3269321b7de1ebe80aaeaebba8480827933be32)
stagefright: do not offload MAIN-AAC decoding

-Disable compress offload playback for AAC-MAIN
 format

Change-Id: Id0bc9da7c35d2b7b6913fd0793e06622df326e9c
(cherry picked from commit eb6aba0702d86e5959c8041bdd5ef027968624ee)
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
(cherry picked from commit 228d46e0d19bd6a3703056b04afdf24ea241e0a9)
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
(cherry picked from commit ea784b628f0ba99a1a4ce221677f90167ec7ed18)
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
(cherry picked from commit 3c9275c2e1dd22a1411f8bfdd8d056c237b6d30d)
stagefright: Use pause/flush logic for all targets

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

Change-Id: I9f1a14da4b9755fd307495cdba0dc94dbc8c78ff
(cherry picked from commit 171dd05842d65923f7983418e0d9fc95e5db9f91)