stagefright: Fix codec lookup bugs on NuPlayer

 * Fix use of WMA/WMV software codecs
 * Fix mpeg2 software codec name
 * Don't override the component name in ACodec. This actually breaks
   stuff because the format isn't available in the kInit message.

Change-Id: I93c292e039de5f24c2ccbd6ae2242b06d28fe518
stagefright: Pass AAC profile from MatroskaExtractor

 * Needed by framework to determine audio apth

Change-Id: I8d928852fb4a24e3d575d70fbf366bae1a178b31
stagefright: Cleanup and improve format parsing

 * Move FFMPEG-specific exceptions to FFMPEGSoftCodec
 * Add handling for AAC MAIN profile
 * Use the new OMX_AUDIO_CodingAndroidAC3 to handle AC3

Change-Id: Ibb806cd2b9dd23dc1e1b2c862fcde40605023a49
exynos4: libstragefright: add support for samsung colorformat/omx/mfc

Source:
http://git.insignal.co.kr/samsung/exynos/android/platform/frameworks/av/commit/?h=exynos-jb&id=1614612f7ca2a00473d202dbedcb135fadc608ad

Conflicts:

	media/libstagefright/ACodec.cpp
	media/libstagefright/OMXCodec.cpp

cherry pick from 906eba9f

Change-Id: I1c174f8e9fa9bd3ed16a0399f070b6680f6a331c
AudioPolicy: Reject offloading for non-music streams

- Reject output request if called with non-music stream
  type but with AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD

- This will allow the client to fall back to SW decode or
  deal with the error appropriately.

Change-Id: Ib7a805a884b02b3e5169da334292dfb776fe41bf
raw : Increase the input/output buffer size of raw omx component.

 -Few specific flac clips are not playing using QTI-FLAC decoder.
 -Nuplayer uses the OMX component of default RAW decoder for FLAC codec,
  So increase the input/output buffer size of raw omx component to
  support specific flac clips.

Change-Id: Ieb528b0b210a8649d86b4ccde940256472b95443
libstagefright: Fix wrong #ifdef statement

Change-Id: I4674317982866896cfc5b9b0fea931c8a5def3a0
audio: Fixed input device check in checkInputsForDevice

- When an input device is disconnected, checkInputsForDevice clears
  dynamic fields of input profiles that are supporting the disconnected
  device. AUDIO_DEVICE_BIT_IN mask is missing while comparing with the
  supported input devices of a profile which is resulting in clearing
  wrong fields

- Fix is to include AUDIO_DEVICE_BIT_IN in this comparison

CRs-Fixed: 753189
Change-Id: Icc94b8353bc49567d8a6d6a75293c3b0dd42d83c
ToneGenerator: Limit tones to 48k

DTMF tones are played at the hardware module sampling rate.
Until now, this rate was limited to 48k. Tones sound not too
pleasant at higher rates (like 96k and 192k). Ergo, limit the rate
to 48k.

Change-Id: I7fbc3185d988628ce3ee478076a322857221dece
AudioTrack: Handle track invalidate on wait for stream done

If a track invalidate is called while waiting for a stream done,
AudioCallback handler is notified with event EVENT_STREAM_END.
This might cause substantial data loss for offload playback. Try to
recreate the track if needed.

Change-Id: Ie663c85e92588ddfd8d633f4bf5024f9fa4f5c2e
Revert "Audio: fix stop issue for compress capture using MPEG4Writer"

- MPEG4Writer is waiting for FBD and camera stops giving buffers,
  then there is no buffer available to writer and thread is not
  joinable results in deadlock.
- Stop audio source before pthread_join to avoid deadlock during
  video recording

Change-Id: I871a969d844d98836b2e05d6d86606400926101f
stagefright: httplive: Propagate target duration to LiveSession

LiveSession's switch-down monitor requires the 'targetDuration'
key to evaluate the switching threshold. Ensure that this key is
set in the access unit metadata.

CRs-Fixed: 759581
Change-Id: Ib30f3b4bd8185a77a06abd755822f96644968a21
stagefright: Add Awesomeplayer statistics using ExtendedStats

Profile Awesomeplayer statistics using ExtendedStats module.

Change-Id: I31cad6ea0e3c4b86e48c47ae4c706c9574cf6a72
stagefright: Fix startup latency profiling

Start first frame profiling before the 1st ETB. Also move the
setDataSource profiling to after reset.

Change-Id: I6ea6c3da838e5dda1f73ec1c0070c72492383227
stagefright: ExtendedStats: Only enable stats with property

Only enable the extendedstats when property:
persist.debug.sf.extendedstats is set to 1. Change the constructor
of AutoProfile to pass the MediaExtendedStats module and do the
NULL check inside it instead of at every call.

Change-Id: I0d41469e41f358506638d76dc995ed3acda2b403
audio: Clear audio source if it is failed to be started

- fallbackToSWDecoder is not deleting mAudioSource, mOmxSource
  when there is an error while starting the source. Due to this,
  play_l calls stop() on mAudioSource even when mAudioSource is
  not started. This is leading to a crash in MPEG4Source
- Fix is to delete mAudioSource and mOmxSource if it is failed
  to be started

Change-Id: I6f555f5094b813a1e4ef3934c9e7a712ba41be02
Stagefright: ExtendedStats: simplify bitrate calculation

Replace usage of stl::SortedVector with a static array to
calculate moving average

Change-Id: Ic8f9d8320c30d01090d7a53ddee9d1b168f76a42
audiopolicy: Add support for multiple offload playback

Add support for multiple concurrent offload playback

Change-Id: Ib7ebf91db0c8c41e8354d2ef65c747e564d265fa
(cherry picked from commit 3cda51ca4117ad7f0f5f95d35bc0e14a272d3ebf)
libstagefright: Fix for testHEVC_flushConfigureDrc

Some CTS test cases are sending the component name instead
of mime type. Check for the same before overriding the component name.

CRs-Fixed: 741059

Change-Id: I31b6052aa4972d6cb44e7e564cef945a18fcca25
stagefright: ExtendedStats: Fix ExtendStats AMessage dup crash.

AMessage setObject should not be called with NULL, as this would
cause a crash in dup(). Call AMessage setObject only if the
ExtendStats object is not NULL.

Change-Id: I61c88f820d5ff8d69e34ff0eef68bae2d28f4f52