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
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
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
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
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
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
AudioFlinger: fix duplicating thread standby.

Commit fd47797 fixing issue 11247103 introduced a regression
where the duplicating thread does not exit standby state as
expected. This in turn prevents the tracks sending audio to
other threads to complete their activity cycle normally.

The fix conists in clearing mStandby state also in the specialized
threadLoop_write() method of DuplicatingThread subclass.

Bug: 11451415.
Change-Id: Ie8a92c819a56a2834ea25fa70a8b7b2125721775
Notify current video size if available

b/11248101

Change-Id: I0fa3b5592efcf400c86692002267da6825e331ad
configure bitrate and bitrate mode at encoder initialization for VP8/9

Change-Id: I0389264db4102cabb0c6fcb4ca223d85cc9e86fb
related-to-bug: 11536167
audioflinger: fix direct output underrun

Underruns on tracks handled by a direct or offloaded
threads were not properly reported to the applications
causing a failure to automatically recover.

Bug: 11535001.
Change-Id: I7a8696b4d646f78b16710addfe7c108d0dd0038d
Camera HAL3/API1: Add support for the partial result quirk.

- Camera2Client:
 - Detect partial result quirk
- Camera3Device:
 - Accumulate all partial results together
 - Fire off 3A-only result once all 3A states are available
- FrameProcessorBase:
 - Filter out partials, don't send to listeners
- FrameProcessor:
 - Skip face detect on partials
 - Make sure to only handle a 3A update for a given frame once
 - Trigger AF notifications when AF mode or trigger changes, to
   properly detect all AF transitions.

Bug: 11115603
Change-Id: Iea8aa73c568701562a46071f7ea100624251d10b
Properly handle executing->idle in GraphicBufferSource

ACodec has initiated the transition from exectuing->idle and is waiting
for the component to return all buffers so they can be freed.
It's counter productive and with some vendors harmful to submit additional
buffers to the component from this point on.

Change-Id: I332be254a1faf94902c77b5792a373ab447e44d3
related-to-bug: 11573543
Replace assert with error message

The failure happens when vendor code sends EMPTY_BUFFER_DONE
twice on the same buffer.  The second time through, we see a slot
that has already been emptied, and get very confused.

This should be handled with an error, not an assertion, so we now
log a stern complaint and carry on.

Bug 11557463

Change-Id: I76e53ff08924bca81afb6980df8e59a6012ff8fe
TimedEventQueue: improve wakelock management

Do not acquire a wakelock unless the event is delayed by more
than a given time. This prevents from acquiring/releasing
wakelocks too often which has adverse effects on performance.

Bug: 11509471.
Change-Id: Id06803b393b40c4db5095a6e7ec02339fa581a38