ExtendedCodec: update amrwb+ format parameters

- Add new API to update channel count and
  sample rate of Amrwb+ format.

CRs-Fixed: 631469

Change-Id: I46d2f219a13f3edf49ac0e7a8d098ca96bcd22a2
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
frameworks/av: Enhance logging for audio usecases

Add/Enable msg logging
-Start and End of playback
-To print file name
-Mode of playback and component used

Change-Id: I2c92d535ab76c9078af39b50fcfde4613f50a581
libstagefright: Print playback stats in suspend call

Print playback statistics in suspend call in AwesomePlayer,
as the video decoder is reset in this call, and playback
statistics are not printed in reset.

Change-Id: If3f74aba1b59cf001c6efa9f6175a6daec0d03d7
CRs-Fixed: 500977
libstagefright: Avoid MPEG4 DP fallback to software decoder for MSM8x10

-Avoid MPEG4 DP fallback to software decoder for MSM8x10
 Video playback needs to happen with QCOM HW decoder.

Change-Id: I255e1d1c5a6c2508711e4408de0d537e19732b0e
CRs-Fixed: 629449
ExtendedCodec: update amrwb+ component input/output ports

- updated sample rate and channel count of amrwb+ input
  and output configurations

Change-Id: I1a0412ed402e8d58f1db5422c904e18a51fb5965
CRs-Fixed: 631469
libstagefright: Get rtp port range and cache size from system properties

- Operators require setting rtp/rtcp network port range and cache size.
- Parse rtp network port range from persistent system property
  "persist.sys.media.rtp-ports".
- Get cache size from persistent system property
  "persist.sys.media.cache-params", in order to store the value.

Change-Id: Ie044682c422d71f018e509a89a19d976f313e27c
stagefright: Cleanup legacy stuff

Change-Id: Ic87e66939424a23ea589822b4d4e122296d5b20c
libstagefright: Add the conditions to ignore seek and allow sink stop

 -If app issues the multiple seek request to EOF position, player EOS
  gets delayed and app does not move to the next clip.
 -Seek interrupt the sink stop issued at EOF, hence delay in EOS.
 -Do not skip the sink stop if renderer position is EOF and ignore
  seek if seek time is same as player position.

Change-Id: Ic313eabfb738201b6b516555051a7a65c2bf8de2
CRs-Fixed: 667151
libstagefright: Fix for ANR in streaming during seek

In seek, OMXCodec sets state to FLUSHING and if it
gets EOS during seek then the state will remain in
FLUSHING state. OMXCodec stop will happen only in
ERROR, PAUSING and EXECUTING states. Hence solution
is to set mState to EXECUTING after flushing completed

CRs-Fixed: 664381

Change-Id: Ie6f65175ce66ea6973465b68d31e4f82354ea9a9
CameraService: Change order of client declaration and service lock.

Camera service lock has to be acquired after client declaration.
Otherwise, deadlock can occur when client destructor tries to
acquire service lock when its already acquired.

Change-Id: I21757325b3cbfdd5ca52c7becdfaa34ffa5bc768
libmediaplayerservice:Fix deadlock on gapless start failure

Issue:- Current gapless implementation starts the next clip when
MEDIA_PLAYBACK_COMPLETE event for the first clip is recieved
by MediaPlayerService.
-Even if start for next clip fails, application is notified with
MEDIA_INFO_STARTED_AS_NEXT.
- This causes the framework to trigger mediaplayer start which
again fails as it being for the same clip resulting in a deadlock
in the mediaplayer.
Fix:- Notify application with MEDIA_INFO_STARTED_AS_NEXT only when
start for the next clip is successful.

Change-Id: I77c570074c7c98c996122e275161ba88298e56fc
AwesomePlayer: post seek complete if seek cannot be handled

If the extractor says SEEK isn't supported, notify SEEK_COMPLETE
immediately.

Change-Id: I8b899c901b7eae3d6d437829a29672fc676c2560
CRs-Fixed: 630590
Improve MPEG4 track estimates, much more accurate at predicting final file size.

The algorithm improvements addressed the following:
- The stsz table was not collapsed to a single entry if all samples were the same
  size (apparently accidently removed in a previous submission).
- If the moov box exceeded the size of the preallocated space at the head of the
  file, it would be unused and needed to be accounted for.
- Added missing estimates for the variable sized audio/video/codec specific
  entries in the trak box.
- Added missing estimates for the fixed box overhead, allowing much tighter
  margins on the overall estimate, and thus more recording.
- Accurately calculates the size even if the file is streamable; this is
  necessary because applications such as MMS (as discovered in the linked issue
  below) which use larger file sizes have hard limits on what can be
  transferred.

Note that if new additions are made to the moov box, the estimation algorithm
should be updated appropriately now due to the lower margins.

https://bugzilla.mozilla.org/show_bug.cgi?id=987546

Change-Id: I727a37be94bc5f1d6fbc2c66777310a62dc8347c
Signed-off-by: Andrew Osmond <aosmond@mozilla.com>
Avoid CHECK due to malformed rtsp packets

Three CHECKs were removed in AMPEG4ElementaryAssembler and the
malformed packets are ignored instead.

Change-Id: I0e3e82c6ab32dca9cee9b64960fa36ffc46c0e33
Use DISALLOW_EVIL_CONSTRUCTORS instead of DISALLOW_IMPLICIT_CONSTRUCTORS

Change-Id: If2f3dcc29d7c3bd001ed49837e71ee4ffed899d3
libstagefright: add timeout to avoid blocking readAt function call

- this patch is to fix the corner case in the patch "Fix ANR issue
  in HTTP Streaming". The related change Id is
  Ief280b7e23727606746e1ca2bf4caa4a3044b7bc. In this corner case,
  onFetch is blocked on fetching data from network, and onRead on
  the same thread has no chance to be called. As the result, readAt
  is always waiting for the notification in onRead. It caused to
  block the other related function calls in AwesomePlayer.
- add the timeout in readAt function
- add the generation ID for checking whether onRead runs by the
  outdated message

Change-Id: Idb8942c6cff245c63e826792fffb46586a401a70
libstagefright: Keep LOOPING/AUTO_LOOPING flag during teardown

-LOOPING/AUTO_LOOPING flag is cleared during audio teardown process,
 then stream can only be played once which is not expected
-copy the previous looping flags and restore them after reset_l()
 is called

Change-Id: I4435d2b1d4d82efb235fc8099efa7d9f3d6af2d2
CRs-Fixed: 681711