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

Conflicts:
	media/libstagefright/AudioPlayer.cpp