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: When paused, return cached playback position

An offload output can be re-used between two audio tracks having
the same configuration. A timestamp query for a paused track
while the other is running would return an incorrect time.
To fix this, cache the playback position on a pause() and return
this time when requested until the track is resumed.

CRs-Fixed: 612943

Change-Id: I54b5a851ee3fa2ceadc37e3f5c6af4f37b8f404a
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
stagefright: Handle missing text track language

Only set timed text language if kKeyMediaLanguage is found.

Crs-Fixed: 641896

Change-Id: Ie471bc458e42f5728064e447ac5c33b07311d3fd
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
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
stagefright: Remove dead code

Change-Id: Ic543dfc5f1278dda1073e607fa9bdb381555256b
stagefright: enable traces for performance debugging

Trace number of video output buffers with OMXCodec, EBD,
FBD messages. Trace calculated sleep-delay in AwesomePlayer
and trace AudioPlayer::fillBuffer call.

Change-Id: Ib63fa4da48e690c79d57e134a6ad4519e396d198
AudioTrack: Never try to use the fast path if resampling is required

Unless AudioFlinger was built with FAST_TRACKS_AT_NON_NATIVE_SAMPLE_RATE
enabled, AudioFlinger would deny using the fast path (and internally
fall back to the normal codepath) when it realized that resampling
was required. Since the buffer size calculations within AudioFlinger
don't take resampling into account properly (see the calculation
below "AUDIO_OUTPUT_FLAG_FAST denied" in audioflinger/Threads.cpp,
just below the hunk that this patch changes), make sure AudioTrack
doesn't try to use the fast path if resampling is required.

This removes the possibility to enable
FAST_TRACKS_AT_NON_NATIVE_SAMPLE_RATE in AudioFlinger since it
AudioTrack now won't even try to use the fast path for content
that requires resampling, regardless of the AudioFlinger configuration.

Change-Id: I6b49c27d612c29ddc98c07538516cfddef799a33
Revert "audio: ID3 tags of most chinese songs display messy"

This reverts commit 84996575335349e24b01910a43a09df37a720887.

Breaks for a lot other languages ID tag especially if it has special
chars

Change-Id: I4aa69b5ebebb9a35a835a543b49c72baf5c021f8
Merge remote-tracking branch 'slim/kk4.4-caf' into ose