Revert "libstagefright: set frame packing from codec config"

 * With Venus 1.6, this patch causes the decoder to freeze
   during a new CTS case. Since we aren't using frame packing
   anyway, revert this.

This reverts commit 8356ac84fa349554006dfb6696365794a7d3a204.

Change-Id: I661c84727976aab8a81824279ee1a2fefdd5f8a3
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
stagefright: Correct total duration of HFR clips

HFR leverages the mp4 track timescale parameter which is not
considered when calculating total clip duration. This makes tracks
report the correct duration so that total clip duration is computed
correctly.

Change-Id: I8ff556913317eea15030f9f6920cefa560133872
stagefright: Correct timescale in MvHd for HFR

Either timescale or duration must be modified to show the correct
HFR clip duration. Since duration is also queried by the record
timer, modify the timescale instead.

CRs-Fixed: 662909
Change-Id: I6b744b4048b7a2d0bb70e2e3a102385a312bf81b
stagefright: remove target specific checks for hfr

and rely on capabilities published in media_profiles
which are guaranteed to be correct for a given target.

CRs-Fixed: 680348
Change-Id: I751031478689b0373674aa7858f4ad79483b990f
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
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
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
stagefright: Fix MediaCodecList

 * Missed a few 32->64 conversions in the switch to handle additional
   media types.

Change-Id: I06e26f27576cbf2780a54e3e577209c22fc887b4
stagefright: Only use HW AAC for AV content

 * While this decoder can handle more streams, it can't handle gapless.

Change-Id: I60cb3ca56c57a1280ca0805976e766e242ac1744