StageFright: Skip the TimeInterpolator FIRST_ROLLING state.

The TimeInterpolator's FIRST_ROLLING state was a scheme to start the
AudioPlayer's clock immediately.  For the length of the latency, it
would roll along using the system's monotonic clock.  The normal
TimeInterpolator algorithm kicked in after the latency had elapsed.
When the TimeInterpolator algorithm engaged, it would typically slow
down the clock for a short period (about .5 sec) until the clock
aligned with the start-up latency.  (The start-up latency is usually
not the same as the latency.)

The result is that the first 1-2 secs of video aren't synchronized as
well as the rest of the video.

This patch bypasses the FIRST_ROLLING state.  Suppose the video time
is at 0.  When the video starts rolling, m_pos0 is moved from 0 to
-latency/2.  For a while, the TimeInterpolator provides negative
timestamps.

In practice, good sync is typically achieved within 3-4 video frames.
This is partly due to using latency/2 as an estimate of the start-up
latency.

This is an intermediate patch.  The following patch will totally
remove the FIRST_ROLLING and FIRST_PAUSED states.

Change-Id: Iea3f3c15efa17e7f2df9418645b2c98f42abb167
Signed-off-by: Gabriel M. Beddingfield <gabrbedd@ti.com>
cmds/am: Adds support for subintents.

In some situation we need to send broacast message with subintent
inside. So add this feature. Parameters:
 EXTRA_KEY - key for subintent
 EXTRA_SUBINTENT_ACTION - action for subintent
 SUBINTENT_URI_DATA - subintent data in URI format
Example:
 adb shell am broadcast -a com.android.launcher.action.INSTALL_SHORTCUT \
   --es android.intent.extra.shortcut.NAME Example_Name \
   --es android.intent.extra.shortcut.ICON_RESOURCE \
     'com.ui.testapp:drawable/ic_launcher' \
   --ent android.intent.extra.shortcut.INTENT \
     action=android.intent.action.MAIN \
	 'launchFlags=0x14000000;component=com.ui.testapp/.TestAppActivity;'
(This example create shortcut for app 'com.ui.testapp' on home screen)

Change-Id: Icaf0851a7d240d8b2af6caea9f76b9fb26a7f401
Signed-off-by: Andrii Beregovenko <a.beregovenko@ti.com>
AVI extractor: Save fps information

Calculating fps (dwRate/dwScale) in .avi container and
saving it as kKeyVideoFPS for future reference.
This information was missing, hence VC1 60fps clips were
playing at 30fps, hence resulting in issues for 60fps.
Fix the same.

Change-Id: I5d1de853807f92c33ef976e97a2c83ad80184213
Signed-off-by: Anviksha Khare <anviksha@ti.com>
Libstagefright: Add reading of extended frame rates

Inorder to support 60fps and beyond, camera source
has to read the extended supported frame rates from
camerahal to validate against the app passed fps

Change-Id: I1bdb19dadfb755fcd749ee95840c1d47d28cb691
Signed-off-by: Sundar Raman <sunds@ti.com>
StageFright: TimeInterpolator: Completely remove FIRST_ROLLING and FIRST_PAUSED.

These states have been obsoleted by the previous patch.

Change-Id: I667a04e3d7c456014a35d8d24269a79c05e116cb
Signed-off-by: Gabriel M. Beddingfield <gabrbedd@ti.com>
StageFright: TimeInterpolator: Remove m_overruns

The idea behind m_overruns is that if they happen, then we can recover
by tweaking the value of m_latency in the TimeInterpolator formulas.
In reality, it usually made things worse.  Removing.

Change-Id: If31d6fa309218539acde4796f03daf0de2e9aea5
Signed-off-by: Gabriel M. Beddingfield <gabrbedd@ti.com>
StageFright: Do not seek TimeInterpolator to 0 on first buffer

If you open the media and immediately seek to some non-zero position
before you start to play, then this code will take you back to the 0
position when you start to play.  Removing the code.

Change-Id: If12d72271b8e37f1c5371611200ed029ab6a79fc
Signed-off-by: Gabriel M. Beddingfield <gabrbedd@ti.com>
StageFright: Make TimeInterpolator less verbose

Reduce the normal amount of log messages that the TimeInterpolator
reports.

Change-Id: If6865165bd53024c5936ecae702fca76bda817ce
Signed-off-by: Gabriel M. Beddingfield <gabrbedd@ti.com>
StageFright: Update mNumFramesPlayed regularly

This was disabled in a previous iteration of the TimeInterpolator.
It's value is ignored in the TimeInterpolator, but if it remains zero
it spams the logs.

Change-Id: I315cbc7d7242b3492288bb9d12c304abec833b8a
Signed-off-by: Gabriel M. Beddingfield <gabrbedd@ti.com>
StageFright: TimeInterpolator: Short circuit set_state() when not changing

Reduces log verbosity.

Change-Id: If745fa3b8b98686266b368e5df57e64970354c3f
Signed-off-by: Gabriel M. Beddingfield <gabrbedd@ti.com>
StageFright: TimeInterpolator: Do not give negative time-stamps.

This is required to pass
android.media.cts.MediaPlayerTest#testPlayAudio.  It prevents
AwesomePlayer from accurately predicting when the first frame should
be scheduled, but the negative effect only lasts for 2-3 frames.

Change-Id: I5bd79fc1dd1b74b951988b54163b0166764a5e64
Signed-off-by: Gabriel M. Beddingfield <gabrbedd@ti.com>