v4l2src and mpeg4 plugins on Android
Francesco Argese
kekko84 at gmail.com
Thu Oct 3 06:40:44 PDT 2013
2013/10/2 Sebastian Dröge <slomo at circular-chaos.org>
>
> 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.
>
I call push function in a native function called directly by Java code when
a new preview frame is generated; the main loop is in another thread
created as in the third tutorial using Posix Threads. -> pthread_create
(&gst_app_thread, NULL, &app_function, data); [1]
Today I've investigated more and I have understood that it is not a problem
with the push function but a problem with lacking deallocation of the
buffer created (I have tried to comment the push function and the error
remains there).
Below my native function where I do the push operation in the buffer; if I
comment only the last instruction the error remains while if I comment also
the gst_app_buffer_new I have no errors. It seems that the buffer is never
freed; I have tried to free the last buffer received using g_free but it
doesn't resolve the problem.
What could be the problem?
Thanks in advance,
Francesco Argese
P.S.: You have convinced me to pass to 1.2 version and today I'm working
with it. :-)
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
JNIEXPORT void JNICALL
Java_com_cetma_singlepipeline_MainActivity_nativeSetBuffer
(JNIEnv *env, jobject thiz, jbyteArray frameData){
CustomData *data = GET_CUSTOM_DATA (env, thiz, custom_data_field_id);
if(data->initialized == FALSE || data->isPlaying == FALSE)
return;
jbyte* frameDataPtr = (*env)->GetByteArrayElements(env, frameData,
NULL);
jsize size = (*env)->GetArrayLength(env, frameData);
if(data->bufferVideo == NULL)
g_free(data->bufferVideo);
data->bufferVideo = gst_app_buffer_new((guint8 *)frameDataPtr,
size, g_free, NULL);
gst_app_src_push_buffer(data->appsrc, data->bufferVideo);
}
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
[1] http://docs.gstreamer.com/display/GstSDK/Android+tutorial+3%3A+Video
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-android/attachments/20131003/6951f373/attachment.html>
More information about the gstreamer-android
mailing list