audio:Avoid AudioTrackThread if Track creation fails

-mAudioTrackThread is starting before the track creation.
 This thread is used to process the audio buffer, which
 is no longer valid if the track creation itself is
 failing.

-Fix is to check for the result of track creation and
 based on the result need to start the mAudioTrackThread.

Change-Id: Ic69e45f4269408ff60fe83390e9f8d0c895582e3
CRs-Fixed: 611668
audioflinger: Ensure SRS effects are applied on active tracks

- When device is switched from BT to wired headset
  without disconnecting BT, SRS effects are not applied
  on wired headset
- Currently SRS module is checking for connected BT
  device and overriding the updated device from framework,
  with BT if BT device is connected
- call the API which will tell SRS module not to
  override the updated device from framework, irrespective
  BT device is connected or not, also while calling SRS API
  from mixer thread check if the track is active

CRs-Fixed: 640351

Change-Id: Ia96d0721d1811f18dbcfc08d96c5f1931359191a
Fix for getPosition after seek

When starting playback with a seek pending
(calling seek before start) there is a brief period
when the audioplayer returns an incorrect position (zero)

This is caused by that mSeeking is set to false
before the position in the audioplayer actually is updated.

Change-Id: Iaec355c8fdfe589d9b826d20c2531034f2b4e6fb
accelerate camera recording start up speed

When do initial buffer submit, if do drainInputBuffers() first, it will always wait all input buffers reached,
and then start fillOutputBuffers().During this time, nothing to do in level codec, all time is cost on waiting,
it is especially severe for Camera recording case, for example, in 30fps case, If 3 input buffers are required,
HW codec will wait at least 99ms to start video encoding, since no outport buffer ready at this
time.

After change call sequence, fillOutputBuffers() is done fast firstly, then do drainInputBuffers(),
when receive one input buffer in HW codec, it can start working immediately, because the working condition is reached,
both input port and out port buffers are ready.

Change-Id: If74fd839f2bb0cae6c7d8ae0912d47abb2cdc045
Signed-off-by: jiguoliang <guoliang.ji@intel.com>
Signed-off-by: ywan171 <yi.a.wang@intel.com>
Set the correct audio bit rate for camera recorded content

Remove the hard coded value for bit rate and replace the value
with the information from meta data.

Change-Id: Ib643c79bbdddaafb3dc703448645606267f7ca4d
RTSP: Don't post AUTimeout check during pause when EOS is nearing

RTSPSource will not issue pause to MyHandler when streaming is about
to finish even when streaming is paused. Thus, in this case,
the accessunit timeout check will continue to see if any packets are
received or not from the server. As there will not be any more
access units coming from server after EOS, the session gets terminated.
In this scenario if resume is issued, the player crashes.

Set the AuTimeoutcheck flag to false in case if pause is not
issued to MyHandler when nearing EOS. Based on the value of the flag,
the access unit timeout check will be performed.

Change-Id: I9bdbc6bb21e441e22ed431a9e433b232df56a69e
CRs-Fixed: 676054
Added support to query ACodec whether adaptive playback is enabled.

Bug: 11854054
Change-Id: I6b0308aa8550c643706959277e46dad586c37297
stagefright: Fix the input channel count

Change-Id: Ib59e0c9d4ed319a1c23177dcb54dc82d32eb8992
frameworks/av : Add Null check for Audio Track

Check if AudioTrack is available before de-referencing
it's pointer to avoid crashes during stability runs

Rootcause: During Video playback when the audioTrack
init fails due to mediaplayer errors, the getMediaTimeUs
is already getting called resulting in a crash.

Fix: Added NULL pointer check when de-referencing pointer

CRs-Fixed: 658536
Change-Id: I0846e5cd805cb1523edb52ea9c7c04b41f954e6f
mp3dec: Hide legacy stuff

Change-Id: I5ddcbda93634ecfff4d7a03fbeb2b96102b53c2b
stagefright: fix offloading HE-AAC sampling rate.

Fix HE AAC SBR sampling rate reading for explicit
signaling.

Bug: 11697128.
Change-Id: Ifec0ab9d48d9293f6774ec1efd9da9445994cb7c
libstagefright: Don't invoke FFMPEG for MP3

Change-Id: Ia30d25d1a994328827f14a286661cd2e1eaa1181
stagefright: More custodial engineering

Change-Id: I2c7c49da5e01a8e9806a26727a09f0ea74875fd3
stagefright: avoid crash while seeking MKV content

by returning from seek and avoid a NULL pointer access
if the cue-point for video cannot be found at intended
seek position.

CRs-Fixed: 681515
Change-Id: I4d60a1dcf70d162031a3df70ec2847d02dbc7ab1
audioflinger: remove wake lock implementation from APS

-AudioPolicyService is not able to acquire the wakelock.
 None of the Audio functionality is impacted though it always fails
 to hold the wakelock.

-APS tries to access wake lock directly using hardware_legacy APIs
 and it always fails due to lack of capability.

-Remove the wake lock implementation since it always fails and
 it does not impact any audio functionality.

Change-Id: I0055c188fb8d6fd70a27c3945f5e68addac8509b
stagefright: Do not drop encoded frames when writer is paused

Since the source drops input frames when paused, there is no
need to drop encoded frames in the writer as we run the risk
of dropping a key-frame.

Change-Id: I173f1ad2b610ad400ac43e0cd83ee1a7ed249b6b
CRs-Fixed: 682499
libstagefright: Disable smoothstreaming for secure playback

Disable Smoothstreaming if the property "mm.disable.sec_smoothstreaming"
is set.

CRs-Fixed: 664732

Change-Id: I36da2e3bf73c802166e62ea3bfadeac523663b77
httplive: fix issues during httplive streaming seek

- Cache the new seek position during the last seek progress.
- Before starting the fetchers, check whether one new seek
  operation comes. If yes, reset to change the configuration
  based on the last cached seek position.
- This change can avoid ignoring the new seek operation before
  finishing the last seek progress.

Change-Id: I2a99198881d023b7afc0ec310395e2f86d7105d9
Crs-Fixed: 623264
media: Fix visibility of destructor

 * This was removed in 3ed51e2299931c8fe8b21ca5a4a0780a6846b2cc, but
   it is still needed by the legacy audio drivers.

Change-Id: If4da23077be8c00577b63991ad998fca41e85c01
Merge remote-tracking branch 'CM/cm-11.0' into cm-11.0