frameworks/base/NuPlayer: Handle Seek from NuPlayer

- Seek was handled by the source by queuing discontinuity events
  individually for each stream.With this approach renderer will
  continue till discontinuity events are handled for each stream
- With the new approach seek is handled by the player -
  - get the new seek time from source
  - flush the source TS segments in LiveDataSource, access units
    in TS Parser, decoders and renderer
  - notify current position to driver
  - LiveSession will not queue a discontinuity for seek.
- Add a mutex lock for connect & disconnect ChromiumHTTPDataSource
- Handle flush in ACodec - Idle to Executing & Loaded to Idle states

Conflicts:

	media/libmediaplayerservice/nuplayer/NuPlayer.cpp

Change-Id: I8a741c2c665d3aca715734fc1fd1eeae33a6271b
libstagefright: Add support for fragmented MPEG4 container

- Stagefright parser dosent support parsing fragmented 3G2 clips
- add support to used mm-parser to parser fragmented 3G2 clips

(cherry picked from commit f1eb550a11bdc2a4534a89764f8c42008add90ae)

Change-Id: I9afcbd144dbbd50218b5ad8733b07d6c73f5f4d7

Conflicts:

	include/media/stagefright/MediaDefs.h
	media/libstagefright/MediaDefs.cpp

Signed-off-by: Andrew Sutherland <dr3wsuth3rland@gmail.com>
frameworks/base: Add rendering statistics to Stagefright (Adapted)

- this is an adaptation of change 514 (I88dd988c9) from HC to ICS
- functionality is the same as the forementioned patch
- added all statistics properties for AwesomePlayer into
  Google's Stats struct
- acquire locking before modifying/accessing mStats values
- moved mStatistics check in AwesomePlayer to inside the log functions

Change-Id: I553823b22403a0e5e9fc3998a27a54fec9e1b5c4
libstagefright : Fix for clips with Corrupt NAL length

-Stagefright returns ERROR_MALFORMED if the NAL length is corrupt
 resulting in Cannot Play Video message.
-Ignore the frame if the NAL is corrupt.
-Return Custom error ERROR_CORRUPT_NAL and issue a new frame read.

Change-Id: I248b9920d0c3588c5e433e0822f3f663993f2858
CRs-Fixed: 256840
libstagefright: Use QCOM Non tunnel AAC HW Encoder for AAC recording

- Added QCOM NT AAC HW Encoder to encoder list to use it for
  AAC recording

Change-Id: I508d7e5288fadf30f1d3e57f12895ca73a8d4322
framework\base:: remove decrypt handle

Decrypt context will be created directly in decoder so remove the code
that was used to copy the decrypt context pointer from parser.

(cherry picked from commit 5bb0aa03232513255ee22607f6995040a6b19cb7)

Change-Id: I01e540a0c28f0039f037a5045b4b1da78c12550c

Conflicts:

	media/libstagefright/Android.mk
	media/libstagefright/OMXCodec.cpp

Signed-off-by: Andrew Sutherland <dr3wsuth3rland@gmail.com>
libstagefright: Fix to free buffers properly in ERROR state

- In the ERROR state, OMXCodec::on_message tries to free the output
  buffers in the FBD sequence. This can fail if the OMX component hasn't
  been moved to idle state.
- OMXNodeInstance does not check for the return value of OMX_FreeBuffer
  call and returns the buffer entry from the list of active buffers
- This buffer ends up being unfreed which can adversely affect
  the next video playback

(cherry picked from commit 6ef3096b6db1cee7fec57da3ae4c519cdaa28bbb)

Change-Id: I9d80fd0f3c3e75da41697370f787df72316b32e4
CRs-Fixed: 329874
libstagefright: Change allocation buffer count for VideoEditor

- OMXCodec: AllocateBuffersOnPort: Add a check to allocated
  minmum buffer count for encoder, min + 1 for decoder input
  and min + 2 for decoder output

Change-Id: I483cbe0587b76b0c029e11054eda666e548c2b63

Conflicts:

	include/media/stagefright/OMXCodec.h
libstagefright: Handle error on allocate buffer failure

Set state to error on allocate buffer failure at start(init)
of decoding.

CRs-Fixed: 332373
(cherry picked from commit c7a957b7595fff44f9242ddcd3eeeabe827f9639)

Change-Id: If0796250c6385df28e3545c08e90e1626ff5e709
libstagefright: Enable frame by frame mode

- Enable frame by frame for all formats - local playback & http
  streaming.
- Arbitrary mode is enabled only for specific formats by setting
  a new key (kKeyUseArbitraryMode) in extractor, for following
  formats :
  - H264 Interlaced clips
  - VC1 Advance profile clips
  - MPEG4 in AVI container
- If the arbitrary mode key is not set by the extractor, it will
  default to frame by frame mode for all video clips except
  interlaced clips.
- Adds SPS parsing functionality.

Change-Id: If8c47d0499720eead86b4c4fbe74696aba4423fb
CRs-Fixed: 322872

Conflicts:

	include/media/stagefright/OMXCodec.h
	media/libstagefright/OMXCodec.cpp

Signed-off-by: Andrew Sutherland <dr3wsuth3rland@gmail.com>
libstagefright: Crop the native window with the display resolution

We were providing the native window with the display width and height in
set_geometry.  On the surfaceflinger side, they assume that this is
aligned, which causes problems for HDMI.  Instead we'll now pass in the
aligned stride and slice in native_window_set_geometry, then specify the desired
display width and height by calling native_window_set_crop.

Change-Id: I9b9a910e951468bdeb30f3f8ea9df70f3c2ad00a
CRs-Fixed: 283063

Conflicts:

	media/libstagefright/OMXCodec.cpp

Signed-off-by: Andrew Sutherland <dr3wsuth3rland@gmail.com>