stagefright: Flip encode dimensions for pre-rotated camera buffers

Camera indicates pre-rotation via "video-rotation" parameter.
If the rotation angle is 90 or 270, flip height and width
set on encoder to interpret the image correctly.

CRs-Fixed: 672804
Change-Id: Ie52e77c886410304d8a65bc34990623e881ca408
libstagefright: Use 3gp4 ftyp box when AMR audio is present

mp42 boxes do not support the 'damr' box type whereas 3gp4 boxes
explicitly support it. Using mp42 makes clips with AMR incompliant
with mpeg4 standards and unplayable by many media players. To
ensure interoperability, use a 3gp4 box if the recorded clip
contains AMR audio.

CRs-Fixed: 721883
Change-Id: I75e3558cd5088d05d36104abfb04a3c0c1d1a4e7
libstagefright: Handle MPEG4 DP playback

Since the HW decoder doesn't support MPEG4 DP clips, detect DP
format clips in the parser and report a new MIME:
video/mpeg4-esdp. This MIME is only registered to the SW
decoder which supports DP clips.

Merges the following change from kitkat:
libstagefright: Fix DP Parsing issue with mpeg4 SP,ASP
(Change-Id: I69c719011e1a0d2a0b0ae5a9b504b7cce443866b)

CRs-Fixed: 722066
Change-Id: I7bc3a7a9f4a6d37e046ed9c8008cb27fb3bc665d
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
stagefright: fix-up logging in ACodec

Also print the component name; which is sniffed by
automation scripts to confirm the decoder being used.

Change-Id: Ic5c4f6940cf4608d676959d47156b7bb76f777c0
CRs-Fixed: 720396
mediaserver: conditionally launch ListenService

Conditionally instantiate ListenService from MediaService.
ListenServiceruns as a singleton in its own thread that calls
AudioHAL which in turn accesses Listen Driver. It is the entry
point from Application processes that want so execute Listen
commands and receive Voice detection events. It manages Listen
application resources and global states across all Listen
applications.

ListenService is similar to AudioFlinger. That is why it is
instantiated from MediaServer. Listenservice talks to AudioHAL
to deal with concurrent usage of mic.

Change-Id: I71c346bb16e0ed3a7aae9c908e03c7f1c694fe0a
frameworks/av: fix format for 24 bit offload playback

-Set format for 24 bit offload playback
-Add flac codec specific params in offload metadata

Conflicts:
	media/libstagefright/AudioPlayer.cpp

Change-Id: I3ec2bc0d410ef58ab5e9a929cd25ab7966ed165d
audio_policy: Null check for output profile types

- Currently invalidated Deep buffer and offload
tracks are not suspended/closed.
- BT output is not setting profile type. While initiating voice
call, APM closes all opened outputs to fall back to ULL, based
on profile types
- Modify the check to ensure that valid OutputDesc are
suspended/closed.

Change-Id: I6abc2e28c93a6de9922a8ac7b2a81a477b3ea566
frameworks/av: Disable multichannel FLAC and AAC subformat on Offload

-Currently, check for disabling AAC and its subformat disables
Offload on every other format which has xxxxx1xx in the most
significant byte of the mask. By comparing this result to original
AAC mask, we can ensure that only AAC and its subformat passes.
-Disable FLAC multi-channel playback on offload.

Change-Id: I0bfa829ea839b19dc4c6051b020397a1a8749c12
frameworks/av: Fix format for 8_24 bit pcm

Set format to AUDIO_FORMAT_PCM_8_24_BIT only when
audio.offload.pcm.enable is enabled, bit width is 24 and
mOffloadAudio is true.

Change-Id: I6b36c7f2d3339de068723aa65bda419917defcb7
CRs-Fixed: 734800
NuPlayer: audio playback enhancement for NuPlayer

- Add playback support for EVRC, QCELP, AMRWB+,
  and WMA formats in NuPlayer...

Change-Id: I2beacb0d3081b9e83410fee3a8400fc6150af0ce
audioflinger: Compile 192k resampler for 32 bit environment

Current makefile compiles the resampler only for 64 bit environment.
Allow compilation for 32 bit environment as well.

CRs-Fixed: 735776
Change-Id: I626725551af73fc5ea98a7dbf87cacea9dbbc0ef
rtsp: Add support for rtsp over IPV6

Added missing functionality needed in order to
support RTSP streaming over IPv6 also.

Change-Id: If825664cd2237addd60a45e915061472fb1698d2
NuPlayer: Add support for non-streaming offload playback.

- Introduce mIsStreaming to identify non-streaming use case
  when setDataSourceAsync is called with valid fd.
- Call canOffloadStream with mIsStreaming instead of TRUE to
  support non-steaming compress offload playback.

Change-Id: Iecc0def40006c2c0884be6ea673185cce9883bb1
Conflicts:
media/libmediaplayerservice/nuplayer/NuPlayer.cpp
media/libmediaplayerservice/nuplayer/NuPlayer.h
libstagefright: Release mLock before TimedEventQueue stop

During suspend call, mQueue.Stop() gets blocked for onVideoEvent()
to complete, which in turn tries to acquire the mLock held
by suspend(). Thus, it leads to deadlock.

Changes are done to release the lock before calling mQueue.Stop()
and acquire the lock once stop is finished.

Change-Id: Iadb14299bbdd0ae7e80baffc273a910c8d6ff9bb
CRs-Fixed: 730002
stagefright: Cancel audioCheck event when setting nativewindow

In html5 playback, setNativeWindow_l() will be called twice
when switching from landscape to portrait mode. If the 2nd
setNativeWindow_l gets the LOCK before proceeding mCheckAudioStatusEvent
posted in the 1st setNativeWindow_l, it will get the infomation
that seeking is completed and won't do seeking in this run.

CRs-fixed: 624469
Change-Id: Ia5c4e373e8a71b907b15b913085600d9481ef982
stagefright: check for HEVC for single track usecase

absence of this check will not add sample length before sample and
video only HEVC clip will fail to play.

Change-Id: Iac67e92483e8b32652150d54d1ae2da57c779c6f
libstagefright: Add support for HW AAC decoder

- Add support for HW AAC decoder by including it in the
  list of available decoders and use it for decoding only
  if property 'media.aaccodectype' is set

Change-Id: I36c9ad178f6c9fd164e617af0fdec01d3e9656f2
libstagefright: add NULL pointer check before free in FLACDecoder

- Check for NULL pointer before free in FLACDecoder::stop

Change-Id: I9ad387c7e9fec81fe208eca9938b721c52fb363e
audio: add support for VoIP & playback record concurrency

- Add support for VoIP & playback record concurrency when
  "rec.playback.conc.disabled" property is set to true

- Add support for compress to deep buffer fallback when
  record / VoIP session is active

- Add support for force device switch(to select new acdb config)
  for VoIP & record playback concurrency

Change-Id: Ia93a51f0d0d2cfdd447d73ce65bfc07965190ab4