Introduce AUDIO_LEGACY_HACK to extend support for legacy devices

this is a dirty hack but does what it should.

if we build for legacy device, eg LG Optimus Black P970, we have to use
the ICS_AUDIO_BLOBS flag to get audio.

but if we add it, we get build breakages and if we remove it, we dont have
audio at all.

this hack allows us to set the AUDIO_LEGACY_HACK flag in the BoardConfig and
prevents build breakages.

as i am unsure if every device needs that, i couldnt wrap it around the
ICS_AUDIO_BLOBS flag, thus this new flag is added.

Change-Id: Id545a684fcdc0508f4135eb7a722a9b617595532
Introduce CAMERA_LEGACY_HACK to extend support for legacy devices

same typo of patch like AUDIO_LEGACY_HACK
fixes build breakage on p970 with the following flags set
-DICS_CAMERA_BLOB -DOMAP_ICS_CAMERA

if we remove these flags, it builds fine but we have no camera as well

Change-Id: Ie91a5059153ace383d8f2a7f1539cb77861dce05
screenrecord: Add audio support

Adds audio recording to the screenrecord system. Note that
while recording, the audio is muted from the device output,
and that the audio volume is controlled separately (so make
sure to turn up your volume if you hear nothing).
Audio from the microphone can also be recorded by adding
--microphone to the command line.

Change-Id: I97dfcaf3d93b786c5466e1f4215549e3d015bcf0
screenrecord: Enable SUBMIX_IN as well and cleanup on exit

While on Nexus 5/Nexus 7 (AOSP QCOM audio), trying to turn on
SUBMIX_IN fails and is not needed, it is required on Find 5
and N1 (CAF QCOM audio), or otherwise SUBMIX_OUT won't turn
on.
We also now release the audio routing as it wouldn't revive
the audio speakers otherwise.

Change-Id: I0f80a232304733e0b0a834b188b8cfa5b88915f3
[2/3] av: Audio Themes Support

On the Java side, Android has support for both a
Video Record Start sound, and a different Video
Record Stop sound. However, this part here only
supports one video recording sound.
We added support for RECORDING_STOP sound (by default,
the same as RECORDING).

Change-Id: Iaebddd8ebf8b21633e802589a4a6175492df8f29
CameraService: deadlock fix

Release lock before return from CameraService::dump()

Change-Id: Ia20b0921fc675a284f3b7f8d26e0e3596b5a8774
Signed-off-by: Kalle Lampila <kallex.lampila@intel.com>
Revert "[2/3] av: Audio Themes Support"

This reverts commit f734e40ca8ed1351cbf1781fde7db646fdbf85d7.
LiveSession: check bandwidth in 10s interval to support adaptive stream switch

schedule another check bandwidth event when previous bandwidth check event responds.
so that HLS will realize adaptive stream switch when network bandwidh change.

the bug exists in kitkat 4.4.2, brough by AOSP upgrade and it will impact HLS
bandwidth switch feature

Steps to reproduce:
 1. connect phone /tablet to wifi, adjust router to set initial wifi bandwidth to low bandwidth
 2. lauch browser to access http live streaming server and start playback on full screen (there're three TS streaming for 900kbps/300kbps/100kbps bandwidth)
 3. During playing streaming, change network bandwidth to be high,such as 1000kbps

expected result: streaming switches to high quality
actual result: streaming does not switch to high quality

Change-Id: Ib662952ee0fa1574d17d81a3e15cbbc74b47ff1d
Signed-off-by: ywan171 <yi.a.wang@intel.com>
HLS: fix video pause/resume button not work after replay hls on HTML5 full screen

when replay HLS in HTML5 full screen mode, video starts in NuPlayer with RUNNING state,
the EOS flag is not clear, which will cause the mediaplayer finds the mismatch internal/external
state when app calls MediaPlayer::isPlaying.

step:
 1.playing HLS streaming in Browser
 2.click play.
 3.click full button into full screen.
 4.wait video playback finished.
 5.click play button to replay this video.
 6.then click pause button to pause video.

result: 1.can't pause video during playing this streaming.
        2.The statue of progress bar is pause. but audio is playing.
Change-Id: I65d78d31560a86526649053cc824e0df461f0879
Signed-off-by: Gu, Wangyi <wangyi.gu@intel.com>
Signed-off-by: ywan171 <yi.a.wang@intel.com>
libmediaplayerservice: fix hls can not pause/play issue in HTML5 fullscreen mode

fix hls can not pause/play issue in HTML5 fullscreen mode which is introduced in Android 4.3

Change-Id: I165e561a01faee95b3db599f13c397122b359dcd
Signed-off-by: ywan171 <yi.a.wang@intel.com>
Signed-off-by: Jian Luo <jian.luo@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Author-tracking-BZ: 107204
stagefright: update OMAP3 h264 codec data construction

Changes are based on gingerbread branch and they help improve
video stuttering on OMAP3.

Change-Id: Ic886a4c555c2a7a41204e7a18f38560744b782f6
stagefright: include nAllocLen parameter with OMX Buffer

Few OMAP3 codecs require setting the nAllocLen parameter inorder
to allocate memory.

Change-Id: Iff9b4b55f706c5bdd8db5ebd49d20b79b103b352
Revert "stagefright: include nAllocLen parameter with OMX Buffer"

This reverts commit a8a97f3a0642e855ddbacda6c4a7243730fe2784.

Unlike on Gingerbread, we are using Metadata to allocate Gralloc Buffers with ION. Hence there is no need to explicitly override the nAllocLen parameter since we are dealing with Gralloc Pointers and not actual data.

Change-Id: I0d86f3933e652c21af41f08a19d0e14bced90fbe
stagefright: ifdef "libstagefright: Use proper ctts offset"

Causes A/V sync issues or corrupted recordings on NON-QCOM hardware

Change-Id: I8c8625c41936c3ecc9a70f82ddc17e6e66503fd3
av: tegra legacy support

Change-Id: I29bcbb809fa86fbb093fd575ccb85ba96ac08dd2
Revert "Revert "[2/3] av: Audio Themes Support""

This reverts commit 30569288f2fe8b393173d6292ba3f69a2ac29e08.

Change-Id: Icfc8bfaca58dcc6d9618bb0d46465c6fb306cf92
Dont play Media sounds if persist.sys.camera-sound = true

Change-Id: I57765cf9fe9e0179ce8baa3276213255f372d206
libstagefright: Fix video encoder input buffer

Ported from cm10, needed to avoid the encoder eating up all input buffers,
which leaves no buffer left for the camera sometimes

Change-Id: I0432cd87a9defd08725ac8831d7376edb98d7e18
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