libstagefright: Smooth Streaming in OMXCodec

This change is to address startup latency during playback.

Set smooth-streaming mode from OMXCodec by default
if mm.enable.smoothstreaming property is enabled

When crop change is detected, save the target crop/stride and apply
them just before the buffer is (potentially) rendered.
Applying the updates right away may cause artifacts as buffers with
previous resolution are not rendered yet.

This approach assumes that there will not be a crop change within
the detection and application of current crop

CRs-Fixed: 584629

Change-Id: Ia164309edf1c51ed28b929deabecc53fc56cbf33
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

Conflicts:
	media/libstagefright/AwesomePlayer.cpp
	media/libstagefright/NuCachedSource2.cpp
	media/libstagefright/include/NuCachedSource2.h
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

Conflicts:
	media/libstagefright/AwesomePlayer.cpp
	media/libstagefright/NuCachedSource2.cpp
	media/libstagefright/include/NuCachedSource2.h
[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

Conflicts:
	media/libstagefright/OMXCodec.cpp
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

Conflicts:
	media/libstagefright/matroska/MatroskaExtractor.cpp
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

Change-Id: I9f1a14da4b9755fd307495cdba0dc94dbc8c78ff

Conflicts:
	include/media/stagefright/AudioPlayer.h
	include/media/stagefright/OMXCodec.h
	media/libstagefright/AudioPlayer.cpp
	media/libstagefright/OMXCodec.cpp
Audio: Tunnel Exception for ER AAC ELD profile format

- some m4a clips are not working properly

- ADSP audio decoders don't support ER AAC ELD support

- Added tunnel exception for ER AAC ELD format.
  Added AACProfile metadata support for MKVExtractor

Change-Id: I2f6fe721b05377dfe0f24ea0ad1f6c4a885d576d

Conflicts:
	media/libstagefright/matroska/MatroskaExtractor.cpp
Screenshots info is not updated when device is plugged in MTP mode

When device is connected as MTP mode and user opens folder
/sdcard/Pictures/Screenshots/ in windows system and captures new
screenshot, image information is always shown as 0 KB

Issue: https://code.google.com/p/android/issues/detail?id=56204

Change-Id: I86d8e1ee54c0d8b2008b5f6bc0de2cac3faafc20
Revert "Audio: Tunnel Exception for ER AAC ELD profile format"

This reverts commit 592baebfc864a266b2bf41c7613e5697ac73e377.

Revert "stagefright: do not offload MAIN-AAC decoding"

This reverts commit aae4df3deb7c65f329d0ef18a16a215bde7c87c5.

Revert "stagefright: do not offload LD-AAC decoding"

This reverts commit b7ea0f69745e89bccf52b4610eb8b2562aa80924.