libstagefright: Set is_streaming flag for all widevine content

- For widevine clips played from sdcard get the file type
  from extractor's meta data.
- By setting is_streaming flag 2k buffer size will be used
  for audio offload.

CRs-Fixed: 615323

Change-Id: Ic54a642aa70c3355583807eb4ca2034e4207dfd4
Revert "Audio: Add Pause/Resume in AMR-WB tunnel recording"

This reverts commit e51f3b1dd8b8b2668af3c467a330b18714d29966.

There's no mSource->stop() in MPEG4Writer::Track::pause(),
so no need to add this limitation here.

CRs-Fixed: 620437

Change-Id: I7b7134e2f58083b7dd9cfb3c0943d703ba228ecb
AudioTrack: Handle track invalidate on wait for stream done

If a track invalidate is called while waiting for a stream done,
AudioCallback handler is notified with event EVENT_STREAM_END.
This might cause substantial data loss for offload playback. Try to
recreate the track if needed.

Change-Id: Ie663c85e92588ddfd8d633f4bf5024f9fa4f5c2e
libstagefright: Add support for AC3/EC3 playback in tunnel mode

- Add support for AC3 and EC3 playback in tunnel mode

Change-Id: If5de26d3ff9e63737d6ed43b904c6094f93fbfc0
libstagefright: Enable HFR feature for video recording

- Enable HFR related calls to set HFR mode in stagefright and
  libmediaplayerservice
- Perform HFR scaling with mp4 timescale parameter instead of
  recalculating timestamps

Change-Id: Ie30637093d91ed7f5a41c5137c3ff45e1370a906

libstagefright: HSR: Check if HSR enabled, use HFR value for HSR

- HSR is high speed recording hint from camera app, if this is set
  use frame rate set in HFR as normal encoder frame rate.
- HSR hint also indicates that this is not HFR feature and treat
  this encoding as normal encoding

Change-Id: Ifff59cd8ed88efca230fd34e46325a11728e8c86

libmedia: Adding HFR entry in MediaProfiles.cpp

-- Adding HFR entries for max HFR mode, max HFR width & max HFR height
   in MediaProfiles.cpp

CRs-Fixed: 589983
Change-Id: Iafcc1be4124879a029a2e4b8aded35150d0c120b

libstagefright: Use hw encoder for video recording

Use hw encoder for video recording based on the platform.

CRs-Fixed: 576174
Change-Id: I5d14d2fabb8d39fe940fa25c88b90252bfd07bc0

libstagefright: Fixed typo in target name

Target name was wrong which was causing this flag to be not set thereby
software codecs were also being used

Change-Id: I3f3a0de4eda0fef2f2f26579645a4a06a1ecddaf
CRs-Fixed: 582977

stagefright: Correct total duration of HFR clips

HFR leverages the mp4 track timescale parameter which is not
considered when calculating total clip duration. This makes tracks
report the correct duration so that total clip duration is computed
correctly.

Change-Id: I8ff556913317eea15030f9f6920cefa560133872

libstagefright: Cleanup HFR cruft

Change-Id: I67d43cd2e14f33e2915afd61b590c32d7c97a9c6
stagefright: Enable GraphicBuffer usage to decoder before querying formats

This lets the decoder publish appropriate color format based on surface
OR non-surface mode.

Change-Id: I567ae53d4d0dfa2abbf29e8196637a1da3e89969
stagefright: Disable HSR for now

 * Depends on updated media repo, we're not quite ready.

Change-Id: I76e6577e771de09617a8831e7fe3d1d525ee8fd8
media_profiles: the HFR parameters don't need to be mandatory

Change-Id: I5e2d32f3be31f2ef82c314088d032105e6c8a5f8
libstagefright: Add NULL check for mHFRRatio

Commit 12fa017cb "libstagefright: Enable HFR feature for video recording"
is not yet fully implemented. Camera recording will fail because timeScale
is not calculated properly. Add a simple NULL check to fix.

Change-Id: Ieea78efb43645f57615309a91508092433bc34b3
ifdef "stagefright: Enable GraphicBuffer usage to decoder before querying formats"

Breaks video playback on galaxysmtd

I/OMXCodec(  151): [OMX.SEC.AVC.Decoder] AVC profile = 66 (Baseline), level = 30
I/OMXCodec(  151): [OMX.SEC.AVC.Decoder] video dimensions are 640 x 352
W/GraphicBufferAllocator(  148): alloc(640, 352, 19, 00002930, ...) failed -22 (Invalid argument)
E/        (  148): GraphicBufferAlloc::createGraphicBuffer(w=640, h=352) failed (Invalid argument), handle=0x0
E/BufferQueue(  148): [SurfaceView] dequeueBuffer: SurfaceComposer::createGraphicBuffer failed
E/OMXCodec(  151): dequeueBuffer failed: Invalid argument (22)
E/OMXCodec(  151): [OMX.SEC.AVC.Decoder] Allocate Buffer failed - error = -22
E/AwesomePlayer(  151): failed to start video source
E/MediaPlayer( 2023): error (1, -22)
E/MediaPlayer( 2023): Error (1,-22)
D/VideoView( 2023): Error: 1,-22

Change-Id: I9977dcf9fc50936038808ed06bcd85b07efd7bd8
audio: Added lock during closing of direct output

- Lock is missing when direct output is closed in
  closeOutput_nonvirtual. As mDirectAudioTracks is
  being modified in this function, we need a lock
  here to avoid synchronization issues when it is
  accessed from other methods in AudioFlinger
- Fix is protect direct audio track specific block
  with mLock

Change-Id: I88f489c3bbe21ecb198bd836c05b0bfa5826d3c6
CRs-fixed: 611654
libstagefright: bring back mistakenly removed codec quirks

http://review.cyanogenmod.org/#/c/59396/ has mistakenly removed
3 of the codec quirks that are required for certain audio codecs
on OMAP3.

https://github.com/CyanogenMod/android_device_lge_p970/blob/cm-10.1/configs/media_codecs.xml#L28

The implementation of the quirks are still in the upstream code
and they have nothing to do with Legacy HTC.

Change-Id: I2d47bc9cbb451675c5bac6e725c59b367ff458dc
libstagefright: Set initial buffer size for H264 codec

For Google h264 decoder, the input port buffer size is
set to 8192 bytes, and for usecases where data source
does not specify input buffer size, there is a crash on
assert when the buffer size is larger than 8192 bytes.

Added change to set input buffer size for H264 to 80k.

Change-Id: I5bc177cc5078b2acfc930ee2746960dc26ab9662
stagefright: OMXCodec: free allocated port-buffers if init fails

If an error is encountered while allocating port buffers, init
would fail and buffers already allocated would not be freed.
Move OMXCodec to ERROR state and explicitly stop omx component,
hence forcing free-ing up of allocated buffers.
Also defer setting port-status to ENABLED only after having
moved the component to IDLE and add graphicBuffer to port-
buffers-list only if setBuffer is successful.

Change-Id: I54ffb2a299376bf1716473e94948c36648d24b92
CRs-Fixed: 610702
NuPlayer: Fix parsing RTSP play response from special server

- In some non-standard server, a different play response will be returned,
  which will cause CHECK failure
- Change in parsePlayResponse(), to get the current track index

Change-Id: I467e3000732cf1506095b17dc29eed25e6701150
CRs-Fixed: 621854
stagefright: Omit audio from timelapse recording use-case

Timelapse recording is only valid for video encoding, but audio
is subjected to the same infinite wait. This can result in an ANR
if encoded data is not being produced. Only wait forever in video
use cases.

Change-Id: I37d34c2235d110dc8954b66d830891fdccc50c0c
Camera: Remove merge artifact

Change-Id: I5817d9f2a9410ef6ba4f5f0242406b410afbf0be
Camera: Avoid redefinition of ISO params

Change-Id: I5f283f6d3affb35ef6a24f00fdaac0ca8aa348ba
Merge remote-tracking branch 'cm/cm-11.0' into HEAD

Conflicts:
	media/libstagefright/OMXCodec.cpp

Change-Id: Ic372b239c0959aa6e2f653f4135afb3254e230c9