audio: mute duration at the beginning of recording

-AudioSource mutes for predefined duration (kAutoRampStartUs)
 at the beginning of a recording. Current kAutoRampStartUs
 is not sufficient to mute the shutter sound click on
 B-Family devices. Sometime shutter sound is getting recorded
 with the current kAutoRampStartUs.

-Issue with calculating muteDuration from getOutputLatency is,
 more delay is getting added for Bt(~1 sec) which is really not
 required.

-Fix is to use constant mute delay which is appropriate

Change-Id: Ied20dc44c56cc74c74fb001383d3c533cb54b632
CRs-Fixed: 636491
Fix kAutoRampDurationUs overflow issue

When kAutoRampDurationUs multiplies with mSampleRate, it overflows to int64.
Type cast it to int64 to make sure RampDurationUs properly.

BUg: 11162491
Change-Id: I4f93bc9acc8456e25623a9255ca7a5b206425009

Conflicts:
	media/libstagefright/AudioSource.cpp
audio: calculate mute duration using getOutputLatency

-AudioSource mutes for predefined duration
 (kAutoRampStartUs)  at the beginning of a recording.
 Since kAutoRampStartUs is zero, video recording tone
 is also getting recorded in the beggining.

-Fix is to get the output latency of current playback
 stream from audio system to calculate mute duration.

Change-Id: Ib9f4d38fcc8478d148719b70358644c581ba2f25
CRs-fixed: 615511
audio: mute duration at the beginning of recording

-AudioSource mutes for predefined duration (kAutoRampStartUs)
 at the beginning of a recording. Current kAutoRampStartUs
 is not sufficient to mute the shutter sound click on
 B-Family devices. Sometime shutter sound is getting recorded
 with the current kAutoRampStartUs.

-Issue with calculating muteDuration from getOutputLatency is,
 more delay is getting added for Bt(~1 sec) which is really not
 required.

-Fix is to use constant mute delay which is appropriate

Change-Id: Ied20dc44c56cc74c74fb001383d3c533cb54b632
CRs-Fixed: 636491
audioflinger: OffloadThread fix for resume underrun

AudioFlinger can miss resuming h/w on a pause->resume transition
if sufficient data isn't available.

Change-Id: I3632b44571201bb47155f2ed3ad425fe68e04492
CRs-Fixed: 616599
audioflinger: forward device change to effects in direct thread

Device change during offload playback is not informed to effect chain
which causes effects still work on unexpected output devices. Add device
change notification in direct output thread.

CRs-Fixed: 630408

Change-Id: I094a99bdf540479cee2fca6614ec35c2fa7d6046
AudioTrack: Handle track invalidate on wait for stream done

If a track invalidate is called while waiting for a stream done,
AudioCallback handler is notified with event EVENT_STREAM_END.
This might cause substantial data loss for offload playback. Try to
recreate the track if needed.

Change-Id: Ie663c85e92588ddfd8d633f4bf5024f9fa4f5c2e

Conflicts:
	media/libmedia/AudioTrack.cpp
AudioFlinger: Introduce CBLK_STREAM_FATAL_ERROR flag

On a fatal error, PlaybackThread (or its derived classes)
can opt to signal an error back to the AudioTrack using
this flag.

Change-Id: Id323df8693c720432a459fe4d844d39033b24598
audioflinger: Remove fatal error handling for non offload tracks

- Audio pop is heared on BT during SSR

- On sound card OFFLINE status,pcm track is
  recreated resulting audio pop sound

- Handle OFFLINE status only for offload tracks

Change-Id: I483d4595b61fab4d0be460b9e481ab82f7ab46b5
Framework: Fixing media server crash.

Fixing media server crash when dump() is called
from camera framework after camera HAL instance
has been released.

CRs-fixed: 634328

Change-Id: Ia837f5c0e722db4e6a7187062adc5d8bcfc93dca
libmedia: Set the correct audio latency in offload mode

- In offload mode latency is decided by Audio HAL.

Change-Id: I0f46ce9cb43e59907c07e77ec57fda47e841b094
CRs-Fixed: 609259