Fixed sample video corrupted in MediaCodec mode.

Change-Id: I50c5660072d40f6e297e58fd026ea04c89d6a70a
related-to-bug: 6732061
Merge "Fixed sample video corrupted in MediaCodec mode." into jb-dev
merge in jb-mr0-release history after reset to jb-dev
StageFright: enable mp3 audio for mp4 container.

Enabling mp3 audio in mp4 container, which was not supported in HC.

Change-Id: Id5a9181a5e40827b1ff6f6a04c1317bdd387822f
Signed-off-by: Illia Ragozin <x0160199@ti.com>
Signed-off-by: Sergii Doroshenko <x0163979@ti.com>
MPEG4Extractor: adding parsing for .mp3 atom.

To support mp3 audio in mp4 container we must parse .mp3 atom.
It has the same structure as other audio atoms in stsd.

Change-Id: Ic0e8c5134a938709a06f477f4ee06b38b1a1e957
Signed-off-by: Illia Ragozin <x0160199@ti.com>
Signed-off-by: Sergii Doroshenko <x0163979@ti.com>
CameraService: Number of supported cameras increased

Number of supported cameras increased to 4

Change-Id: If4fda5f1f78e4514e2a2ab82cea5d5131ae3b4c5
Signed-off-by: Andriy Chepurnyy <x0155536@ti.com>
merge in jb-release history after reset to jb-dev
Media: Add support for Windows Media Audio/Video

This patch adds support for the ASF parser which is needed for playing
WMV and WMA clips.
This does not contain the parser itself but it makes the parser
runtime-discoverable.

Change-Id: I8598dc89b2726de0c2c0f030b222b4740782d238
Signed-off-by: Chris Kelly <c-kelly@ti.com>
Signed-off-by: Prasanna Kumar M.R. <x0118059@ti.com>
Signed-off-by: Devaraj Rangasamy <dev@ti.com>
Signed-off-by: Sergii Doroshenko <x0163979@ti.com>
Stagefright: Add AVI support

Enable AVI support.

Change-Id: I35f2175b47942c51327409d22384f13470c21945
Signed-off-by: Anviksha Khare <anviksha@ti.com>
Signed-off-by: Sergii Doroshenko <x0163979@ti.com>
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.

Change-Id: I329cce6e6ddae88f83052d63f7be0ef0a664b494
Signed-off-by: Santhosh Behara <santhosh.behara@ti.com>
Signed-off-by: Sergii Doroshenko <x0163979@ti.com>
Stagefright: Add H263 support for AVI container

Add H263 support to avi files.

Signed-off-by: Anviksha Khare <anviksha@ti.com>
Signed-off-by: Sergii Doroshenko <x0163979@ti.com>

Change-Id: I1495cd90d19c4547c3003e6a68e5ddd934f6950b
Merge "Media: Add support for Windows Media Audio/Video" into p-jb-release
Merge "Stagefright: Add AVI support" into p-jb-release
Merge changes I1495cd90,I329cce6e into p-jb-release

* changes:
  Stagefright: Add H263 support for AVI container
  Support for playback of WMV9,VC1 inside AVI file
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.
Cherry-pick from ICS.

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.

Cherry-pick from ICS.
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.
Porting from ICS to JB.

Change-Id: I7cfadb540291be0c5ec7fe13d0c42fb54c98ef50
Signed-off-by: Jyri Sarha <jsarha@ti.com>
AudioFlinger: AudioResamplerSpeex: Do not overwrite output buffer

I had a fundamental misunderstanding about AudioResampler-class's role
in AudioFlinger's mixer implementation. The output buffer provided to
the resample-method is a shared final output buffer and should not be
overwritten. Instead the resampled audio should be mixed on top of the
output buffer.
Cherry-pick from ICS.

Change-Id: I7d51fcae683437cd84f637b585bd2602ae4fb552
Signed-off-by: Jyri Sarha <jsarha@ti.com>
AudioFlinger: Prevent invalid free()'s in Speex resampler

AudioResamplerSpeex would sometimes call
provider->releaseBuffer(&mBuffer) if mBuffer.raw was not NULL.
However, this is an error because mBuffer.raw is never initialized.
If mBuffer.frameCount is zero, then mBuffer.raw is undefined and we
should NOT call releaseBuffer() on it.

Checking status of frameCount to resolve issue.

Change-Id: I5121f1358119336cb139d9692c4a1a135653cb00
Signed-off-by: Gabriel M. Beddingfield <gabrbedd@ti.com>
SF: Added correct handling for malformed mpeg2ts stream

Modified CHECK_EQ/CHECK_GE comparison (that contain exit 1;) to return ERROR_MALFORMED status.
Corrected size for skipping bits for BitReader in parseAdaptationField
Added check for correct processing ERROR_MALFORMED status in MPEG2TSExtractor.
Increased counter for parsed packets (using 10000 we can't get succes for VideoStream detection)
Because there are a lot of broken data in a beginning of stream.

Change-Id: Icd74774003da420e5305896b8398aee97296157a
Signed-off-by: Sergii Doroshenko <x0163979@ti.com>