NuPlayer: Changes to support asynchronous read in DASH

-Removed Dash source stop call in reset as read is asynchronous in DASH.
-Removed the notifyRenderingPosition() API which is no longer needed
 for async read behavior.

CRs-Fixed: 345755
Change-Id: I23919bf4a776bd81e4e25c9b24af353ea3eff32c
(cherry picked from commit 1c8d6444c8df85a27f3ea1cf5b950af8243f1b3b)
NuPlayer: Signal time discontinuity during seek for DASH source

-When seek is issued, the renderer needs to reset its the values
of variables used to calculate AV sync.
-Set mTimeDiscontinuityPending to signal renderer about the seek.
-Also reset the mSyncQueues flag when an EOS is queued immediately
 after seek

CRs-Fixed: 340370
Change-Id: I90c16e5622d6263a273ccc53bee6f7ff891ccecb
(cherry picked from commit 8918ccf496a064017efa5ff8f4e259a1cc2d0cf4)
NuPlayer: Shutdown deocders during seek for DashLiveSource

Shutdown deocders during seek for DashLiveSource

Change-Id: I3530dc48a380e1e289f2d6ef1d22f0629a139c31
CRs-Fixed: 346380

Conflicts:

	media/libmediaplayerservice/nuplayer/NuPlayer.cpp
(cherry picked from commit 947d8e80943f4029faea02ad9b5482076197f036)
libstagefright: Enable suspension policy

-ADSP did not enter suspend state after audio playback.
-No support for suspension policy in stagefright.
-Enable suspension policy for the OMX component to
take care of the power collapse in stagefright.
-Merged the three gingerbread changes 50118, 62031
 and 89989 for this

Change-Id: I92f545d2684dddb9ef398c93b8c941a6c842a9f9
frameworks/base: Fix to prevent ANR during seek and pause

-While Streaming HD audio content over lowbandwidth server,
 After seek,the read()on parser gets blocked.So when we try to pause after seek,
 if the read()is not returned within 5sec, it results ANR
-Avoid calling OMXCodec::pause() from AudioPlayer
 which is not required in case of SW Decoders

CRs-Fied: 358143
(cherry picked from commit 31b301ec3a8e3e9ce77cdbf7777a1e961051d9fe)

Change-Id: Ie19ecc3650c6cb421b9dcc8e0ff5ec0f38493f11
libstagefright: Free all video decoder output buffers on an error

- OMXCodec calls dequeueBuffer on the NativeWindow in a loop
  and registers output buffers with the OMX component
- If a dequeueBuffer fails, the buffers already registered
  with the OMX component were not getting freed laeding
  to a memory leak.

Change-Id: I56abc7577b10e7540bdd6488708ae6830b9d907b
CRs-Fixed: 351388
(cherry picked from commit 0d4e06d9a53240e0e7aca05a64faea353babb029)
libstagefright: more accurate statistics logging

- statistics frames were only obtained after rendering, duration
  between frames vary a lot based on whether the frame closest to
  cutoff time is rendered or not
- fixes this problem by splitting the total frames calculation and
  fps calculation.
- fps calculation is now done onVideoEvent before anything else

CRs-Fixed: 334379
(cherry picked from commit 6fdc9466874617ed7b641183e7aa597f3faec5bf)

Change-Id: I6304bc04648f3dc7bee13c598ac1d82c116d97a4
libstagefright: Fix accuracy of average FPS in video playback

The average FPS calculated for video playback loses
accuracy due to the truncation of the fractional parts
of each FPS value calculated during playback.

A floating type variable is now used to avoid the loss
of the fractional part from each FPS value.

(cherry picked from commit 462d97c2ca534ad44071d09c1945234b3e2dbcce)

Change-Id: I66d64e3c8233c7513c477b4842bb2572b3a43994
CRs-Fixed: 331938
libstagefright: start collecting stats after first frame

- AwesomePlayer was collecting statistics starting from first read
  call to first frame, this puts first frame latency into
  statistics consideration which is not correct behavior
- Fixes this problem by waiting until first frame is read and then
  start collecting statistics on FPS
- Also improve precision by using double to store intermediate fps
  values and extending duration to 250000us

Crs-Fixed: 338656
(cherry picked from commit 8bc7cd5bbafa652dff3f835a69d717909705cf4f)

Change-Id: I541d30a4dce11a4ab46bb36f70086ce36a7f6748
libstagefright - fix fps calculations

- fixed bug on first frame time reset where time is reset
  not only on very first frame but every first frame flag
- take out first frame from stats to neglect audio start
  delay
- fixed total time calculations

Change-Id: Ic26f9cb69780d573f1125f4dc2dd0231a843ecac
CRs-Fixed: 345331
(cherry picked from commit 4c3eb6c486f22d8a6297c2828b146054db9cef68)
libstagefright: A particular MP3 clip does not play completely.

  --  MP3 frame gives a side info error.
  --  Modified decoder to recover even after side info error.
  --  The error frame is skipped and rest of the file is played.

CRs-Fixed: 327840
(cherry picked from commit e0fa87bf1672eacc4c76d9334bae1bcf5c906f2a)

Change-Id: Ife848b34315e723a7660559f94c2767f6506eefe
libstagefright: Disconnect connecting datasource in reset

- MediaSource Read is a blocking call, and it can stall
  the complete player if it takes longer. There are chances of
  seeing a ANR in streaming scenarios.
- This change will ensure that read call does not block, by
  disconnecting datasource

Change-Id: I905384fbd5ca845ab7a6bf5c6ec30cc396fc5aba
CRs-Fixed: 358143
libstagefright:FIRST_FRAME is set with audioEOS event

As audioEOS event is posted, timesource is changed from audio clock to
system timesource.Because of the difference in two timeclock,it assumes it
to be late/early and leads to seek.
By setting the FIRST_FRAME with audioEOS event,the timesource difference is
taken into account while lateness calculation.

CRs-Fixed: 335557

(cherry picked from commit 7c75a90eca414b7424d1b1fc2bb55642dd46c317)

Change-Id: I504eac51d42bf78e42fdd453d8d5068ea7d81ca5
libstagefright: Add support to seek to zero for aac adif clips

-Seeking to zero not working for aac adif audio clips.
-Enabled seekTo zero for aac adif audio clips.
-Clear the temporary buffer holding the partial frames.
 Add CAN_SEEK_TO_ZERO flag in MediaExtractor to allow
 seek only if seek time is zero.

CRs-Fixed: 324073
(cherry picked from commit 3c040ebfaffbd5470bccf4f25dbf664ead9e728c)

Change-Id: I0658c4a535b7abedc1899b397e7a27947791fe1b