libstagefright: Fix to free buffers in error scenarios

MediaBuffer objects are not freed if component transition from
IDLE->EXECUTING or EXECUTING->LOADED fails (or if the
OMX_CmdComplete messages are dropped due to an earlier error)
Additionally with native buffers, the corresponding
ANativeWindowBuffers are not cancelled back in the above scenarios.

Change-Id: Idad02f7bb6bbfcd30947624148ea996a4a8f18b3
libstagefright: Add 2 APIs (suspend and resume) in Mediaplayer

- API:suspend() will just pause the player and release all the decoders
  instead of release the whole player
- API:resume() will just init the decoders again
- Add a check in onVideoEvent()
  to make sure the first seek operation will seek the next i-frame

Signed-off-by: jmeng <jmeng@codeaurora.org>

Change-Id: If16dc1c9dae2f28df8a969b1044ca67d23a8846b
libstagefright: HTTP Streaming fixes

- Stop fetching on reaching EOS
- Disconnect datasource in player's reset
- Send buffering complete when seek is issued
  when player is in buffering state

Change-Id: If1650f02ffda10e0d8ca4a9c7fd0a5681d05e75e
Signed-off-by: jmeng <jmeng@codeaurora.org>
libstagefright: Fix AV sync issues

- Add edit list support for video playback.

Change-Id: I67cb9026255ddfe2d946a6e5972705b1b0c8a527
CRs-Fixed: 362885
libstagefright - Fix timestamp overflow

 - change time related variables to 64 bit to avoid overflow
 - composition time calculations were having overflow in
   SampleIterator and it propagates to the rest of the time
   related information for the frames

Change-Id: I035cbfaced1215eb1afd2c6cb900116e46006994
libstagefright: Add fix for mpeg4 data partition clips

- QC firmware does not support mpeg4 clips with data partition,
  but Google software decoders support these clips.
- Add logic in OMXCodec to parse the VOL header passed from
  QC parser to OMXCodec through kKeyRawCodecSpecificData
  for data partition bit and fallback to software codec if it
  is found.

CRs-fixed: 488740
Signed-off-by: jmeng <jmeng@codeaurora.org>

Change-Id: I04772d7173a075b70f7a34bef2d2877b280c7f07
libstagefright: Fallback to software encoder for high resolutions

Add error check conditions to fallback to software encoder if
q6 encoder fails in configure codec. Q6 encoder fails
for resolutions greater than FWVGA

CRs-Fixed: 511608

Change-Id: I4d765f45cd3b9c128260e7c96f139b671950d0ce
libstagefright: dynamic port reconfig handling

- Add support for dynamic port reconfiguration handling in OMXCodec

CRs-Fixed: 500703
Change-Id: I711d4b1114be791789607bc5dabc6d4496c182c0
libstagefright: Checks before freeing buffers on a port

- OMXCodec calls dequeueBuffer on the NativeWindow in a loop
  and registers output buffers with the OMX component.
- If a dequeueBuffer fails, the buffers already registered
  with the OMX component were not getting freed laeding
  to a memory leak.
- On an error, check state of OMXCodec before freeing buffers on a port.

CRs-Fixed: 393352

(cherry picked from commit f2e982497c5d16db14812ee09cef5cbdf0d96331)

Change-Id: Ib4eb48c189197d253e4175708ce1778b9c92f315
audio: Add A2DP notification support

 * Forward porting this code.
 * Sends notifications to legacy LPAPlayer for routing A2DP thru LPA.

Change-Id: I53eebda30b2e5cd60eeac5eb2a4cdb53e38381c9
Merge remote-tracking branch 'cm/cm-10.2' into cm-10.2