libstagefright: avoid audio source to start before audio player after seek

If audio source is started before audio player during seek, audio source
will start allowing the audio data from the beginning (as seekTime for
Audio is maintained in AudioPlayer and is set once we start the audio player)
Once AudioPlayer is started, it sets the seektime and the data starts from seektime.

This change avoids audio source to start before starting audio player.

CRs-Fixed: 402140

Change-Id: Iad42a5235766478740966788cb9e1dd853104b57
libstagefright: reset flag to allow buffering

When buffering is 100% or eos is reached, buffering flag
is set.If the playback is seeked back to some location
after EOS, no buffering happen. Without buffering, user experience
is bad in poor network condition.
This also handle file having header at the end. While reading
header EOS get set and buffering is prevented.

Reset the flag to allow buffering during above use cases.

CRs-Fixed: 409247

Change-Id: I60bfa4fcd0228bbb02eccb588087e9833fdf1661
Revert "libstagefright: Fix for clips getting skipped during playback"

This reverts commit 11df26c1b691df81258754af8e6f34b521c009f9.

Revert "libstagefright: LPA playback fails when non-LPA clip is next clip"

This reverts commit 966e97c11cc141891fe39787cf059a7a3b57a52b.

Change-Id: I1abed5f0560bef84ab95cc4492a857fb65100dbf
audio: Fix mismerges

 * Clean up a bad merge due to inconsistencies in the CAF branches.
 * Also fix build with debugging enabled.

Change-Id: I8a2a0d4aff5faae71fd648c67bc925d376d3a8a0
audioflinger: Properly initialize bytesToWrite for LPA effects

 * Fix the crash when applying effects on the first audio buffer due to
   uninitialized variable.

Change-Id: I371880bb7392b276ca8fa7af16cdd2b692c63c40
libstagefright: Increase LPA buffer size to 512 MB and reduce buffer count to 2

Change-Id: I3164199c4cec6de384aceeee0a1d2f6c426e0e0f
libstagefright: Add flush in reset during LPA playback

-If next operation is performed during LPA playback, delay is
observed before moving to next clip.
-Flush in reset happens only when playback is paused.
-Remove pause check to avoid delay and flush in cases where
next clip has been selected.

Change-Id: I561d83f70ef391f14bdb52bb8a6ee075e31e9531
CRs-Fixed: 395477
libstagefright: Fix for crash during lpa playback

-During lpa playback, flush() is not issued if mReachedOutputEOS
is true. This prevents flush reaching to HAL even during pause
state and causes crash.
-Issue flush() in all cases as these checks are handled in HAL.

Change-Id: I0029c851ba6a029afc01e6a30620b071f9828665
libstagefright: Avoid flush if LPA playback is not routed

-On a previously closed LPA playback due to pausetimeout, if
reset is called flush is issued on closed sink leading to crash.
-Check if audio is routed before calling flush to avoid such
issues.

Change-Id: Iec24d063425b0a0017adcf0b3a576fbea0d8ef25
libstagefright: Deregister audio flinger client during LPA session close

-Mediaserver crash is observed during BT disconnect.
-Audioflinger client registered during lpa playback is never
 deregistered.
-Fix this by deregistering audioflinger client during LPA
 session close.

CRs-Fixed: 407397
(cherry picked from commit d36aeb2d863a0ba42f45dbb59cd144dbf2c62cd6)

Change-Id: I19ef959a3d35476b4689e6c917a0cf6ccb4ffa78
libstagefright: Add support for TCXO shutdown

-Add support for onPauseTimeout to close the Audio path after
3sec of pause. This allows TCXO shudown to happen.

Change-Id: I747edf146475df8c828294f01ffe38aba5a3eccf
libstagefright: Detect defers-output-buffer-allocation quirk

Change-Id: I6e4c89e8d491db6a9e67c986b5efdbd19165782d
audioflinger: Initialize effectspool buffer size during allocation

-Crashes are observed during start of lpa playback with effects
enabled.
-Effectspool buffer size is invalid before initial two writes. If
effectsthread tries to access these buffers in such invalid state
it leads to crash.
-Initialize buffer size to 0 during effectspool buffer allocation.

CRs-Fixed: 415067
(cherry picked from commit 36591e0b53d869320d2a78b2f3c7f43924cb78b3)

Change-Id: I2616cfbfe914448e6489837f5d8686a8def7a883
Frameworks/av: Fix for mediaserver crash in AudioFlinger

- UI freeze is observed while playing LPA clips with sound effects.
- While moving to next clip, effect process is still applying
  effects on last buffers. Meanwhile de-allocating the local buffers
  in DirectAudioTrack destructor on which effects are currently
  applying. Due to this crash is observed in effect process.
- De-allocate buffers once the effects thread is killed.

Change-Id: I67431f298b8da114db60de5cc27376d9ddce7da5
CRs-Fixed: 416093
Add KEY_SUPPORTED_CAF and KEY_CAF camera parameters

Needed by TouchPad's froyo libcamera to work

Change-Id: If303b90443c27216b4706bbecbb49564efe5fd9c
libstagefright: Unbreak OMAP4 encoders

The "manual" construction of the h264 codec data is only needed
on OMAP3. Execution of this code on OMAP4 breaks the mpeg4 header
generation

Change-Id: I3ae52f2e685e2d9097796685c98dffa93cfa6430
Merge "libstagefright: Unbreak OMAP4 encoders" into jellybean
Merge remote-tracking branch 'cm/jellybean-stable' into jb