httplive: Buffer size & bandwidth switch enhancements for fetchFile

- Adds size estimation for chunked ts files so that buffer sizes are
  more accurate and fewer calls to memcpy are needed
- Fixes case where even files with size returned by the server caused
  a memcpy
- Increases minimum buffer increment and allows exponential buffer
  growth by a factor of 50% to reduce memcpy calls
- Splits the readAt call in fetchFile so that the bandwidth can be
  checked during download
- Adapts the incremental buffer read size to the current network
  conditions
- Returns a notification that triggers the download of a lower
  quality file if the bandwidth drops by enough. Will only begin
  downloading a lower quality file if it will save time and thus
  minimize any apparent media freeze while buffering.

(cherry picked from commit 3298013f4aedfb0729069debfdeed2f8531fb710)

Change-Id: I7fc514e4689fb466cd40cc490df8f8c3da009494
CRs-Fixed: 329809
frameworks/base/httplive: Update meta data after seek

- Add a API in AnotherPacketSource to update meta data
- Update meta data in ATSParser & AnotherPacketSource after seek
- Add a new discontinity type for HLS seek, and set it for seek
- Separate seek changes in NuPlayer specific to HTTP Live
- In LiveSession when a playlist sequence number is not found
  after moving to new playlist start with first sequence number
  instead of last.

CRs-Fixed: 337549

Change-Id: I7dedec3664d2bb8a78e16f0df944feaf22bb32a6
(cherry picked from commit aabe7bcdf9276b00e47af81e00a5ce9f178b9463)
libstagefright: Support for seek in MPEGTS Extractor

- TS clip duration is calculated as difference between first & last PTS
  per stream.
- Seek is performed by searching for seek PTS and adjusting the
  file offset accordingly. SEEK_TO_NEXT_SYNC is only supported.
- New APIs AnotherPacketSource -
  getStreamInfo - elementary stream PID, program PID, first PTS
  nextFrameIsSync - Check if a accessunit is reference frame, this
  is based on a flag set by ATS Parser.
- New APIs in ATSParser - ParseToGetPID, ParseToGetPTS
- MPEG TS Sniff confidence is increased to 0.6

CRs-Fixed: 338373
(cherry picked from commit d410c12c606985f8de8f037b132d6ba2533278d1)

Change-Id: Idc9af1b700245a82686467bcabb4b2066c20e17b
MPEG2TS: Restrict direct access to parser from source

- After multiple seek (fw\bw) some crash is seen in ATS parser
- Issue is multiple sources (A\V) are accessing same parser data
  from different thread without protecting the parser data and
  hence some crash is seen.
- Now all the call to parser from source will be routed through
  extractor and extractor will provide public function for the same
  which will have lock protection so that only one thread can
  access parser at any point of time.
  Also disable seek on TS clips by default.

CRs-Fixed: 340763

(cherry picked from commit c25a3ed56f82163bf130cc349228e8bc22afc183)

Change-Id: If9d9a0f30358042751a866d778477eb694df25d1
libstagefright: Fixes in MPEG2TSExtractor seek

- Separate seek discontinuity for TS and HLS
- Do not flush meta data for TS player seek
- Remove redundant logs in ATSParser new parse PTS code

CRs-Fixed: 342001,340399

(cherry picked from commit 42fbf440209eafe7616cc5eda40bc0f89682e2c0)

Change-Id: I09615395b93c8d7c60acb58e146e6991cad8c15f
TS_Seek: Fix hard exit case when bad TS packet is found

- Some TS clips with bad TS packet at end doesn't play at all and
  crash happens in ATS parser.
- There is hard check, which crashes the thread if packet fetch to
  ATS parser is not TS packet.
- Replace hard exit with graceful exit, return with error code
  that is handled (exit or continue) at the extractor level.

CRs-Fixed: 340773
(cherry picked from commit 23779e075831422758295758a51c836e9fe5376b)

Change-Id: Ifa9f1e758c72b72398da4a133aacfc0791463564