MediaExtractor: Add more skip conditions for the second-pass extractors

If the stream's container is opaque (DRM) or a known skip condition
(cached-source MPEG4), don't push it through the deep scanner

Change-Id: Ia9d60180b5d177714d206fc7dc94da93b37a048e
audio:Avoid VideoLagUpdate if there is no AudioPlayer

-When AudioTrack is failed to initialized, mAudioPlayer
 is deleted in onVideoEvent but onVideoLagUpdate() is still
 trying to access mAudioPlayer which is leading to a crash.
 The function onVideoLagUpdate() is used to notify if video
 is lagging behind audio. So this function is no longer
 valid if AudioPlayer is deleted.

-Fix is to add a check for AudioPlayer in onVideoLagUpdate,
 which will avoid onVideoLagUpdate() if there is no
 AudioPlayer

Change-Id: Ie8dbfc1995a3da88a4a435ec2de86b1c22a07c65
CRs-Fixed: 647200
NuPlayer: Fix ANR while resetting RTSP playback

- When network is poor, the response of RTSP teardown won't be received
  in time, so ANR will happen.
- With this patch, a teardown message will be sent when timeout expires,
  in order to avoid ANR.

Change-Id: I3f9efd9fefa66104ad452559ced5ff5218d73a66
CRs-Fixed: 650866
libstagefright: Fix to free buffers in error scenarios

- MediaBuffer objects are not freed if component transitions from
  IDLE->EXECUTING or EXECUTING->LOADED fails (or if the
  OMX_CmdComplete messages are dropped due to an earlier error)
  Additionally with native buffers, the corresponding
  ANativeWindowBuffers are not cancelled back in the above scenarios.

CRs-Fixed: 640236

Change-Id: I62bdcde5d52ee65cba457a9b5e938e0390d8d9b4
audio: Fixed condition to load AAC HW Encoder

- UseQCHWAACEncoder checks if the bitrate passed by the
  client is in the supported bit rate range of the
  AAC Hw Encoder. It is wrongly compared with the
  sample rate passed by the client instead of bitrate
  This is leading to loading of Hw Encoder even when
  unsupported bitrate is passed

- Fix is to correct the condition to compare with bitrate
  instead of sample rate

Change-Id: I88f4cbcf476dab8bd2bd44860b75ee3ffc3a5bb9
CRs-fixed: 659716
libstagefright - Fix seek on audio having empty stss block

Ignore stss block for audio even if its present, all audio
sample are sync samples itself, self decodeable and playable.

Parsing this block for audio restricts audio seek to few entries
available in this block, sometimes 0, which is undesired.

CRs-Fixed: 664870
Change-Id: If3208d5c0557d3eaeddf875d6c6762bd870c439b
libstagefright: set frame packing from codec config

- From ACodec call to configure codec is triggered but there is no frame
  packing call
- In default configuration, clips may fail if the proper frame packing
  mode is not set
- Codec config and frame packing are currently done in two separate calls.
  Fix is to trigger frame packing from within the codec config call as
  there is no reason to call each separately

Change-Id: I0455d446cd862b5e7373e3bcb9ad4bfdf7826d18
CRs-Fixed: 648894
stagefright: Fix mismerge

Change-Id: I893d4731bb9152c72ee680954efc44693ef49ada
Merge branch 'cm-11.0' of git://github.com/CyanogenMod/android_frameworks_av into cm-11.0
Fix memory leak when filtering commands in insertCommand_l()

When AudioPolicyService::AudioCommandThread::insertCommand_l filters
a command from the queue, the AudioCommand* is removed from the
vector mAudioCommands by calling mAudioCommands.removeAt(). This will
destroy the pointer and compact the vector, but not delete the
AudioCommand object.

This patch adds code to delete a filtered out AudioCommand and its
data object mParam. However, mParam was void* and deleting a void
pointer is undefined behavior according to the C++
standard. Therefore, the data classes are modified to inherit
from an abstract base class with a virtual destructor.

The deletion of non-filtered commands in
AudioPolicyService::AudioCommandThread::threadLoop() was already
correct, as each case casts mParam to the proper type before
deleting.

This also fixes AOSP issue 36370.

Change-Id: I2b63838aff3608132aa496f964a929f78c4b6267
Merge branch 'cm-11.0' of git://github.com/CyanogenMod/android_frameworks_av into cm-11.0
Merge branch 'cm-11.0' of https://github.com/temasek/android_frameworks_av into HEAD