framework/av: Fix for frame drop in video playback

- Breaks in video playback seen in video clips having audio content
  with sampling rates less than 16kHz.
- While extrapolating real time with system time, the real time is wrongly
  caped.
- Fix this issue by limiting the extrapolated real time only when EOS
  is reached.

Change-Id: I95b6a8f7f1f1fd561c92955cf52151ae2890c9a7
CRs-Fixed: 400398
OMXCodec: Only set B Frames for QC components

Conditionally set B frames for Qualcomm components only instead
of for all components.

Change-Id: Ib626a6a4fb613874d17e78420ef2ca4684ac1c89
Audio: Use temporary flags to force fast flag

-Issue: Camcorder start tone gets encoded in video encoded clip.
-Rootcause: processAudioBuffer() in AudioTrack waits for priority
boost for almost 630ms after which it starts reading data from
AudioPlayer.
Priority Boost is not received because AudioTrack forces fast flag
for this stream. Due to this, there is no request for data from
AudioPlayer to OMXCodec leading to stall in vorbis decoder. This
results in recording of the start tones even after the 300ms
initial delay.
-Fix: Since the idea is to use only fast output profile, we can
avoid manipulating flags completely and use new flags in
case of getOutput. This will avoid changing original flags.

Change-Id: I34fdbb3be03f5a3ce7dc70438b722e25f951f561
CRs-Fixed: 555291
libstagefright: Use hw encoder for video recording

Use hw encoder for video recording based on the platform.

CRs-Fixed: 547779
Change-Id: I5d14d2fabb8d39fe940fa25c88b90252bfd07bc0
libstagefright: Fix for media player error during WMV streaming

-Issue: Power suspend and resume during WMV streaming is
 resulting "Sorry cannot play" error.
-Rootcause: While resuming streaming video, the WMA decoder is
 paused to stop reading input data until a subsequent seek.
 But it is not started again after seek. Hence subsequent read()
 call fails and error is thrown.
-Fix: Check audio source state and resume it after seek.

Change-Id: If3d2dd45c5aba97cf79901d2ea05f5261e3eabd9
CRs-Fixed: 555961
frameworks/av: Fix a/v sync issue for playback over BT

-Audio and video are out of sync when a video is played/streamed
with a BT headset connected to the target.
-AudioTrack does not consider the BT latency.
-Latency of the BT stream added to the existing latency.

-query for tunnel mode latency
-During tunnel playback, we need to offset latency for audio plaback
 on BT devices by querying BT HAL.

Change-Id: I3142d8d70f1adaa6e7f5e37c812b13f69a84282a
Audio: Check for NULL pointer of mCblk and zero division error

latency calculation happens in two places: AudioTrack::latency() and
AudioTrack::dump(). Need to add null pointer and zero division check on
both of these places.

Change-Id: I9cbe8c1c00a390cd626bdbf202124f27e60eb3e3
Fixed-CRs: 548514
audio: Mediacodec initialization check in QCUtils

- Mediaserver crash is observed while playing wma10pro clips
  on MM stability stress

- 8x10 device is not supporting wma10pro format from openmax
  which is resulting component creation fail.
  However in this case multiaac decoder component is creating
  which is resulting crash

- On QCUtils::helper_addMediaCodec without intialzing the codec
  we are trying to add codec capabilities which is resulting wrong
  codec capabilities to assign for multiaac decoder
  Added initializarion & flags check to fix the issue

CRs-Fixed: 552817

Change-Id: I3a612e7e72beff9f07e91f15180edb0fd152dcec
audio: Fix for LCH tone sequence

- Currently the LCH and LCH reminder tones
  are played before the silence.
- Change the sequence to play the tones after
  their respective silence interval.

Change-Id: I556a044bd23199325ffd528fef24c3c678d7627b