Fix buffer allocation

b/15293123

Change-Id: Icb3ceabf02a55bc931baaf388ce125db6332de0e
libstagefright: mpeg2ts: Ignore continuity_counter discontinuity

The continuity counter is incremented for each ts packet. Any lost
packet results in a discontinuity, and the stock parser flushes the
current frame data leading to corruption if an I-frame is lost.
Avoid flushing on discontinuity to prevent some of this corruption.

CRs-Fixed: 663391

Change-Id: I683269dcb36a1424f6d9a6e543cf9e1ead0103a7
NuPlyer:RTSP: Fix some issues while seeking RTSP source

- Clear the obsolete packets after sending the seek request
- Stop rendering any obsolete frames while seeking
- Stop queueing any obsolete units to source while seeking
- Without this patch, the process-bar will return to
  the previous playback position, and stay at this position
  until the seek operation finish.
  Then, the process-bar will go to the seek position, and go
  forward according the playback of the clips.
- Without this patch, in some platform (based on Q6), seek
  operation will cause several green frame.

CRs-Fixed: 623269
Change-Id: I432de355d8e601a4d434cb78c699043dea2c6b55
Squashed amrwb+ commits:

ExtendedCodec: update amrwb+ format parameters

- Add new API to update channel count and
  sample rate of Amrwb+ format.

CRs-Fixed: 631469

Change-Id: I46d2f219a13f3edf49ac0e7a8d098ca96bcd22a2

ExtendedCodec: update amrwb+ component input/output ports

- updated sample rate and channel count of amrwb+ input
  and output configurations

Change-Id: I1a0412ed402e8d58f1db5422c904e18a51fb5965
CRs-Fixed: 631469
CameraService: Change order of client declaration and service lock.

Camera service lock has to be acquired after client declaration.
Otherwise, deadlock can occur when client destructor tries to
acquire service lock when its already acquired.

Change-Id: I21757325b3cbfdd5ca52c7becdfaa34ffa5bc768
libmediaplayerservice:Fix deadlock on gapless start failure

Issue:- Current gapless implementation starts the next clip when
MEDIA_PLAYBACK_COMPLETE event for the first clip is recieved
by MediaPlayerService.
-Even if start for next clip fails, application is notified with
MEDIA_INFO_STARTED_AS_NEXT.
- This causes the framework to trigger mediaplayer start which
again fails as it being for the same clip resulting in a deadlock
in the mediaplayer.
Fix:- Notify application with MEDIA_INFO_STARTED_AS_NEXT only when
start for the next clip is successful.

Change-Id: I77c570074c7c98c996122e275161ba88298e56fc
NuPlayer: Add RTSP Server Timeout Setting to Meta Data

Needs http://gerrit.dirtyunicorns.com/4010

- Operator requires MoviePlayer to prompt dialog when the activity has been
  paused for longer than server timeout. This patch adds server timeout
  to meta data, so app can get the timeout value.

CRs-Fixed: 638087
Change-Id: I08f98e965497047c420d9d6ecc0b2898abe56369
Merge "libstagefright: mpeg2ts: Ignore continuity_counter discontinuity" into du44
Merge "Squashed amrwb+ commits:" into du44
Merge "CameraService: Change order of client declaration and service lock." into du44
Merge "libmediaplayerservice:Fix deadlock on gapless start failure" into du44
Merge "NuPlyer:RTSP: Fix some issues while seeking RTSP source" into du44
Merge "NuPlayer: Add RTSP Server Timeout Setting to Meta Data" into du44
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
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>