libstagefright: support for disabling buffer metadata

- Metada mode video recording is enabled by default.
- use setprop debug.camcorder.disablemeta 1 to disable metadata mode recording.

Change-Id: I422c49c0ace0c3a3e1f4459c7e4bf29e70af763a
audioflinger: Fix buffer size for VOIP

 * Crazy ternary is crazy.

Change-Id: I9d076bf8c72f4266be054b093889ec763bf2bb00
libstagefright: Add legacy LPAPlayer

Change-Id: Ie2551345bbf047c022d1fecbb7cb2cc4a4c97d72
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
Fix SoundPool.play() looping regression in 4.3 DO NOT MERGE

The change I7370d6e59a7ef26dfb284a8b058d5ab2e0a42ccf caused a regression
in SoundPool looping when using SoundPool's streaming implementation.
This reverts a portion of that change.

Bug: https://code.google.com/p/android/issues/detail?id=58113
Bug: 10171337
Change-Id: I8af0dc8683a7c7f225c80f0eb4d39770667b52e5
libmedia: Featurize QCOM's VOIP feature

 * Not all targets will support this.

Change-Id: I89a444c9ac8be3dfcaeedb599179e31383fdfec2
audioflinger: Fix for race conditions in direct audio track

-Issue: Mediaserver crash is observed in direct track functions.
-Rootcause: Between write and flush functions, write and destructor
effectpool buffers are accessed without any synchronization that
might lead to operations on null buffers and cause crash.
-Fix: Use mEffectLock to synchronize access of effectpool buffers.

CRs-Fixed: 515107
cherrypicked from Ib071361c65b390f9486c0a080a9391f176392b30

Change-Id: Id9e14a054d699ec803e23619ef475696b0021d4f
Fix typo

Change-Id: I179187b33f666dff88b57a4c24d7507eee0219cd
Signed-off-by: Rohan Mathur <rohanmathur34@gmail.com>
Camera: QCOM legacy definitions,HTC cam switch,NO_UPDATE_PREVIEW

Updating Camera parameters, and service with several
compatibility patches:

1., QCOM legacy CameraParameters and functions:
Adding these will make ICS qcomm camera blobs work on JB 4.3.
Use BOARD_USES_QCOM_LEGACY_CAM_PARAMS := true in BoardConfig
to use this.

Also fixes the problem of legacy qcom
camera blobs with recent libcameraservice QCOM_HARDWARE changes,
where the orientation is messed up on first
preview: the fix is leaving out setPreviewWindow(window) for
legacy qcomm cam blobs.

2., Also adding NO_UPDATE_PREVIEW flag for legacy purposes.

3., Adding adding the set orientation patch:
Always set buffers orientation when setting the qcom camera preview window
Fixes the rotated preview on TouchPad
https://github.com/CyanogenMod/android_frameworks_base/commit/1a8e41a3c7434737db89b604352575f8b3109e7a

4., camera: Full support for HTC camera switch

5., Adding more parameters for HTC Explorer

Change-Id: I2bfc72b8ef027665356788f1db7f96b31d037dbe
Camera: Fix deadlock due to mLock in pcb and takepicture

In non-zsl case of takepicture, we do streamoff for preview
stream which is waiting on preview callback thread to exit.
By that time the lock has already been acquired by takePicture.
So preivew callback will not exit until it acquires lock and
takePicture cannot continue until PCB call back is returned.
Fix: Avoid the mLock at services when both Preview cb &
Compressed cb are enabled.

Change-Id: I61ffa60af34a3fc19b8f45c119535243b53c7d3c
Camera: Disable TakePicture related messages in stopPreview,stopRecording

This change fixes the race condition and avoid the deadlock
in abnormal snapshot stop I.e, Observed DeadLock when Data
or Notify Callbacks is sent to App after StopPreview is
triggered and so disabling the corresponding take picture messages.

Change-Id: Ifc20e495091c75cc718c24d29db3334fbf7ceb07