frameworks/av: squashed CM commits

audioflinger: Allow mixed use of JB A2DP HALs and ICS policy

Old policies don't address the modules by handle and expect them
all to be scanned for supported devices; new modules stopped
listing supported devices. The combination of a new A2DP with
an old policy left policy unable to find A2DP outputs, so the
new HALs couldn't be used.

So... if an old policy is in use, searching for an A2DP output,
and finds a non-primary HAL that doesn't list any device, assume
it's A2DP and use it.

Change-Id: Ie946c065b5c325afd02ba3437077f634e079b386

frameworks/av : Playing AAC and MP3 clips using LPA.

-AAC and MP3 clips are not playing.
-AAC and MP3 are not using LPA path.
-Enable LPA decoder path and implement LPAPlayer class.

Change-Id: I76438319fc72c4898fad5910f8de874f89287687

Fix mako build.

Change-Id: Ic73cb2f4152ac77a83fcda7e89b4a8202df440c6

libstagefright: Adjustment for TunnelPlayer buffer size

- Make necessary adjustments to align the buffer size
  for TunnelPlayer to satisfy the following conditions
- Buffer size is a multiple of LCM(1,2,4,6,8)
- Buffer size is aligned to 4k.
CRs-Fixed: 447274, 442365

Change-Id: I1b7f9ac3cf8ff86f972a8b6798bfcff3a4ba7c64

audio: apply volume on DirectOutput streams

- Call stream->set_volume to apply volume on
  particular stream of DirectOutputs

Change-Id: I98e3b856ee508d407f893afad66caade5eda3e4a
CRs-Fixed: 445953

libmediaplayerservice: Add new player for DASH

- Add new player factory to support dash playback.
- DASH urls end with .mpd. When media player receives
  an url with .mpd, it will use new factory to instantiate the player
  to be used for supporting DASH playback.

Change-Id: I69e5a08fb2baf89d97b1e0711dbe52a8b1c39c29

ACodec: Support for dynamic port reconfig

- On port settings changed first flush output port
- Move ACodec to new state called FlushingOutputState
- Flush all output buffers, wait till all decoded buffers
  are rendered
- Then disable output port, and allocate output buffers
  with new resolution, and reset native window

Change-Id: Iafa266371ed2a87b909fbcb4eeae6b64208df617

libstagefright: Add support for frame-by-frame mode

- Set decoder in frame-by-frame mode always, except for interlaced
  content, for which arbitary mode should be set

Change-Id: I8195a40549898b43a0e03d65663c7148f458c448

audioflinger: Fix to set correct volume in Tunnel playback

- After a pause and resume, tunnel playback volume is always
  set to maximum irrespective of the volume value before pause.
- The cause for this is, the stream volume is not used to set
  the volume in directaudiotrack.
- Fix is to use the stream volume to set volume during tunnel
  playback.

Change-Id: I59cda146ed88bd5c4186aeb9ae5d165f4a27493f
CRs-fixed: 452285

libstagefright: Check for duration > 0 to avoid DivideByZero crash

- duration = 0 can cause divide by zero and for this clip duration
  is indiacted as 0.
- check for duration > 0 rather than duration >= 0

Change-Id: I58ccacbf7ede892dff9626715162ea7b1f2ddbc6
CRs-Fixed: 451855

libstagefright: Squashed commit of LPA/tunnel updates from CAF

libstagefright: Exceptions in using Tunnel mode decode

- Accumulate all known exceptions to a separate function

Change-Id: I61bbc288c9a087559db210e76141b8c57e67fff0
CRs-Fixed: 432080

libstagefright : Stability fixes for Tunnel Player (part 2)

- Synchronize b/w reset() and onPauseTimeout
- Synchronize b/w seekTo() and onPauseTimeout

Change-Id: Ia5cfc6b4dcc326ead440fba35d809d4f3f1b5a81
CRs-Fixed: 449122

Revert "Revert "libstagefright: Convert mono to stereo for LPA clips""

This reverts commit 0db8a19fb3216a8a83d5d6cbd5f1ccbf997a20d8.

libstagefright: Port Tunnel mode fixes to LPA

- Miscellaneous fixes for seek, pause/resume, EOS handling
- Miscellaneous fixes for synchronization between the decoder thread,
  TimedEventQueue and the player thread.
- This change is a port of a similar set of changes made for
  TunnelPlayer

Change-Id: I82c2904f7aedfb9c4f03200419fcba8b038e3d54

libstagefright: Avoid use of extra bytes to signal seek processed

- A few bytes were reserved in the buffer sent by Tunnel/LPA
  player to audio HAL to indicate a seek has been processed and
  there is no need to skip it.
- We won't need this method anymore as this can be fixed instead
  by synchronizing seekTo() and the extractor/decoder threads.

Change-Id: Ic02ae1699bb59e2f6b8d9fb599d0fa43fd3f19e3

libstagefright: LPAPlayer synchronization fixes

- synchronize b/w seekTo() and onPauseTimeout()
- synchronize b/w reset() and onPauseTimeout()

Change-Id: I29a4ccf02e28fe7b7c00e35a679ff2b5271ffb6f

libstagefright: TunnelPlayer performance tweaks

Some tweaks when TunnelPlayer is used for audio/video playback

- Keep the extractor thread at ANDROID_PRIORITY_NORMAL
- sched_yield() after reading a frame to give the video thread(s)
  (CallbackDispatcher and/or TimedEventQueue) to be scheduled

Change-Id: If0d86d629fd0e15aff917af8589472578cd28bf4
CRs-Fixed: 444041

libstagefright: Fix incorrectness nPortIndex value for QueryCodec
                The query index is wrong, it will make a death loop in
my ME722 when get resource thumbnail for MPEG4 video.

Change-Id: I64532156e762b847a8eae59560fb828549c29519

libstagefright: Stop the logspam from LPAPlayer

Change-Id: Id6319774806e152333d468b9ff62d148e476555a