Revert "stagefright: Cleanup ifdefs in pause code"

Breaks audio pause-resume on non-QCOM device. The code here goes
with QCOM-specific mPaused code in OMXCodec.cpp.

Also added one more ifdef to fix compile error.

This reverts commit f771dc65603c8d06865f08a1b88be60cb53e19dd.

Change-Id: I1ebf3d15cfb7bf5c92745e0ab88cffd7adf192a0
frameworks/av: Enable subsystem re-start for LPA/Tunnel

-Audio Daemon in Audio HAL intimates AudioFlinger
 of ADSP status (online/offline) using set_paramaters.
-AudioFlinger send set_parameters to its clients
 which is DirectTrack used for LPA/Tunnel playback.
-In case of ADSP crash during LPA/Tunnel playback,
 clean up of DirectTrack is initiated.

Change-Id: I87f720f305765e00e12032eed3e018aeff952390
(cherry picked from commit 02861e0f092c46640576bb8c700418ed82c266c3)
(cherry picked from commit 5abe97aa9e103420813b87e7abb2b676ffe8d097)
(cherry picked from commit 9a27f1e6c449585095e518f0d2f44e621ef18f52)
audioflinger: OffloadThread state fix

When switching from one offload session to another that
reuses the same offload output, audio HAL is paused & flushed in
preparation for the new track.

OffloadThread must reset mHwPaused to allow proper state transitions
for the second track.

CRs-Fixed: 578165
Change-Id: I8173845e1782b5a8b372a82c7d337299a61e0efe
audioflinger: update track ready condition

Signal track ready if the track isStopping().

Change-Id: Ie279995d5f90fa8211a20dfbeacc1cf9b921d0bf
CRs-Fixed: 592189
AudioMixer: Remove tracks from enabledTracks after reseting outTemp

If any track goes through AudioMixer::process__genericNoResampling, and
its getnextbuffer returns NULL, Then that track is removed by AudioMixer
from enabledTracks.

Thus if all tracks getnextbuffer return NULL, Then this function doesn't
reset outTemp and last buffer in AudioFlinger's mMixBuffer will be
repeated and noise is observed.

Remove tracks from enabledTracks after reseting outTemp to zero, so that
process__genericNoResampling will reset outTemp and noise won't appear.

Bug: 12450065
Change-Id: I1ccac7ee4a3bf7fd930254356c072099e11e7c19
Signed-off-by: Gaurav Kumar <gaurav.kumar@broadcom.com>
Signed-off-by: Pierre Couillaud <pierre@broadcom.com>
screenrecord: allow force landscape mode

Some devices' hardware encoder do not support encoding over a
specified height, which may be smaller than the device's display
height in portrait mode. Add a mode which uses landscape encoding
and rotation hint to overcome the limitation.

Change-Id: Icdd8de05d55c2aaaacbcaba4857173c78ef76a24
libnbaio: Fix previous get_presentation_position commit

The previous commit has no effect because HAVE_PRE_KITKAT_AUDIO_BLOB is
actually never defined.

Change-Id: Ic41b5f02c2cee741aaacce6da1839001a49b9410
audio: Add pause support for hardware omx component

-ADSP doesn't enter sleep state after wma playback is paused
and power suspended.
-No support for NT session pause in case of hardware component.
NT session need to be paused to put ADSP into power collapse.
-Add support of pause in stagefright to ensure device enters
suspend mode. Also add intermediate states to avoid concurrency
issues between read and pause.

(cherry picked from commit f0a2da308d5e683ccde2d3d6f52c651bff6634e6)
(cherry picked from commit 27dc50267c424242930afe4740f2ddf5161d6d2c)
(cherry picked from commit 20e8fd2241be5dcf48a03a6f2a7927b6cd1ac15f)
(cherry picked from commit 2a15a4bf9754bda6e53530f65f82fa64b27f0f4f)

Change-Id: I41b946b8c8805e6ee303646b63513b5b16514ef6
libstagefright: Update handling of SBR explict siganlling

In case of SBR explict signalling in the bitstream, the core
AAC sample rate is overwritten by extension sample rate.
HW AAC decoder relies on core sample rate to parse the
bitstream when supplied in raw format.
Do not overwrite core sample rate but store it as separate
field in the meta data.

CRs-fixed: 572242

Change-Id: I5c70cfcc40a44bff9f9da4082c6b4dccd7c6788e
libstagefright: Set the maximums AAC framesize

The maximum AAC frame size is made equal to 8k*4
to handle multiple AAC frames in single buffer.

CRs-Fixed: 505248

Change-Id: I7c7e07620e2da8e1efe3914ebf73832f2f885ec9
libstagefright: Return EOS after buffers are released

Return EOS from SurfaceMediaSource after buffers
have been released, due to disconnect from producer..

CRs-Fixed: 550868
Change-Id: I4b2f3ef1c2895f155260baa0c58d90df4b4210d9
frameworks/av: Fix LOG_NDEBUG compilation errors

- Cleans up undefined references due to scope & naming

Change-Id: Ib342e57c69353fb873c6c0e7ba66e62983676f61
libstagefright: Added mime-types for enca/encv atoms

- enca/encv are encrypted audio and video atoms for
  mp4a and mp4v. Hence returning aac and mpeg4 mime-types
  for enca and encv.

CRs-Fixed: 578506

Change-Id: Ie568ea7eec73e110eef07e2b1b921afefc8c54a7
media: Kill incessant logspam during latency measurement WTF

Change-Id: I79059c176f6c1fb922f48596bc2e078461b09320
frameworks/av: Add audio parameter for sound card status

Add a parameter to signal sound card status to audio HAL.
This parameter is set on a change in sound card state.

Change-Id: I9c2265b6197f654f6dab90f7d0b87a3a0921a6fb
audio: do not allow FAST output for voice call stream type

- Some VoIP applications set AUDIO_OUTPUT_FLAG_FAST while opening
audio output which causes low latency path to be selected. Clear
the flag explictly if the stream type is STREAM_VOICE_CALL
- Add debug messages in Audio Track and Record to print
the requested audio parameters

Change-Id: I7b3d1353ab107effc3f99b99bd9f78270f63097f
libmedia: Increase offload shared buffer size

Ensure that AudioTrack and OffloadThread share at least twice fragment
size worth of buffer space. This helps avoid failure to restart
on an underrun

Change-Id: I4dd9e5e5a7c8aebb34b13f2e6626b73adc2ba557
libmedia: Add support for LCH tones

- Add the INCALL_MUSIC flag for tracks
  created for INCALL_MUSIC stream.
- Adding tones to the ToneGenerator that are
  to be used for Local Call Hold.

Change-Id: If4092630ec67b11fd2844d0218639a2c5ae6b687
audio: ID3 tags of most chinese songs display messy

- ID3 coding format detect and convert issue
- Enhance the detect and convert function

Change-Id: Idf59dd100b8a01b65338a51109d752616abec81b
CRs-Fixed: 494956
libstagefright: Smooth Streaming in OMXCodec

This change is to address startup latency during playback.

Set smooth-streaming mode from OMXCodec by default
if mm.enable.smoothstreaming property is enabled

When crop change is detected, save the target crop/stride and apply
them just before the buffer is (potentially) rendered.
Applying the updates right away may cause artifacts as buffers with
previous resolution are not rendered yet.

This approach assumes that there will not be a crop change within
the detection and application of current crop

CRs-Fixed: 584629

Change-Id: Ia164309edf1c51ed28b929deabecc53fc56cbf33