StageFright: Removes hacks for Nvidia MPEG2 decoder

Removes the NVIDIA MPEG2 decoder specific hacks in legacy code as
Nvidia HW MPEG2 decoder is enabled and tested now.

Change-Id: Ifc67e1119d9741551336753f85f9cfdfd3fc8600
audioflinger: enable effects after registration if needed

This fixes a bug where effects were not properly reenabled after
being moved from one playback thread to another. The effect
is enabled but the audio policy manager sees it as disabled.

Bug: 11181933.
Change-Id: I19cac7acbaf61c546e667fd85ed7d4eda1c716d8
Fix flush() followed by start()

Bug: 11259166
Change-Id: I72526cdfd4e3ff4b06e6a317e577f57cc285205d
Make sure we get to discover that the cache is sufficiently full again

by posting buffering events while in the CACHE_UNDERRUN state.

Change-Id: Ic60c8d57f0ae502aa2b6eec7160dc4224b989604
related-to-bug: 11262689
Merge "Fix flush() followed by start()" into klp-dev
audioflinger: fix track terminated before playing

When a track is terminated before any audio was written,
we should not send a drain request to the HAL. The drain
will be ignored and we will wait the async callback for ever.

Also fix a potential deadlock by not deleting a track with the
thread mutex held: mPreviousTrack changed from a sp to a raw pointer.

Bug: 11247103.
Change-Id: I0a4b47b099204c7c326d45d700234ab8f72d8eae
Allow releaseBuffer after flush

After AudioTrack start checks for pending flush,
allow releaseBuffer on any previously obtained buffer.
For example, this can happen if the resampler has obtained
a buffer but not released the whole buffer yet.
Note that the resampler will be reading obsolete data.

Bug: 11285590
Change-Id: I0614fbb62e43604aac3089cce4b7797c87a306b5
Fix kAutoRampDurationUs overflow issue

When kAutoRampDurationUs multiplies with mSampleRate, it overflows to int64.
Type cast it to int64 to make sure RampDurationUs properly.

BUg: 11162491
Change-Id: I4f93bc9acc8456e25623a9255ca7a5b206425009
Merge "Allow releaseBuffer after flush" into klp-dev
Merge "Fix kAutoRampDurationUs overflow issue" into klp-dev
Check for NULL buffer in repeat-latest

Repeating the most-recent buffer appears to fail when the producer
disconnects.  This adds a NULL check to avoid crashing.

Bug 10607920

Change-Id: Ied036004425f046fcf9c26303823681f3fddb99e
Merge "Check for NULL buffer in repeat-latest" into klp-dev
Assign blame for playback wakelocks.

Set a work source for the playback wakelock, so that playback is
counted against the requesting app instead of the media server.

Cherrypicked from master.

b/9464621

Change-Id: I7329f88a288a95a582a78005a1c3d16a5a611e31
AudioFlinger: more fixes for offload audio lost

mStandby being false was not a reliable indication that
something had been written to audio HAL.

Considering the last track in mActiveTracks vector as the
latest activated track was wrong as this is a SortedVector.

Bug: 11247103.
Change-Id: I397d011c5afcdd779def3fe25aaae7669a472cfc
AwesomePlayer: ensure STARTED message works after reset

Change-Id: I06217c07c0b68476cb296fd6151f6a0d8d4e02d0
Signed-off-by: Lajos Molnar <lajos@google.com>
Bug: 11412881
camera: Collect stack traces when bad things happen, print with dumpsys

Bug: 11324229
Change-Id: Ic920e170a8f5a389fc139bbf5416c0e3186c7fb6
Merge "audioflinger: enable effects after registration if needed" into klp-dev
StageFrightRecorder: do not use meta-data mode for software encoders

Camera HAL v1 uses vendor-specific camera-source meta-data mode, but
software encoders use generic gralloc-source mode, so they are not
compatible.

Change-Id: I0d1bab8eada26dcb70c97b1eec83f06d1f331239
Signed-off-by: Lajos Molnar <lajos@google.com>
Bug: 11446505
Merge "AwesomePlayer: ensure STARTED message works after reset" into klp-dev
Restore NuPlayer error and EOS handling

This was erroneously removed by commit a73c954

Change-Id: I4742339139e770f0181c99d427875897fd60b68e
Signed-off-by: Lajos Molnar <lajos@google.com>
Bug: 11413439