audioflinger: check for condition before waiting

AsyncCallbackThread must check for any condition that
was already been satisfied before waiting.

CRs-Fixed: 581978
Change-Id: I7a37c03cddcf7fdaa61c826d71a4d527979ce9e1
libstagefright: Delay release of wakelock

Delay release of wakelock till the last event
in the event queue of TimedEventQueue has been processed.
This ensures AP shutdown does not happen while an event
is ready but hasn't been processed yet.

CRs-Fixed: 583053
Change-Id: I597c0b9887b02b070c708401e5f3c40a0a2289d0
Revert "frameworks/av: rendering statistics for Stagefright."

This reverts commit 1a65f74eebe15e1533ebde98268a454a8b14f815.

Change-Id: I755e293705a72d90a4a855343439b625226c050b

Revert "libstagefright: adjust AV sync late margin based on property"

This reverts commit 14b0bb438a8b3291edd10fb068656e707a31cfb5.

Change-Id: Ibcc3573283282b3f52a813c789f8586965bbc088

Revert "libstagefright: post video events dynamically - calculate amount of time to delay video event after renderusing the formula: delay = (us between frames)-(us taken by event)-(lateness)"

This reverts commit 1ac2a4f83f7d14b3a4d9c4691a5d6bb62fcc5522.

Change-Id: I06b8023d45a2ea1497a87d5adf7bfa7e74dc0710
stagefright: add an extra buffer to ANW's BUfferQueue

Add an extra buffer to ensure video player has a free buffer to
dequeue rather than wait for the queued buffer to be displayed.
Enable logs to indicate number of buffers allocated.

NOTE: This is not needed for 30fps content on 60fps panel, But
making this change regardless for all framerates till root-cause
is identified in SF

Change-Id: Id1048d7a104b2a75613dda8b9cf166e59bc4bb04
libstagefright: Filewrite in seperate thread for single video track

For files with single video track, the filewrite() and OMXRead()
operations are happening in the samethread. It impacts the
recording performance.

Hence moving filewrite to seperate thread for files with single
video track.

CRs-Fixed: 574807

Change-Id: I3a9bf7869e197973a85783510254cf66b8d1d91b
stagefright: add rendering statistics

 - adds extra fps statistics
 - report via dumpsys
 - prints statistics before reset at the end of playback onto
   logcat
 - adds resume latency, from play_l to render
 - adds seek latency, from seek_l to render
 - enables using persist.debug.sf.statistics 1
 - prints all statistics when seek or resume is issued

Change-Id: I6fa34f3d0180c1b8bbad40da42bd241fb89e6866
libstagefright: print seek statistics even when paused

 - if seek is issued during paused state, SEEK_PREVIEW flag is set
   and statistics needs to be printed even if that happens.

Change-Id: Ida5040d2961bff4dfb8a53b50be01609aaac9976
CRs-Fixed: 512801
libstagefright: Fix intermittent pause during tunnel A-V playback

-Media time is used in onVideoEvent for A-V sync. In offload
 playback we only use realtime(time from DSP).
-Media time should be same as real time. If media time is not
 updated with the real time value A-V sync issues are seen.
-Update media time to real time value to avoid intermittent pause
 during playback.

CRs-Fixed: 572060
Change-Id: Ib1123b7554f3508230ca67cd20a68fa32c753057
Merge branch 'cm-11.0' of https://github.com/CyanogenMod/android_frameworks_av into kk4.4