stagefright: STEVE BUYS DONUTS

 * Unbreak the Hammerhead build.

Change-Id: I139a8a15d05c3b1bf8811b50a3d0b33292b0eb63
stagefright: Scan for ".ts" files

Change-Id: Icd837ccbb188524a393de07a6c261b9f95ffb0ca
stagefright: Fix CTS failures

Change-Id: Ibe30029409667912ff150df47e3be8dd2956844b
effects: miscellaneous fixes

fixes of KW issues 8887, 8888

Change-Id: I824daa76d23456fed2c299c59f934d3e2ac78b84
libstagefright: Handle INFO_FORMAT_CHANGED for dolby clips

  -For dolby clips when device is switched from headset to
   BT multiple times, media error is observed, and playback
   stops
  -When end device is changed, s/w Dolby decoder generates
   format change event which in certain condition leads to
   media error and playback stops
  -Make sure format change error is handled in AudioPlayer
   layer

CRs-Fixed: 706801

Change-Id: I3ff3ef84b15ea5f9d3288215c1491dc30d17a413
libstagefright: extend the interface to switch rtp transport

- rtp transport can be changed by setting property "rtsp.
  transport.TCP" and udp is the first choice as
  default. But the property is the global variable and
  affects each instance's behaviour.
  Extend the interface of MyHandler to let each client make
  its own choice. If the client wants to choose tcp first,
  add the string/value "rtp.transport.TCP"/"true" in the headers
  when calling MediaPlayer.setDataSource.

Change-Id: I19b6192da36d5c00e62c9f69de446f366f10c75c
Crs-Fixed: 696569
Support MPEG4 and H263 FourCC types in Matroska files

Handles MPEG4 and H263 content with FourCC header in Matroska files
based on how these are handled in the AVI parser.

Also adding placehoders for DivX.

Change-Id: I38b2c2fd429b6e4810a7b118bf60823d502320ae
stagefright: Fix crash if PCM offload gets a null source

Change-Id: I4db08355fb132288cec2ba99ec4dcb77f1618add
media: Cleanup some unnecessary old code

Change-Id: Id204180026b701bbf4c565c34a6fbba8b120eb0a
Remove potential cause of underrun.

1. This part of ProcessAudioBuffer function can make underrun issue.
   Because AudioTrackThread::threadLoop's default case is 'pauseInternal'.

2. Without removed part : If AudioTrack obtain small buffer, then it can request small decoded data to player service without waiting.

3. We already have 'waiting codes' in 'AudioTrackshared.cpp ClientProxy::obtainBuffer', it using '__futex_syscall'.
   If we got 'full shared buffer', then 'ClientProxy::obtainBuffer' waits 'ServerProxy::releaseBuffer'.
   It means, there are duplicated 'waiting codes' for ProcessAudioBuffer.

So I removed this part for preventing underrun issue.

Change-Id: Idcca686054d92a4d123873b78b3b9c2e87d3bdca
Signed-off-by: Jinhyuk Seong <jin.seong@lge.com>
Revert "libmedia: Add flag for non-native FAST tracks."

 * Changing design of this, no longer needed.

This reverts commit a667d25f10063679829f3eca39d6d6d84d3ac05e.

Change-Id: If8e348cdf53f01314a05fa4ea1a5dfdec6cc24ba
Revert "stagefright: Disable HSR for now"

 * Adding support for HSR on new chips.

This reverts commit 23373ed880fc124f20a6ee90e539576ffbfddba8.

Change-Id: I468498e72bae874184bdbb85cbc92c735365b403
libstagefright: HSR: Read framerate from HSR key

- HSR and HFR keys are made mutually exclusive now.
- In case of HSR, HSR key will be set with requested frame rate and
  HFR key is not set.
- In case of HFR, HFR key will be set with requested frame rate and
  HSR key is not set.
- Check
     if video-hfr key is set
        set kKeyHFR with HFR key value passed by camera
     else check video-hsr key, if set
        set kKeyHSR with HSR key value passed by camera

Change-Id: Ic7ad098137812ad78afdc326334fa390404075fc
libstagefright: use appropriate hevc decoder on 8916 and 8939

8916 supports HEVC software decoder and 8939 support h/w decoder.
Based on media.swhevccodectype and media.hwhevccodectype properties values
instantiate appropriate HEVC decoder.

Change-Id: Ic3d37e6184db256f4d83bfe74b67271b20f94ec0
camera: Always enable preview metadata

 * Remove the ifdefs which enable/disable the preview metadata during
   start/stop preview.  This causes issues with face detection and
   other uses on new hardware.
 * I am not aware of any hardware which still needs this.

Change-Id: I3dd0941a61affb4862a2e8f4f0c2cf59c95b150e
stagefright: Avoid querying time from AudioPlayer after audio EOS

If a clip's audio track is shorter than its video track, the system
clock is used as the time source after audio EOS. However AwesomePlayer
continues to query the media time from AudioPlayer within
onVideoLagUpdate. This may take longer than the expected onVideoEvent
interval of 20 ms which can cause delayed or dropped frames.

Additionally, if onVideoEvent is more than 500 ms late, AwesomePlayer
triggers a video-only seek to the incorrect audio EOS media time. Since
the system clock continues to tick, video becomes even later after seek
and seek is triggered again, resulting in a continuous seek.

Stop querying the media time from AudioPlayer after audio EOS to avoid
this scenario.

Change-Id: I5c56a51509f8787d384696c703a9327b0fa5dbac
CRs-Fixed: 739308
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