MediaScanner: Ignore dirs with .noscanandnomtp

Completely ignore directories with .noscanandnomtp files
in them. Placing a .nomedia file will still scan a
directory but exclude it from the media database. This
is so the file may still be presented for MTP purposes.

Placing .noscanandnomtp completely prevents the scan,
which saves considerable processing power and battery
life on systems with numerous media files, but prevents
them from being seen over MTP.

Change-Id: Ibff2a9f2525255a2ac34132eeee36734962fbdd7
libmedia : Add a NULL pointer check

- Print frame count in AudioTrack::dump() only if the control
  block is valid
CRs-Fixed: 435050

Change-Id: I1c08bd5f65aa5a3e4899d1ed94b5bb77ad510118
framewroks/av:Fix ANR at the end of video recording

- While doing video recording, when the recording
  ends ANR observed while doing stress test for
  many hours
- When the recording is stopped, audio HAL receives error
  from driver and  audio HAL propagates this error to
  AudioFlinger.  But AudioFlinger  is not sending error
  status to audio source to stop recording.  Because of
  this audiorecord thread keeps on waiting for buffers
  which is resulting in ANR.
- To avoid indefinite wait, a timeout of 1 sec is set for buffer
  in audioSource and after timeout, -ETIMEDOUT is returned
  to recorder thread.

Change-Id: Ic191c63d2a0f0144eb6d5b53e5c6d7c8602f44ba
CRs-Fixed: 479968
libstagefright: Use 64 bit offsets only when needed.

For enabling >2GB recording, 64 bit offsets are
needed for file writing. So, this feature was turned
on by default. This in turn increased the file size.
With this change, by default this feature will be
off and turned on only when required.

- Use 64 bit offsets for resolutions >= 720p.
- Limit maximum file size for recording to 4GB.
- Set max file size only if no value is set from the client
CRs-Fixed: 273144, 285785, 288319, 328461

Change-Id: Ica37cb0414642c68ada18e0b7ba184b55692c6f2
libstagefright: Fix for crash in sound recorder during device switch

 -Crash seen in sound recorder during frequent insertion and removal
  of wired headset

 -During device switch some time Codec's input buffers are too small to
  accomodate buffer read from source. Omx codec doesn't read the fix size
  buffer from source, during device switch scenario sometime buffer read
  from source exceeds input buffer size so it goes in error state which
  leads to crash.

Change-Id: Ica3e5b1c1833077df522bb8f78fb05dd43a45f36
 -Increasing the input buffer size fix this issue
CRs-Fixed: 488449
media, audioflinger: check for divide by zero possibilities and err

When output stream is not available to audioflinger due to any reason
, sampleRate and frameCount have zero values when trying to create
new Audiotrack. This might result in divide by 0 situation.
CRs-Fixed: 478480

Change-Id: I1236452594f125cbd08ec434afdc540c0bb5ac76
libstagefright: Fix for FPS drop issue during A-V playback.

Issues:
-The AAC decoder was not updating the timestamp when EOS is reached.
-Logic to smoothen the real time update in AudioPlayer uses system
 time. This introduces corrupt timestamp during EOS.

Fix:
-Update the timestamp in AAC decoder when EOS is reached.
-Extrapolate realtime using system time in AudioPlayer when EOS is
 reached. Cap the value to realtime if  extrapolated time becomes greater
 than realtime.

CRs-Fixed: 384183 515066
Change-Id: Ice54501436431d2527fcd3d710d65d9732fcffdd
frameworks/av: init rc to avoid effect's fault state

Effect command doesn't necessarily fill cmd return code into &cmdStatus,
so we should initialize cmdStatus to avoid uninitialized value propagates
to upper stack caller.

Change-Id: I2a2985e3010f0d7b8aedf9244a6faabdf05740ac
CRs-Fixed: 517766
frameworks/av: AAC CSD support for MediaCodec path

- AudioFlush CTS test case is failing for AAC

- AAC Codec specific data is missing for
MediaCodec path for AAC if we use Qualcomm
ExtendedExtractor for demuxing

- Added CSD buffer while converting from
metadata to message , which can be used by
ACodec/MediaCodec

Change-Id: Ic8197138f5107f2a6026c28847e74987d91acc16
CRs-Fixed: 509575
Fix SoundPool.play() looping regression in 4.3 DO NOT MERGE

The change I7370d6e59a7ef26dfb284a8b058d5ab2e0a42ccf caused a regression
in SoundPool looping when using SoundPool's streaming implementation.
This reverts a portion of that change.

Bug: https://code.google.com/p/android/issues/detail?id=58113
Bug: 10171337
Change-Id: I8af0dc8683a7c7f225c80f0eb4d39770667b52e5