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
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
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
libstagefright: Add interlaced video support

Stagefright waits for the Index Settings changed event to be propagated
to it from the component. If interlaced, appropriate flags are given to
the native window.

Change-Id: I240c5139232c6905c3de7632885736147d5f70b1
(cherry picked from commit ce070db0c8d491218adb9a8386116d39909813e9)
libstagefright: Fix for crash during playback of unsupported clip

-Crash in media server observed during playback of unsupported clip
-The OMX_EventError not handled properly in SF IL client leading
to crash as i/p buffers and o/p buffers are not freed.
-Shutting down the i/p and o/p ports when OMX_EventError is
received with state OMX_ErrorInvalidState. In error state,
free i/p and o/p buffers on receiving empty buffer done and
fill buffer done messages.

Change-Id: I6d2b7b659b5f424b9fc5d668e47f2a9d51b49314
CRs-Fixed: 331572

Conflicts:

	include/media/stagefright/OMXCodec.h
	media/libstagefright/OMXCodec.cpp
libstagefright: State checks before calling OMX_FreeBuffer

- Add state checks based on OMX IL specification before
  calling OMX_FreeBuffer

CRs-Fixed: 332651
(cherry picked from commit 1e141b3eb230dcfa2b1befe8456637a81d83cb36)

Change-Id: I9fbca2938ba40affbb72d464a443902f004f2ae7
libstagefright: Fix crash during 3D Video playback

The crash was observed while handling extra data in FTB.
This was due to improper assignment of buffer handle to
pBuffer. This assignement is corrected in OMX component
and hence CHECK_EQ for buffer handle in OMX nodeInstance
is removed.

Change-Id: Ib1eb206a201f2e23aec2137b64b93bcb0fc2d221
CRs-Fixed: 328535
QualcommNoSimReadyRIL: Drop the initialstatechange check

ICS doesn't have it anymore, and it actually breaks the P930's init
sequence

Change-Id: Ic9dfb5f2eddcda825a6d3fc5d380ebc4d56add90
LGEQualcommUiccRIL: New subclass to deal with the latest qcom RIL

Yet another generation of CAF RIL, this one is necessary to support
multi-RAT (GSM/LTE) radios...

Change-Id: I87b5126ffbc16f3ccc7caaf227354edf95543c35
Merge remote branch 'upstream/ics' into ics