frameworks/av: Update to caf/kk_2.7_rb1.10

audio: Add track to trackToRemove list when it is terminated

- PlaybackThread loop is continuing for direct output even after
  the track is terminated by the client. This is causing 2 direct
  tracks being active when client starts another session
- Fix is add the terminated track to tracksToRemove list so that
  this track is destroyed properly

  CRs-Fixed: 566808

Change-Id: I65f565d9c3a00e071174659ffb92f711dfd8742a

audio: Fixed framecount in AudioRecord

- Incorrect frameCount is passed to AudioRecordClientProxy,
  which is used while user side pointer is incremented
  This is causing distortion in SIP call
- Fix is to use frameCount of the shared block instead of
  frameCount passed by the client
- InputBytes initialization is also done in AudioFlinger

CRs-Fixed: 568988

Change-Id: Iab32234b198ff4d792eea4c4a82097028089013d

audio: update setParameter command time properly

-setParameter is getting delayed regardless of delay is
 present or not. Because setparameter command time is always
 getting updated with wrong values(previous values) with any
 commands.
-Fix is to restrict the updation of command->mTime always.
 Added check to update command->mTime, only when identical
 commands are present.

Change-Id: I10b94b19f64ef4f15495d34f009238a691d1b36c
CRs-Fixed: 568318, 569010

audio: Initialize LPA variables in audioflinger

 - During initialization of audioflinger, a number of
variables related to LPA are not set to default values.
This causes an undesired side effect that the first
effect in the effect chain is considered to be LPA
enabled. Since LPA does not execute effect processing,
switching xLoud on/off does nothing
 - Fixed by initializing member variables in audioflinger.

Change-Id: Ide06fb0e6804558388e6610cc7686f168591e4a5

scale the kMaxCttsOffsetTimeUs for HFR recording

-timestampUs & decodingTimeUs are scaled for HFR recording
-the difference between these is compared against non-scaled
constant(kMaxCttsOffsetTimeUs).
-fix provided to scale this constant(kMaxCttsOffsetTimeUs)
-and compare against the scaled time difference.

Change-Id: I08188423008d8f6a4824f2748d56a1e355d39a89
CRs-Fixed: 566695

AudioFlinger.cpp - audioConfigChanged_l set for srs Tunnel Device Switch

 - During device switch we were only setting the route
   but was not calling audioConfigChanged_l
 - Hence the effects for the new device would apply only
   when there is a config change.
 - Now we call audioConfigChanged_l during device switch
   setPrameter so that the new effects will be apply as
   soon as device is switched.

Change-Id: I641cd8a7d6ffb7423ccfaa45e4c29b1b5352e61e
CRs-Fixed: 548021

Revert "frameworks/av: AAC CSD support for MediaCodec path"

This reverts commit Ic8197138f5107f2a6026c28847e74987d91acc16
Currently AAC CSD is retrieved in MediaCodec using
kKeyAacCodecSpecificData. This support was added as part of
commit Id046b0d4bf96f029c1b6b5d78d753073e38ac841.

CRs-Fixed: 527284
Change-Id: I54bc6204c1fe88f4e4545f501e6bd1bb2a8beaf9
libstagefright: Add legacy LPAPlayer

Ported from change 46451 / Ie2551345bbf047c022d1fecbb7cb2cc4a4c97d72 from cm-10.2

Change-Id: I6ad282993a843883c3b4c3257f5b730ea0d13307
stagefright: Conditionally build legacy audio stuff

 * The LPA and Tunnel mode code is entirely deprecated and breaks things
   for devices which don't use the legacy ALSA audio HAL.
 * Exclude this stuff unless explicitly requested.
 * Also enable rendering statistics for all.

Change-Id: I0aff39439884d27f1a7b30f56b604f6a43f1969a
stagefright: Clean up the ifdefs

 * This should get everything in line for now.

Change-Id: I3e8eaddeab34dbacb7138f9106f53ada404f7b4d
Increase kFastTrackMultiplier from 1 to 2

Change-Id: I158f147295eebcea96e4047d7618069bc48bdd7d
AudioFlinger: Handle sound card status change

1) Update Audio HAL with sound card status change
2) Call invalidate tracks API on all playback threads so that the
   associated tracks can handle the sound card status change as a teardown
   event

Change-Id: I9b8c2244eb80cc08935144affe529591e0728616
audioflinger: check for condition before waiting

AsyncCallbackThread must check for any condition that
was already been satisfied before waiting.

CRs-Fixed: 581978
Change-Id: I7a37c03cddcf7fdaa61c826d71a4d527979ce9e1
audio: Modified API for compress voip formats

 - Modified API for supported compress voip formats.

Change-Id: I0165fc48bbe631d3febf2104e8a28708bf85ef23
audio: do not invalidate stream used by voip

During the process of invalidation of voip streams,
actual driver is not closed so when it tries to open again
getoutput fails as only one instance of voip can be created.
so do not invalidate the tracks used by voip driver.
CRs-Fixed: 494093

Change-Id: I42a962991ce1d586d87f4aecba19c0e5dde6b9dd
 audio: Fix framecount calculation in AudioFlinger

 -Sharedblock implementation expects the framecount to
  be round up to the next highest power of 2. This is
  not done in TrackBase for non-voip case which leads
  to shared block getting corrupted.
 -Fix is to round up the framecount in TrackBase for
  all the audio formats.

  CRs-Fixed:  571279, 573735

Change-Id: I0186bb0e04a080100b364aead447ff2fce495ca2
camera: Handle the num-jpegs-per-shutter mode

 * M7 will set this value to 1, but set the number of burst shots to 3.
 * We need to call takePicture on the hardware a number of times before
   accepting the jpeg.

Change-Id: I169ee3139e8643a39133d7385afe2f88982a1612
audioflinger: Fix for a deadlock

AudioFlinger enters a deadlock (with itself) on trying to free a
RecordTrack object that failed initialization. Clear this
bad object from the caller instead.

CRs-Fixed: 589020
Change-Id: I926f2beb922a70f6924e593e2bbf1a5b5df85b16
DTS Postpro integration (for frameworks/av)

Adds DTS Postpro support in <root>/frameworks/av

Change-Id: I46edfb41571574ffa52c3a3f301cc003f914b00a
libstagefright: Fix incorrect progress bar display during device switch

 -During offload to nonoffload playback switch (speakr to a2dp)
  audiotear down happens which reset current postion and duration.
 -do not reset the file duration during audio tear down and return
  the cached current position if audioplayer is not created.

Change-Id: I924d270d57aee1a9e79cea1c33bbd6bb731b201d
Revert "frameworks/av: rendering statistics for Stagefright."

This reverts commit 1a65f74eebe15e1533ebde98268a454a8b14f815.

Change-Id: I755e293705a72d90a4a855343439b625226c050b

Revert "libstagefright: adjust AV sync late margin based on property"

This reverts commit 14b0bb438a8b3291edd10fb068656e707a31cfb5.

Change-Id: Ibcc3573283282b3f52a813c789f8586965bbc088

Revert "libstagefright: post video events dynamically - calculate amount of time to delay video event after renderusing the formula: delay = (us between frames)-(us taken by event)-(lateness)"

This reverts commit 1ac2a4f83f7d14b3a4d9c4691a5d6bb62fcc5522.

Change-Id: I06b8023d45a2ea1497a87d5adf7bfa7e74dc0710
stagefright: add rendering statistics

 - adds extra fps statistics
 - report via dumpsys
 - prints statistics before reset at the end of playback onto
   logcat
 - adds resume latency, from play_l to render
 - adds seek latency, from seek_l to render
 - enables using persist.debug.sf.statistics 1
 - prints all statistics when seek or resume is issued

Change-Id: I6fa34f3d0180c1b8bbad40da42bd241fb89e6866
Audio: Tunnel Exception for AAC main profile format

- Audio is not decoding properly for some mp4 content

- ADSP audio decoders don't support aac main profile

- Added tunnel exception for AAC main profile format

Change-Id: I8470457492e32d94ab36eea7b97f4e4ec8776bb4
libstagefright: Do not use offload playback for DRM content

- Check DRM handle before checking canOffloadStream.
  Do not use offload playback for DRM contents

Change-Id: I519ab05ffe7812968cccc7beaa16709959cf7a53
CRs-Fixed: 587600
av: Additional ifdefs for QCOM DirectTrack

 * Tunnel and LPA mode on legacy QC devices requires the DirectTrack
   code path, which going forward has been deprecated.
 * In order to properly support QC features on 8974, this needs broken
   out in order to not cause problems on new devices.
 * With this patch, QCOM_HARDWARE will enable features common to all
   QC platforms (including legacy), and legacy support will
   automatically be enabled based on the use of driver variant and
   value of BOARD_USES_LEGACY_ALSA_AUDIO.

Change-Id: I1da503309963734fd6603472fb87dd9c95c7b7b5
frameworks/av: Enable subsystem re-start for LPA/Tunnel

-Audio Daemon in Audio HAL intimates AudioFlinger
 of ADSP status (online/offline) using set_paramaters.
-AudioFlinger send set_parameters to its clients
 which is DirectTrack used for LPA/Tunnel playback.
-In case of ADSP crash during LPA/Tunnel playback,
 clean up of DirectTrack is initiated.

Change-Id: I87f720f305765e00e12032eed3e018aeff952390
(cherry picked from commit 02861e0f092c46640576bb8c700418ed82c266c3)
(cherry picked from commit 5abe97aa9e103420813b87e7abb2b676ffe8d097)
(cherry picked from commit 9a27f1e6c449585095e518f0d2f44e621ef18f52)