stagefright: update support for omap3 decoders and encoders

OMAP3 uses 2 decoders, 720P.Decoder and Video.Decoder.

720P.Decoder is proprietary OMAP3 decoder from ITTIAM. Only
one instance of the 720P decoder can run at a time due to memory
restrictions (512MB) and it's quite slow at thumbnail generation
and it's resource hungry.

Video.Decoder is opensource and could support WVGA resolutions.
It only supports baseline profile and max level 31 for AVC, but
could run 4 instances at the same time and is quite fast especially
for watching WhatsApp videos :P

Using the 720P decoder for low resolution videos is not optimal and
trying to use the Video.Decoder for videos other than Baseline profile
will crash the entire DSP and would require a reboot. Currently
stagefright uses codecs in the order they appear in media_codecs.xml
without querying the supported level and profile from the decoder,
due to which wrong codecs are selected causing problems.

Similarly there are 2 encoders, 720P.Encoder and Video.Encoder. They
support different resolutions and should be used selectively.

This patch has been forward ported from Gingerbread branch.

Change-Id: I74f843fe5d28faefa0b51191778ab2ee8c54f5f6
av: QC AAC encoder supports 320KBps

Change-Id: Ic937a79cd081aa1ccde395d29c02111019454003
Merge remote-tracking branch 'cm/cm-11.0' into kk-4.4
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
stagefright: add ClockEstimator API and WindowedLinearFitEstimator

Change-Id: I74474c385848a8eab2ac0da7c069510378e2b217
Smooth out AwesomePlayer

Use clock estimator to smooth out audio time stamps.

Change-Id: Iec1ff30c011069d06ff8051fc4839d00895463d6
audioflinger: Stop resetting compress offload streams

 * This code should only be invoked for legacy DirectTrack.
 * Fixes issues with compress offload failing due to lack
   of metadata after skip / seek.

Change-Id: I4e2eef6421421532556ba411542cfe2f9c1e3802
Merge remote-tracking branch 'cm/cm-11.0' into kk-4.4
libstagefright: Fix incorrect comparison of mimetype

'sizeof' is used to calculate length of string constant which returns
size of pointer to string constant. This causes comparison of only
four characters of mimetype. By using strlen, entire mimetype string
is compared - which returns correct result.

Change-Id: I4d081d3452f167d49aebbe3219e8e522ec29d5be
CRs-Fixed: 664311
 libstagefright: Use channel count if channel mask is zero.

-If the channel mask which is part of the meta data is zero use
 a valid channel count to update the channel mask.
-PCM offload playback for wav clips fails for some clips because
 channel mask part of the wave header is zero.

CRs-Fixed: 664374
Change-Id: I1bd5f2cc56fbc1eb9a6e04d219185690d3ce409c
libstagefright: Fix app crash during pcm offload playback

 -ANR is seen with trick mode operations during
  pcm offload playback.
 -If Player issues the read request to omx client while omx client is
  in pausing state, it moves the client to executing state if variable
  mPasued is true and it never returns from pause.
 -Do not set the variable mPaused to true while it is in pausing state.

Change-Id: Ib824f3a651f738be26df8906d7175eb59ce82fab
Merge remote-tracking branch 'cm/cm-11.0' into kk-4.4
Merge "stagefright: update support for omap3 decoders and encoders" into cm-11.0
libstagefright: mpeg2ts: Ignore continuity_counter discontinuity

The continuity counter is incremented for each ts packet. Any lost
packet results in a discontinuity, and the stock parser flushes the
current frame data leading to corruption if an I-frame is lost.
Avoid flushing on discontinuity to prevent some of this corruption.

CRs-Fixed: 663391

Change-Id: I683269dcb36a1424f6d9a6e543cf9e1ead0103a7
stagefright: Correct timescale in MvHd for HFR

Either timescale or duration must be modified to show the correct
HFR clip duration. Since duration is also queried by the record
timer, modify timescale instead.

CRs-Fixed: 662909
Change-Id: I6b744b4048b7a2d0bb70e2e3a102385a312bf81b
NuPlyer:RTSP: Fix some issues while seeking RTSP source

- Clear the obsolete packets after sending the seek request
- Stop rendering any obsolete frames while seeking
- Stop queueing any obsolete units to source while seeking
- Without this patch, the process-bar will return to
  the previous playback position, and stay at this position
  until the seek operation finish.
  Then, the process-bar will go to the seek position, and go
  forward according the playback of the clips.
- Without this patch, in some platform (based on Q6), seek
  operation will cause several green frame.

CRs-Fixed: 623269
Change-Id: I432de355d8e601a4d434cb78c699043dea2c6b55
NuPlayer: Add RTSP Server Timeout Setting to Meta Data

- Operator requires MoviePlayer to prompt dialog when the activity has been
  paused for longer than server timeout. This patch adds server timeout
  to meta data, so app can get the timeout value.

CRs-Fixed: 638087
Change-Id: I08f98e965497047c420d9d6ecc0b2898abe56369
libstagefright: Customize AV sync behavior

Based on the property, whenever video decoder takes more time
for decoding and causing few consecutive frame drops to maintain
the AV sync, then disable AV sync till it recovers.

This change will avoid freeze whenever any video clips out side
of the supported spec are being played though audio and video
are out of sync.
This improves user experience

Change-Id: Ia4ee899ff2515684259b88f66af216871a7bd38c
stagefright: Add a prefetching source

Add a prefetching source which pre-fetches buffers from
upstream source in a low priority context.
This decouples the caller of read() from the underlying source,
effectively making read() non-blocking as long as there are
already prefetched buffers available.

Change-Id: Ie5338c825dbdab9d88989059204594dc66bb2ac7
libstagefright: Render video frames on vsync

Render video frames on vsync, which helps to
synchronize display and decoder activity, and
reduces power consumption

CRs-Fixed: 649540
Change-Id: I0981d7723621de963d22f7fd7ca0eed48f016090