mediaplayerservice: Untangle legacy callback function

Change-Id: Ie0e3c02a9446a5898ae56453d40a144202de40e3
Fix aac decoder flush

b/8543366

Change-Id: I746ffed6289486b802a2292bfc492ea6c780ed0b
Can't play AAC file with ID3 tag.

When the file is scanned, the ID3 tag is found to have a
footer at the end of audio data. And getAdtsFrameLength
return zero after reading the footer. As a result, the
duration and mInitCheck are not set. The current change
considers the data till footer and sets the duration based
on no. of frames read till the footer/corrupt frame.

Change-Id: Ie8f898435f0d4ca31fdd355146c4db7b37c0b988
Signed-off-by: Arulselvan M <arulselvan.m@intel.com>
Signed-off-by: Jin Wei <wei.a.jin@intel.com>
stagefright: Use HW AAC decoder in ACodec if requested

 * testHLS is failing due to parsing issues with the AAC track
 * Switch to the more robust HW decoder for HLS as well.

Change-Id: I2299266d5f2d8cb0ac457241e4f1d0f4ef87ea05
audio:mute duration at the beginning of the recording

-Sometimes shutter sound is getting recorded because
 current kAutoRampStartUs is not sufficient to mute the
 shutter sound

-Fix is to increase the kAutoRampStartUs to 500ms.

Change-Id: Id37b48c4bb7b5c903ef502f933eaff7be0ea566c
CRs-Fixed: 636491

Conflicts:
	include/media/stagefright/AudioSource.h
HLS: getDuration should return -1 for live streams

According to the MediaPlayer API documentation -1 should
be returned if the duration is not available. But for HLS 0
is returned. Change this.

Change-Id: Ib7704a94ac8dc104ceed4da4491f0d03cb8f4560
Stop thread before deleting object reference

If setPeriodicCapture is called Visualizer will start a thread
and do periodic callbacks. When native_finalize is called the
reference to the class is deleted. If a callback happens after
this the reference is no longer valid and when used from the
callback method the vm crashes. With this patch the thread will
be terminated before deleting the reference.

Change-Id: I30f331437ddad05f8d52c244cdbecb1859a0abd2
Disconnect the mediaplayer when reset

When the mediaplayer is reset the strong pointer to the
media service client is destroyed and the client should
deconstruct. However this could take some time and if a new
client is connected before the old client is disconnected
there could be problems. By assuring that the client disconnects
these problems can be avoided.

Change-Id: I5d2cf6d22860aa616b14397b1f523ddc35197b83
Audio streaming error when playing a stream that contains "end of file".

Although EOS is being posted upon receipt of BYE message from RTSP
server, still it didn't reach the media framework and application.
This happens because the Nuplayer::Renderer::onDrainAudioQueue() funtion
returns false after mAudioSink->getPosition() call , and the EOS message
present in mAudioQueue was lost.The mAudioSink->getPosition() returns
NO_INIT as mAudioSink->open() is not yet called,
hence no audio track exists in MediaPlayerService::AudioOutput.

Change-Id: I905e8f3af87dc778952eeef3904c4e2a6a75ca7a
Signed-off-by: Arulselvan M <arulselvan.m@intel.com>
Signed-off-by: Jin Wei <wei.a.jin@intel.com>
Add support for MPEG audio elementary streams in HLS

In the new KitKat HLS solution support for elementary
audio streams was added. According to a comment both AAC
and MPEG audio should be supported, but only AAC is
actually implemented. When streaming an MPEG audio stream
the whole phone would freeze. This commit implements support
for MPEG audio as well.

Change-Id: I083961599d5316b76da9fe47c8561d34569a456d

Conflicts:
	media/libstagefright/httplive/PlaylistFetcher.cpp
stagefright: Use 64 bits for type mask in MediaCodecList

 * We're supporting a lot of media types now, and the codec lookup
   uses a 32-bit mask which limits us. Change this to 64 bits.

Change-Id: Ic60e313a1dd133b0ac33b80a201d462e55d50096
stagefright: Only invoker HW decoder for actual decoding

 * Only prefer it if actually decoding, derp.

Change-Id: Ie3fe41a77bda8c72e786a906fa14dc1e20e9813f
stagefright: Extra checks for HW AAC decoder

 * Don't engage the HW AAC codec if we don't have channel metadata.
 * This is the case for secure decode, in which case the HW codec
   performs badly.

Change-Id: I993fd01d3074eddc3ed9e867cf213d2da36f8d27
stagefright: Fix stub function

Change-Id: Ifee620bb7b02819ac59f7154bf76f114b57646ee