audio - Query midi decoder state after stop()

 - On midiplayer stop, mState was not updated correctly
   hence when isPlaying() returns true to application.
 - Fix is to query midi decoder state after stop() so that,
   isPlaying() will return false after midiplayer.stop() to
   application.

Change-Id: If1e260e93da1712873b8419b611abe3206dd0f47
CRs-Fixed: 633774
libstagefright: Fix crash in FLAC decoder during fallback to sw decode

- Playback of FLAC clips fail over A2DP when PCM offload is enabled.
- As offload is not supported for A2DP, playback falls back to software
  decode during which the source (FLACDecoder) is stopped and the
  buffers allocated to the decoder are freed. These buffers are not
  re-allocated before attempting to decode data due to which
  the decoder crashes.
- Allocate memory while starting the decoder instead of allocating
  it during initialization.

CRs-Fixed: 743183
Change-Id: I05d9d2328ac8b959ae112699475d80556a4738b5
GenericSource: Aggregate fewer audio i/p buffer for http streaming

Aggregating huge audio i/p buffer in streaming use case will cause
delay in fetching video i/p buffer and starving video decoder which
will eventually causing frame drops. In case of clips with abnormal
a/v interleaving, audio and video offsets can get too far apart
causing frequent underrun and staving both A/V decoder resulting
in choppy audio and video freeze.

To avoid this issue aggregate A/V buffer similar to  widevine
use-cases, reduce the audio buffer count to 8 and add an extra
video buffer.

Change-Id: I0afdbe11a1e427bd63a10f5cd874dbf6d102e6ab
frameworks/av: Integrate STAProxy for httpstreaming

Added support to integrate STAProxy support in httpstreaming

Change-Id: I72a531b254fa06f2dd22cdbfd9d102f741d4f092
frameworks/av: Integrate STAProxy for NuPlayer httpstreaming

Added support to integrate STAProxy
support in httpstreaming through NuPlayer

Change-Id: I544d8c2620a8da0fbfc7e4a15f64641145d77ccf
media: Add NuPlayer, recording stats using ExtendedStats

Add Statistics for NuPlayer using PlayerExtendedStats.
Add Statistics for recording using RecorderExtendedStats.

Change-Id: I613bd2d44a25315297294abb87aeec2634d30c36
DataSource: Remove global variables in DataSource related to sniff

Remove global variables related to sniff, and added Sniffer class
to implement the sniff functionality with non-static members.

Change-Id: I6fbd0ba5b686e09fda11d78cdd687a69c81a6bdf
CRs-Fixed: 567753
hls: Print segment information in PlayListFetcher

Enable printing the segment information in PlayListFetcher
and remove the print in LiveSession.

Change-Id: If2a872a1e7f82c3bedf81748b13ddf4d19589428
NuPlayer: Add RTSP Server Timeout Setting to Meta Data

- Operator requires MoviePlayer to prompt dialog when the activity has been
  paused for longer than server timeout. This patch adds server timeout
  to meta data, so app can get the timeout value.

CRs-Fixed: 638087
Change-Id: I08f98e965497047c420d9d6ecc0b2898abe56369
libstagefright: Instantiate FLACDecoder at runtime

Remove the entry corresponding to FLACDecoder from
media_codecs.xml and instantiate it in OMXCodec for
mimetype "audio/flac" at runtime.

Use Google's RAW decoder to support ACodec path as
FLACDecoder is not OMX compliant.

CRs-Fixed: 749235
Change-Id: Ia8842256d00dd53293335535d3b03a3beffb13aa
audio: use FLAG_FAST for non-music stream on WFD

- Issue: WFD audio routes back to target speaker when
  starting a ringtone playback. Music and ringtone playback
  is mixed on target speaker. Expected behavior is music
  plays on WFD sink and ringtone plays on target speaker.

- Root cause:  primary output is created for music playback
  over WFD. The same primary output is reused for ringtone
  and output device is updated based on SONIFICATION strategy
  for both ringtone and music playback.
  The same issue is not seen on stock Android solution because
  two different HALs(remoted_submix for WFD audio and primary
  HAL for ringtone) are involved and primary output is not reused.

- Fix: update output flag to AUDIO_OUTPUT_FLAG_FAST when there
  is a non-music stream playback on WFD. So primary output is not
  reused for SONIFICATION strategy.
  Use AUDIO_EXTN_AFE_PROXY_ENABLED instead of WFD_CONCURRENCY to
  compile related code since WFD_CONCURRENCY is not enabled for
  all targets.

Change-Id: Id2f5965c8f5623646b2adb2aa892a9929f3bc5bb
CRs-Fixed: 745667
audioflinger: exclude channel check for offload thread

When moving effect chain between two playback threads, there's a
channel count check for stereo only. Such check only applies for deep
buffer playback where we upmix or downmix all channel count to stereo.

However, this constraint is not applicable for offload threads.

CRs-Fixed: 745226
Change-Id: Iaa16ddef1c19bf8b1c600e8bdb1ee1568a3a45db
audio: compress offload to pcm fallback on SSR

- Add support for error propagation on
  time stamp query for playback session

- Add support for compress to pcm fallback
  during SSR

Change-Id: I4fa793de95bfe58cde7a05735d8f70a672ea19fc
rtsp: Limit subframe processing to available buffer range

With some RTSP servers, the mpeg4 audio subframe count is inconsistent
with the available data. When attempting to process subframes that would
exceed that available buffer boundaries, this causes a memory access
violation. Add buffer size checks to avoid this crash.

Change-Id: I030c6f02c478e216c20d9b24fbd6b3a9c1530889
CRs-Fixed: 737819
Stagefright: Allow MediaCodec::get(Input/Output)Buffers in async mode

since there is no way out to get to the buffer handles.

Change-Id: I66512a1a3d3afb222812d4fdd21f9533bbe85de3
Stagefright: use MediaCodec in async mode for recording

Async mode reduces the number of messages posted between
MediaCodec and MediaCodecSource. This reduces thread
wakeups and helps reduce CPU utilization.

Bug: 18246026
Change-Id: I4b0837f309fdd12e323c1dfa72525f5a31971a03
audio_policyhal: SSR support for compress offload

- reject offload request based on sound
  card state

Change-Id: Idc8f6690d7c06883dbfcf55b073d4456a8c27e5c
audiopolicy: Increase max supported sampling rate for mixed outputs

Increase max to 192000.

Change-Id: Ic886d3e79ec8c332b78e9a1eac30fd919ee19885
Revert "frameworks/av: Integrate STAProxy for NuPlayer httpstreaming"

This reverts commit 1b8d64c940a1852aeee33d15c55313ca6b8e3993.

Change-Id: I14bcb4152f895f6de1125209469900b102171c62
Revert "frameworks/av: Integrate STAProxy for httpstreaming"

This reverts commit 6eb6ffa4f35dd3bd9361db1f2f133c5e5c09d3dc

Change-Id: Ieb19c17ba555d899a45167fa89c96b0250489205