libstagefright: Handle unsupported codec metaData

Modification done in StagefrightMetadataRetriver
to handle NULL return for meta data if codec is
unsupported by extractor.

Change-Id: I905cec5ee91b098d99e1935437b562d2d9206381
Fix for getPosition after seek

When starting playback with a seek pending
(calling seek before start) there is a brief period
when the audioplayer returns an incorrect position (zero)

This is caused by that mSeeking is set to false
before the position in the audioplayer actually is updated.

Change-Id: Iaec355c8fdfe589d9b826d20c2531034f2b4e6fb
Correct the time returned by AudioPlayer::getMediaTime

The change 80a68deec52c9a1b47215ed68526206ec88197f8 was added to
eliminate returning negative media positions.

In the change all negative values of realTimeOffset were discarded.
The value realTimeOffset accounts for the latency and the
number of samples played since last feeding the AudioTrack and is
generally negative. By discarding this value for negative values the
time returned does not account for latency or the number of samples
played.

Change-Id: I470450934228732e34539c227365a225be74ccc8
Remove potential cause of underrun.

1. This part of ProcessAudioBuffer function can make underrun issue.
   Because AudioTrackThread::threadLoop's default case is 'pauseInternal'.

2. Without removed part : If AudioTrack obtain small buffer, then it can request small decoded data to player service without waiting.

3. We already have 'waiting codes' in 'AudioTrackshared.cpp ClientProxy::obtainBuffer', it using '__futex_syscall'.
   If we got 'full shared buffer', then 'ClientProxy::obtainBuffer' waits 'ServerProxy::releaseBuffer'.
   It means, there are duplicated 'waiting codes' for ProcessAudioBuffer.

So I removed this part for preventing underrun issue.

Change-Id: Idcca686054d92a4d123873b78b3b9c2e87d3bdca
Signed-off-by: Jinhyuk Seong <jin.seong@lge.com>
libstagefright: ACodec: Add missing message handling

Add kWhatSetParameters as a valid received message in state
OutputPortSettingsChangedState.
Without this fix, the mediaserver can end up in an endless loop
consuming significant extra cpu power.

Change-Id: I9719f1698bf411914eb753d3c349a15b9fbf9df6
Signed-off-by: Per Persson <per.persson@intel.com>
Signed-off-by: Persson, Mikael <mikael.persson@intel.com>
Signed-off-by: Fagerstedt, Axel <axel.fagerstedt@intel.com>
Signed-off-by: Yong Yao <yong.yao@intel.com>
camera: Don't segfault if we get a NULL parameter

 * Values end up NULL on some drivers, don't crash.

Change-Id: Ic897dbd4629cf3af98c85f93be202c382dde806b
Stagefright: Allow MediaCodec::get(Input/Output)Buffers in async mode

since there is no way out to get to the buffer handles.

Change-Id: I66512a1a3d3afb222812d4fdd21f9533bbe85de3
rtsp: Limit subframe processing to available buffer range

With some RTSP servers, the mpeg4 audio subframe count is inconsistent
with the available data. When attempting to process subframes that would
exceed that available buffer boundaries, this causes a memory access
violation. Add buffer size checks to avoid this crash.

Change-Id: I030c6f02c478e216c20d9b24fbd6b3a9c1530889
CRs-Fixed: 737819
GenericSource: Aggregate fewer audio i/p buffer for http streaming

Aggregating huge audio i/p buffer in streaming use case will cause
delay in fetching video i/p buffer and starving video decoder which
will eventually causing frame drops. In case of clips with abnormal
a/v interleaving, audio and video offsets can get too far apart
causing frequent underrun and staving both A/V decoder resulting
in choppy audio and video freeze.

To avoid this issue aggregate A/V buffer similar to  widevine
use-cases, reduce the audio buffer count to 8 and add an extra
video buffer.

Change-Id: I0afdbe11a1e427bd63a10f5cd874dbf6d102e6ab
audioflinger 02