camera: Set the min undequeued buffer count to 2 for camera

 * Too many buffers causes ION allocation failures on many devices.
 * We don't need these extra buffers for performance in the camera, so
   set it back to 2.

Change-Id: If610824f30ee8e6a2c1acb90dd7af78269e81086
libstagefright: Adding a work around for SurfaceMediaSource

- Do not stop on first call to onBuffersReleased, which presumably
  will be called when producer calls setBufferCount on BufferQueue.
- Do not flush the buffers when stop is issued via onBuffersReleased
  (producer calls disconnect on BufferQueue), instead flush when reset
  is called.

Change-Id: I91448bc87563f2245ad9c9c7150b82c358bfe9e2
CRs-Fixed: 387181
libstagefright: Fix to free buffers in error scenarios

    o 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)
    o Additionally with native buffers, the corresponding ANativeWindowBuffers are not
      cancelled back in the above scenarios.

Change-Id: Icdee687dab4883639f49ba0b38d6c80d7013873b
libstagefright: Accept vendor specific NV12 colorformat from component

Accept OMX_QCOM_COLOR_FormatYUV420PackedSemiPlanar32m color format which
is NV12 + 32 aligned stride and slice.  This different from vanilla NV12
which is 16 aligned.

Change-Id: Id6cd4295c7710b3f33ef082e3b644732fd85e3fb
Signed-off-by: Deva Ramasubramanian <dramasub@codeaurora.org>
libstagefright: Add flag to use MM heap for SurfaceMediaSource

 * Older QCOM camera drivers need to use the MM heap for effects
   recording. Add a a flag to enable this.

Change-Id: I4f78c3b370ba1ef7b6a0c567de0a211e85e8a2d0
frameworks/av: Use software decoders for LPA clips

Use software decoders for aac and mp3 LPA clips

Change-Id: I0310e128505ff383138c6a7dcb934ae64e86d6bd
audioflinger:  Avoid deadlock for sound recording - LPA concurrency.

-Rapid button press will cause next clip playback. If next clip is lpa
 clip, opening lpa clip triggers set parameter. The set parameter would
 acquire flinger lock and wait for completion. The wait can only be
 signalled from checkForNewParameters_l() in threadloop but the record
 thread loop will be blocked on processConfigEvents() on audio flinger
 lock resulting in deadlock and record failure.
-Release the lock before setParameter on threadbase is called to avoid
 the deadlock scenario.

Change-Id: Ib165210d16bcf661b6aa56aac1529375087e4e4e
CRs-Fixed: 390918
libstagefright: Fix crash during next clip playback

-Decoder/Extractor thread and reset was not synchronized and this
 resulting in write being called during destruction of session out.
-This causes crash during continuous next clip playback.

Change-Id: Id0c953541f2ba74b2321b16636852cbe59c4cdcb
CRs-Fixed: 392250
libstagefright: Pass aligned width to color convert routine

- NV12Tile requires aligned buffer sizes.
  The size passed was un-aligned.

Change-Id: I0d6c618aab7588998ef0e9cfa3fb8a51d9bce93a
camera: remove redundant QCOM_HARDWARE ifdefs

Change-Id: I9bccd7cb2fd3a7a7b3bda8002cf57ad21ce6b37e
camera: add missing symbols for HTC 8660 camera HAL

Forward port of patch from HTC 8660 missing symbols patch from ICS.

Change-Id: I9ed27e3bc1b0d63c437b3cf9518b36e0da546e81
libstagefright: Enable suspension policy

- ADSP doesn't enter suspend state after audio playback.
- No support for suspension policy in stagefright.
- Enable suspension policy in stagefright to allow
  component to move into suspend mode.

CRs-fixed: 386381
(cherry picked from commit 735bc83e32e64af25a6163c07e2039eb4354ff00)

Change-Id: If32bfc63bbb25563e14b128712cc90639b15dc5b
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>
CameraParameters: Underp non-qcom hardware

Move setPostviewSize to QCOM_HARDWARE

Change-Id: I830d1385be0e784f9fcb6dc40f014bea36b4b65b
fixup for non QCOM targets

*potential memory leaks in MediaPlayerService
*fix ifdef placement in AudioTrack
*duplicate entry in MPEG4Extractor
*(int)mChannelCount == mReqChannelCount being checked twice in AudioFlinger
*pLatencyMs not getting assigned in AudioFlinger
*CAMERA_MSG_FOCUS_MOVE was lost in CameraService

Change-Id: I349a25078148d25f43bf5666fe04b84017b7daa7