surfacemediasource: Do not assume that onBuffersReleased means EOS

When using a surface media source the callee may release/allocate
buffers, for instance when negotiating formats with an external source.

This means that onBuffersReleased might be called but that does not mean
that there isn't a producer in the other end, just that it might have changed
formats.

This patch solves that by if-deffing a CAF addition that makes wifi-display
non-functional in some devices.

Change-Id: Ie702c1b4b32f0b00388beea9cf2ff032a50b0bdb
audio: handle events properly in AudioOutput::CallbackWrapper()

- MediaPlayerService::AudioOutput::CallbackWrapper() can't handle
  AudioTrack::EVENT_STREAM_END and AudioTrack::EVENT_NEW_IAUDIOTRACK

- Fix is to handle the events separately.

Change-Id: I986ce8d859dced19fa0bc82acb180fbd11417ca9
CRs-Fixed: 678573
camera: Allow hardware/camera.h header to be overridden

Change-Id: I715ba261de0b01e61cbfe7cacd567a9f511fb8cb
libstagefright: Wrapper for FLAC CSIM decoder

A new FLAC decoder is being used to decode 24 bit clips with
very high sample rate (192kHz) and this code is a wrapper to that decoder.
The decoder will be used only if the extended extractor is invoked.

CRs-Fixed: 609395
Change-Id: I59a33e0e00fd2fc6e88318d0e597519579aa56e9

libstagefright: Optimize the wrapper for FLAC CSIM decoder

Move dlsym calls to constructor and do all memory allocations
only once to avoid fragmentation of heap.

Also add support to handle multichannel PCM from the decoder.

Change-Id: I7feace450d692528eb00c39df4bffff2c5528ada

libstagefright: Modify the path of FLAC headers

The location of the headers of the FLAC CSIM library has changed.
Modify the include path to reflect the right location.

Change-Id: I13630a089716d8c1b35bfc5451d83ba3f3ade6a7

libstagefright: Add support for FLAC superset clips

Memory requirements for FLAC superset content are high as each
channel can contain upto 64k bytes. Redefine the macros to meet
these requirements.

Also initialize the decoder to give data in configurable bitWidth.
Currently, only 16 bit output is supported though.

Change-Id: I60b7b329bb3c0653f7a7c0fbe55229aaf5d62918

libstagefright: Enable ACodec path for QTI FLAC solution

Use the OMX component of Google's RAW decoder for FLAC codec and
setup NuMediaExtractor to extract PCM samples from FLACDecoder.

CRs-Fixed: 643618
Change-Id: Iaa7594e4d882b52157f49e7c9b2da1861ba49568

libstagefright: Improve logging for QTI FLAC Decoder

Edit logs to print relevant messages when QTI FLAC Decoder is used
to decode FLAC content.

CRs-Fixed: 648845
Change-Id: I1fb5c4f5757dc54c37ac255fda83cb1f96f8504d

libstagefright: Add FLAC format in compress offload path

- Add mime type mapping for FLAC
- Add flac codec specific params in offload metadata
- Set bit width based on kKeySampleBits

Change-Id: I8781edd352346355d6f9a4274d29b85d6f2e4b55

audio: remove key definitions for FLAC meta data

- Remove FLAC meta data specific keys in metaData.h
- Define the same keys in QCMetaData.h

Change-Id: I7249c223d321d59923e970898ae2f4d112ed8ea5

audio: update QTI resampler feature flag

- update QTI resampler feature flag to
  AUDIO_FEATURE_ENABLED_EXTN_RESAMPLER

Change-Id: I79d8323911464dc6777d26b11b4c500782d7a548

audio: update QTI FLAC decoder feature flag

- update QTI FLAC decoder feature flag to
  AUDIO_FEATURE_ENABLED_EXTN_FLAC_DECODER

Change-Id: Id4737f4bc31eb2b8f3c9dc36ca2bdac91e327adc
stagefright: Don't expose QTIFLAC definition unless enabled

Change-Id: Ia3173ddc6adeff37b77bfe6b73e62702a3f178dc
NuPlayer: use video hardware codec only

- if the client has the specific request,
  only use video hardware codec for nuplayer

Change-Id: Id6dd13b99d02ea4466f2014e0e4b3ff9b3f7e492
stagefright: add an extra buffer to ANW's BUfferQueue

Add an extra buffer to ensure video player has a free buffer to
dequeue rather than wait for the queued buffer to be displayed.
Enable logs to indicate number of buffers allocated.

NOTE: This is not needed for 30fps content on 60fps panel, But
making this change regardless for all framerates till root-cause
is identified in SF

Change-Id: Id1048d7a104b2a75613dda8b9cf166e59bc4bb04

stagefright: ACodec: add an extra buffer to ANW's BUfferQueue

Add an extra min-undequeued buffer to ensure framework (ACodec)
has a free buffer to dequeue rather than wait for the queued buffer
to be displayed
This improves the performance of playback via nuPlayer.

Change-Id: If02a91f8121b7a2664c0264498c7b7e3031a88d7
CRs-Fixed: 607794

stagefright: Increase buffers with nativewindow

To avoid frame-drops due to latencies in rendering.

If (minUnDequeued) buffers are caught in display pipeline,
dequeueBuffer will block, which delays subsequent queuebuffer,
and this repeats until a buffer is canceled (frame drop).
This issue is more prominent with high resolution content
on secondary displays.

Adding additional buffers increases the stagger in display
and makes finding a free buffer more likely

Change-Id: I352a77ffcd67c8fdd1c2485e3737ba923950f8fd
CRs-Fixed: 714475
Solved problem with hanging decode call

Improved error handling in Mediaplayer service,
stops decode from hanging when player->start()
fails.

Change-Id: Ia160ff6eb9aeef0971c004e8baa90750e5636479
stagefright: Query PCM output format and fix bugs

 * Ask the decoder about it's PCM output format instead
   of hardcoding exceptions.
 * Google's AAC codec fails on main profile, skip it.
 * Don't crash on unsupported Windows Media files.

Change-Id: I2bfe19993e8b0cf7ff78b6d4b63465be093ae1d0