libstagefright: Decrease reference count before deleting AudioPlayer

-Reference count of AudioSource is not decreased to 1 before deleting
 AudioPlayer, and thus cause the thread blocked in an infinite loop
 due to the AudioSource object is not deleted
-Decrease the strong reference value of AudioSource before
 deleting AudioPlayer

Change-Id: I804211dcca91213c62a4d622baf2001f3cc9955b
CRs-Fixed: 691668
RTSP: Correct the data type in the check

The check for a race condition in RTSP flush has a mismatch
in its data type.
UNKNOWN_ERROR is used as a positive value and isn't equal to
the return value of feedMoreTSData().
Typecast it to fix this mismatch.

Change-Id: Ib8a88af13e5b43f5802052cb8a956c2f391e73b3
HLS: Queue discontinuity only for the first block

If a segment jump happens in HLS, the discontinuity gets
queued for every block read. This leads to continuous decoder
flushes and is observed as a long video freeze.

Changes done to queue the discontinuity only for the first block
after segment jump.

CRs-Fixed: 696452

Change-Id: I79409fe552611fcf3cb6ea9cbc76c8d4f9f5541f
midi audio: allow midi restart even upon stop state

Due to the limitation of EAS_XXX interfaces design, there's no way to
restart midi playback again once last track reaches EOS. To allow this
operation, seek the current track backwards and resume again.

Change-Id: Ib93993eb18e309ac7cb2a305d55ab63f2e86acb9
stagefright: Fix offload fallback for 24bit

Change I398d964a3c5b18f58fcc79376bc29222e796badc disables 24bit
playback on non-offloadable tracks, but tries to read the format
after clear()ing the audio source. Fix the operation order to
do the disable before resetting the source.

Change-Id: Idbbd5e21f9e8fc357a494fabe9028331ebfd2ac4