avcenc: Prepend startcodes to output buffers

This makes the encoder output data that is similar to actual HW
encoders.

This also makes the encoder's output work in other decoders
when passing through directly. If feeding the encoded data
straight through to a decoder (such as in the EncodeDecodeTest
CTS test), the output from OMX.google.h264.encoder cannot be
decoded by e.g. OMX.Nvidia.h264.decode on a Nexus 7 or
OMX.SEC.avc.dec on a Galaxy S3. (The first frame can be somewhat
decoded by the sw decoder OMX.google.h264.decoder, but not properly.)

Change-Id: I6e16433a4a66936e3080723c8233681f53bd55e5
Fixed a 'setVideoSurfaceTexture failed(-22)' after reset.

- The mPlayer is destructed if reference count becomes 0. But native object(MediaPlayerService::Client) is not destructed synchronously.
Native object is disconnected with nativewindow on destructor, But native object's destruction is sometimes deferred about 20ms even if mediaplayer::reset method is called.
If setVideoSurfaceTexture is called before native object's destructor, 'MediaPlayerService: setVideoSurfaceTexture failed: -22' error occured.
In order to prevent this error, native object should be disconnected with nativewindow before the reset method returns.

- Thread-Safe interface pattern(reset_l) does not seem to be usable in this case, so delete it.

- Use a local reference for reducing the range of mutex lock.

Change-Id: I2862e897003704393241d569b9398b23641ce8b9
Signed-off-by: sunjin.lee <sunjin.lee@lge.com>
Add ThreadedSource to Stagefright framework

This patch adds ThreadedSource to Stagefright framework. It
allows to start Media Source in separate threads and can
significantly improve software codec (such as VP8 decoder)
performance.

Change-Id: Idcd852ad8b04c76eb4d7ee118f4166089c76a7f7
Author: Wei Feng <wei.feng@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: 48043