v4l2src and mpeg4 plugins on Android

Sebastian Dröge slomo at circular-chaos.org
Wed Oct 2 08:37:53 PDT 2013


On Mi, 2013-10-02 at 17:04 +0200, Francesco Argese wrote:
> Hello,
> 
> I have tried to read raw frames using android java api and send them to
> gstreamer pipelines using appsrc.
> 
> I have implemented it starting from Tutorial3 for Android and I have done
> the required changes. I have tried two solutions:
> 1) call a native Android function from Java code to push the buffer in
> appsrc
> 2) using callbacks related to appsrc to retrieve frame when data are needed
> 
> I have the following problems:
> 1) The pipeline with appsrc works and I'm able to use image frame in
> GStreamer but the buffer is filled too fast and is cleared too slow so
> after some time I obtain an out of memory error.
> 2) This way could resolve problem of out of memory but when I call
> "g_idle_add ((GSourceFunc) read_data, data);" in "need-data" callback the
> code doesn't enter never in idle function (read_data). I have investigated
> on forums what could generate this problem and I have found something
> related to launching main_loop in an external thread; I have tried to add
> g_thread_init(NULL) but it doesn't resolve the problem.
> 
> What could be the problem?

For your two problems, don't use the need-data/enough-data model of
appsrc. Instead just start a thread (g_thread_new()) that pushes data
all the time as fast as possible (or throttled if you want to limit the
fps) to appsrc. appsrc will then block if too many frames are queued
downstream, and you will only produce a new frame if the queues
downstream are not all filled.

> P.S.: Are there any changes in more recent versions of GStreamer that could
> simplify my work to take camera on Android?

You mean in 0.10 vs. 1.x? Yes, nothing specifically about your problem
but many improvements everywhere :)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/gstreamer-android/attachments/20131002/7831a0e2/attachment.pgp>


More information about the gstreamer-android mailing list