To fix the video editor transition failure problem

The patch fixes the Android defects in video editor native code. When
the encoded bitstream contains more than one slice in one picture,
the original design cannot handle such a situation.

Moreover, if the encode bitstreams contains more than one Sequence
Parameter Set (SPS) or/and Picture Parameter Set (PPS), the codes
can't deal with it, either.

Change-Id: Ie3212a0bb99856ea5801f627d3e3576e645f237c
Author: Wei Feng <wei.feng@intel.com>
Signed-off-by: Wei Feng <wei.feng@intel.com>
Signed-off-by: Wangyi Gu <wangyi.gu@intel.com>
Signed-off-by: Shuo Gao <shuo.gao@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Author-tracking-BZ: 49712, 45017, 22828, 26405, 45017
Set net_log to NULL unless debugging.

This way methods can exit early instead of logging by testing if the net_log is NULL.

Change-Id: I49e91460967ba3edad7d7b894a90df0589e8ccb2
libmediaplayerservice:delay codec EOS or error message during NuPlayer flushing decoder.

During NuPlayer flush decoder, codec reached EOS or error, and message it to NuPlayer.
If NuPlayerRender has already flushed its video and audio queue, and NuPlayer
still push EOS entry to NuPlayerRender queue, then crash happend because
queue is not empty when finish flush checking queue.

Change-Id: I9079ce282f91d149b4b773b533cf248b833e6e14
Author: Yi Wang <yi.a.wang@intel.com>
Signed-off-by: Yi Wang <yi.a.wang@intel.com>
Signed-off-by: Dan Liang <dan.liang@intel.com>
Signed-off-by: Shuo Gao <shuo.gao@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Author-tracking-BZ: 48710 43878
Modification of setPlaybackStatus events

The seekTo function in AwesomePlayer can be called both when playing
content but also when the content is paused. In the old solution
the events to the DRM FW were the same for both these cases.
This causes too many DRM rights to be consumed in the case where the
song is paused and you seek to the beginning.

Change-Id: I19d8926745595d55962f27ae2bad2c00d42a15eb
strtok which is not MT-safe will be replaced by strtok_r

strtok is not MT-safe because it uses static variable to store last string.
it causes unexpected behavior when the scheduling is happened before
excuting strtok with 'NULL' argument. the static variable 'last' in the
strtok can not be guaranteed when the scheduled thread call the strtok,
also. instead, strtok_r should be used with the stack variable to store
last string.

Change-Id: Ia60835c2431d88098508b5c41f9e0edfa9710059
libcameraservice: Fix build in ISO C++11 mode

Change log macro define so it can't be confused for a C++11 string
literal

Change-Id: Idcc8085735177aa3313fdea66dc0736cca749f9b
Signed-off-by: Bernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org>
Fix the timestamp overflow bug

32 bits timestamp is not big enough, change to 64 bits to avoid overflow.

Change-Id: Icfd33a8c7d57e8de42dd1232537bcf361ba510ed
Author: Weian Chen <weian.chen@intel.com>
Signed-off-by: Wei Feng <wei.feng@intel.com>
Signed-off-by: Shuo Gao <shuo.gao@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Author-tracking-BZ: 28089, 50102

Conflicts:
	media/libstagefright/MPEG4Extractor.cpp
avcenc: Include more parameters in getParam(OMX_IndexParamPortDefinition)

The SimpleSoftOMXComponent base class only updates the
nBufferSize and nBufferCountActual parameters in internalSetParameter,
so only these parameters have sensible values when queried.

Make sure the eColorFormat parameter is set to the actual
value that is set up, and return OMX_COLOR_FormatAndroidOpaque
instead of YUV420SemiPlanar if that has been set up. (Also
make sure to keep the internal color format as YUV420SemiPlanar
after a setParam(OMX_IndexParamPortDefinition) call that
sets the color format to OMX_COLOR_FormatAndroidOpaque.)

This fixes failures in OMXNodeInstance::createInputSurface
with this encoder - it seems to be able to handle surface input
just fine once the caller trusts it enough to proceed.

Also return the actual frame width/height on both ports.
This makes sure input surfaces are allocated with the right
size and gets the right size included in the output format
MediaFormat from the MediaCodec encoder.

Change-Id: I0667b3b4c6bb90331ad0ae7d51388e1bca3d1bbd
libstagefright: enhance rtsp assembler to avoid video stuck in bad wifi environmemnt

enhance rtsp assembler to avoid video stuck, for too much packet lost and
waiting for each packet for 10ms will cause video stuck.add a disorder threshold
to fix the issue.

Change-Id: Ia6205e3c8297c5675d648daa613f111b8785624e
Author: Yi Wang <yi.a.wang@intel.com>
Signed-off-by: Yi Wang <yi.a.wang@intel.com>
Signed-off-by: Dan Liang <dan.liang@intel.com>
Signed-off-by: Shuo Gao <shuo.gao@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Author-tracking-BZ: 49305 43890 38132
libstagefright: remove 10ms polling in AwesomePlayer

AwesomePlayer will wake up every 10ms while video is playing.

This patch will remove the 10ms polling.

Change-Id: Iae3ec6dac7ab5722c708b44e019d3aba09c3aea7
Author: Richard Tang <richard.tang@intel.com>
Signed-off-by: Richard Tang <richard.tang@intel.com>
Singed-off-by: Shuo Gao <shuo.gao@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Author-tracking-BZ: 34320
Mediaserver crash is seen while trying to play unsupported container format via RTSP.

The RTSP server didn't send the rtpmap attribute which is required during setupTrack(),
we now check if the number of rtpmap attributes and media-formats obtained as response
to DESCRIBE request are equal. If unequal, it results in parsing error.

Change-Id: I767f25bc7c799842cfc2337d410793d91e04d801
Author: Gurudatta Bhakte <gurudattax.bhakte@intel.com>
Signed-off-by: Gurudatta Bhakte <gurudattax.bhakte@intel.com>
Signed-off-by: Shuo Gao <shuo.gao@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Author-tracking-BZ: 20348
libstagefright: check the RTCP socket valid before sending RR

make sure the rtcp socket is valid before sending RR to avoid assertion failure

Change-Id: Ied376107e2397bf5888af42ff76c7f82d465a216
Author: Yi Wang <yi.a.wang@intel.com>
Signed-off-by: Yi Wang <yi.a.wang@intel.com>
Signed-off-by: Shuo Gao <shuo.gao@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Author-tracking-BZ: 49305, 18533, 16913
strtok stores its values in thread local storage.
So it can not guarantee works well when multithread environment.
AudioFlinger has multithread.
so strtok_r is more safe.

Change-Id: I6d77ef9cc49a4478dd856dcdca14e4920ce955c6
Release MediaBuffer at error cases in DRMSource::read()

MediaBuffer for containing encrypted/decrypted data is not referred
anymore when DRMSource::read() runs into error cases. MediaBuffer should
be released in order to adjust its reference count in that case.
Call player's setAudioStreamType for hardware output.

Change-Id: Id2d138fc016879b02e78144173c507e3ea27664d
Signed-off-by: Scott Fan <fancp2007@gmail.com>
fix crash issue while playing certain streaming media

In the play response of certain streaming media, the url just contains part of the full url.
Change the url matching method to enable this case rather than crash as before.

Change-Id: Ide4a4a3f01120f9092193a765bda1cc9f12daf56
Author: Yi Wang <yi.a.wang@intel.com>
Signed-off-by: Yi Wang <yi.a.wang@intel.com>
Signed-off-by: Shuduo Sang <shuduo.sang@intel.com>
Signed-off-by: Shuo Gao <shuo.gao@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Author-tracking-BZ:49305, 18533, 7540
Revert "strtok stores its values in thread local storage."

This reverts commit c08d027a12446695e4a7a3950837a15ecfb1dad2.