Video Encoder : Support Setting of H264 Encoder profile through system property

This patch supports setting of Different Encoder Profiles for H264 Encoder.
This can be done by setting the property: video.h264enc.profile to
1 - BASE PROFILE , 2 - MAIN PROFILE and 8 - HIGH PROFILE
Invalid setting will result to using BASE PROFILE as default.
Patch set#2 : Addressed review comments.

Change-Id: I2352ff715adba495f6e1365da8de326bbc6ef2c1
Signed-off-by: Sathya Prakash M R <a0393677@ti.com>
Video Encoder: Remove Hard coding of H264 Encoder Profile

This patch removes hard coding of baseline profile.
Now using system properties we can set Encoder profile.
Signed-off-by: Sathya Prakash M R <a0393677@ti.com>
Signed-off-by: Vicky Martinez-DeFrain <a0869710@ti.com>
Change-Id: I9fc61016843b5d9e91d6f068a1c7838a67a0b1cc
Support for playback of WMV9,VC1 inside AVI file

Added support for playback of WMV9 and VC1 Streams inside AVI file.
The changes include parsing of codec config header which is present
as part of stream format header inside AVI file.
Also, incase of VC1 stream the encoded data should be prefexed with
the start code 0x0000010d. The first frame should include codec
config header in the begining then data start code followed by data.

Review comments are incorporated.

Change-Id: Ie869d520a51e140f18a332a2e2be4ab7a7889f01
Signed-off-by: Santhosh Behara <santhosh.behara@ti.com>
TimeLapse recording with High Profile Encoder

When Timelapse recording is performed, Encoder is expected
to process each input buffer and provide a output buffer.
This wont work when we have B Frames enabled.
This patch disables B Frames when Encoder flag
kOnlySubmitOneInputBufferAtOneTime is set to allow
submission of 1 frame at a time.

Patch set#4: Added the check to cover all encoders.
Updated commit message and comments in code to be in sync
with the patch submitted to google.

Change-Id: I7dd17f8ce9185abe3c6749caa34c90500bd2f913
Signed-off-by: Sathya Prakash M R <a0393677@ti.com>

Conflicts:

	media/libstagefright/OMXCodec.cpp
Add CAMERA_MSG_RAW_BURST handling to CameraService

Change-Id: Id958836e726e9908f60311d5bfc6d26eb8298cea
Signed-off-by: Vladimir Petrov <vppetrov@mm-sol.com>
AudioSource: Fix to increment audio buffer timestamp based on mono/stereo channels.

Description: AudioSource was not incrementing the audio buffer
timestamp properly in case of stereo. This commit fixes this issue.
The formula is also simplified for readability

Change-Id: Ib5c942906433930b768aa9c4426a549cf203ea5f
Signed-off-by: Manoj Gopalakrishnan <manojgopal@ti.com>
AwesomePlayer always reads the forward syncable video data after SEEK.

By the patch#19882(http://review.omapzoom.org/#/c/19882/), the SEEK_COMPLETE
event happens after mVideoTimeUs reaches to the seek position.
This means that video frames continue to come from the "old" video position,
and only after MEDIA_SEEK_COMPLETE signal is sent, video frames come from
the new position. So, if the new position is the backward of the seek position,
it is sometimes confusing because the video player seems to ignore (briefly)
the user's input.
With the patch, the new position is always forward of the seek position, and
MEDIA_SEEK_COMPLETE signal is sent immediately. So, video frame from
the new position will be displayed immediately, too.
This gives the user positive visual feedback that their input has been accepted.

Change-Id: I72327ba08f060a5b474584c6084875ec02afebca
Signed-off-by: Nanako Baba <baba@ti.com>
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>
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>
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>
AudioFlinger: Add resampler using Speex library

In addition to earlier quality settings there is a new setting, which
uses libspeexresampler from external/speex directory. The output
quality with SPEEX_QUALITY is better than with HIGH_QUALITY
setting due to a proper anti-aliasing filter.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
Change-Id: I64aef1fbf3f0802d9f1948328b9864c603c878a0
AudioFlinger: Use AudioResampler::SPEEX_QUALITY by default

The bad audio resampling in AudioFlinger ruins the audio quality of
all media that does not have 44.1kHz sample-rate. Most video files
have 48kHz sample-rate audio track and this change improves playback
audio quality of those files.

Downside of this change is increased MPU usage when playing audio with
something else than 44.1kHz sample-rate. On OMAP 4430 the over all
load increase in comparison to linear interpolation resampler is
around 1-1.5 MHz of a single ARM A9 core, when playing 48 kHz
sample-rate stereo wav file.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
Change-Id: I7a54c281279e74b8f9e8615056c4a193d6e0f203
AudioFlinger: Move sample-rate conversion check to resampler class

This patch moves the resampling ratio checks to AudioResampler
class. With this patch it is possible to exploit Speex resampler's
flexibility of selecting any resampling ratio.

Change-Id: I7cfadb540291be0c5ec7fe13d0c42fb54c98ef50
Signed-off-by: Jyri Sarha <jsarha@ti.com>
WiredAccessoryObserver: report HDMI channel count when plugged

The system property for the hdmi sink channel count info needs to be updated
each time a new sink is plugged or removed.

Change-Id: I130e5208e94d1f9af928b95af8e263def0778127
Signed-off-by: Chris Kelly <c-kelly@ti.com>