Hi everyone,
I am trying to play a custom pipeline able to play mp4 files on android. So my first step has been checking that this pipeline works correctly by using gst-launch-1.0 in the terminal (ubuntu14.04): gst-launch-1.0 souphttpsrc location=http://192.168.0.10/videos/test.mp4 ! qtdemux name=demux demux. ! queue ! aacparse ! faad ! autoaudiosink demux. ! queue ! h264parse ! avdec_h264 ! autovideosinkMy next step has been using the tutorial5 example for android project. And the modifications that I have made are the ones I show here: - Adding more GstElements in the struct CustomData: - Adding a function in order to add dynamically pads:typedef struct _CustomData { jobject app; /* Application instance, used to call its methods. A global reference is kept. */ GstElement *pipeline, *src, *demux, *audio_q, *video_q, *aacparse, *h264parse, *faad, *avdec_h264, *audioconvert, *videoconvert, *audiosink, *videosink; /* The running pipeline */ GMainContext *context; /* GLib context used to run the main loop */ GMainLoop *main_loop; /* GLib main loop */ [...] } CustomData; - In the static void *app_function (void *userdata) I have commented the instruction:static void dynamic_addpad(GstElement *src, GstPad *new_pad, CustomData *data) { char* pad_name = gst_pad_get_name(new_pad); g_print(" In dynamic ADDING PAD %s\n", pad_name); if (g_str_has_prefix(pad_name,"audio")) { GstPad *audiodemuxsink = gst_element_get_static_pad(data->audio_q,"sink"); gst_pad_link(new_pad,audiodemuxsink ); g_print ("Sink pad link: '%s'\n", pad_name); } else if (g_str_has_prefix(pad_name,"video")) { GstPad *videodemuxsink = gst_element_get_static_pad(data->video_q,"sink"); gst_pad_link(new_pad,videodemuxsink ); g_print ("Sink pad link: '%s'\n", pad_name); } }
And this is what I have written instead of:- Finally, inside the function void gst_native_set_uri (JNIEnv* env, jobject thiz, jstring uri) I have replaced the instruction:/* Build pipeline */ data->pipeline = gst_pipeline_new ("pipeline"); data->src = gst_element_factory_make ("souphttpsrc", "src"); data->demux = gst_element_factory_make ("qtdemux", "qtdemux"); data->video_q = gst_element_factory_make("queue2", "queue-video"); data->h264parse = gst_element_factory_make ("h264parse", "h264-parse"); data->avdec_h264 = gst_element_factory_make ("avdec_h264", "h264dec"); data->videoconvert = gst_element_factory_make("videoconvert", "videoconvert"); data->videosink = gst_element_factory_make ("autovideosink", "autovideosink"); data->audio_q = gst_element_factory_make ("queue2", "queue_audio"); data->aacparse = gst_element_factory_make ("aacparse", "aacparse"); data->faad = gst_element_factory_make ("faad", "faad"); data->audioconvert = gst_element_factory_make("audioconvert", "audioconvert"); data->audiosink = gst_element_factory_make ("autoaudiosink", "autoaudiosink"); g_signal_connect (data->demux, "pad-added", G_CALLBACK (dynamic_addpad), &data); gst_bin_add_many(GST_BIN(data->pipeline), data->src, data->demux, data->video_q, data->h264parse, data->avdec_h264, data->videoconvert, data->videosink, data->audio_q, data->aacparse, data->faad, data->audioconvert, data->audiosink, NULL); gst_element_link(data->src, data->demux); gst_element_link_many(data->video_q, data->h264parse, data->avdec_h264, data->videoconvert, data->videosink, NULL); gst_element_link_many(data->audio_q, data->aacparse, data->faad, data->audioconvert, data->audiosink, NULL);
For:
I know I am missing something because if I use the playbin element
it successfully plays the file. But this way the result I obtain in
the device is "Unfortunately, App has stopped." And the logcat is
showing the next info:04-15 11:30:23.952 21178-21178/? E/Zygote: MountEmulatedStorage()Thanks for your help, Dani _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
On Fr, 2016-04-15 at 11:35 +0200, Dani wrote:
> Hi everyone, > I am trying to play a custom pipeline able to play mp4 files on android. So my first step has been checking that this pipeline works correctly by using gst-launch-1.0 in the terminal (ubuntu14.04): > > gst-launch-1.0 souphttpsrc location=http://192.168.0.10/videos/test.mp4 ! qtdemux name=demux demux. ! queue ! aacparse ! faad ! autoaudiosink demux. ! queue ! h264parse ! avdec_h264 ! autovideosink > My next step has been using the tutorial5 example for android project. And the modifications that I have made are the ones I show here: > > [...] > 04-15 11:30:24.987 21178-21230/com.sample.app I/GLib+stdout: In dynamic ADDING PAD video_0 > 04-15 11:30:24.987 21178-21230/com.sample.app A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x1 in tid 21230 (src:src) Run this in a native debugger (e.g. gdb) and see where exactly it crashes and why. Judging from your code, the problem could be here: g_signal_connect (data->demux, "pad-added", G_CALLBACK (dynamic_addpad), &data); You pass a pointer to your data pointer in there, and then later use it just like a normal pointer in the callback. That's not going to work well, especially as &data is going to be an invalid reference on the stack after the function where you connect the signal has returned. -- Sebastian Dröge, Centricular Ltd · http://www.centricular.com _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel signature.asc (968 bytes) Download Attachment |
Thanks for your suggestions, I have just used gdb for debugging and
I am quite confident it is related to dynamically linking pads.
This is the log and the info I am getting through gdb (+attached screenshot): DEVICE SHELL COMMAND: cat /data/local/tmp/start_lldb_server.sh | run-as com.sample.app sh -c 'cat > /data/data/com.sample.app/lldb/bin/start_lldb_server.sh; chmod 700 /data/data/com.sample.app/lldb/bin/start_lldb_server.sh' In the logcat I am still having the same messages as in the first post. Is there any other possible way to pass the pointer without this reference problem? Thanks in advance Dani El 18/04/16 a las 09:15, Sebastian
Dröge escribió:
On Fr, 2016-04-15 at 11:35 +0200, Dani wrote:Hi everyone, I am trying to play a custom pipeline able to play mp4 files on android. So my first step has been checking that this pipeline works correctly by using gst-launch-1.0 in the terminal (ubuntu14.04): gst-launch-1.0 souphttpsrc location=http://192.168.0.10/videos/test.mp4 ! qtdemux name=demux demux. ! queue ! aacparse ! faad ! autoaudiosink demux. ! queue ! h264parse ! avdec_h264 ! autovideosink My next step has been using the tutorial5 example for android project. And the modifications that I have made are the ones I show here: [...] 04-15 11:30:24.987 21178-21230/com.sample.app I/GLib+stdout: In dynamic ADDING PAD video_0 04-15 11:30:24.987 21178-21230/com.sample.app A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x1 in tid 21230 (src:src)Run this in a native debugger (e.g. gdb) and see where exactly it crashes and why. Judging from your code, the problem could be here: g_signal_connect (data->demux, "pad-added", G_CALLBACK (dynamic_addpad), &data); You pass a pointer to your data pointer in there, and then later use it just like a normal pointer in the callback. That's not going to work well, especially as &data is going to be an invalid reference on the stack after the function where you connect the signal has returned. _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
On Mo, 2016-04-18 at 12:46 +0200, Dani wrote:
> Thanks for your suggestions, I have just used gdb for debugging and I > am quite confident it is related to dynamically linking pads. Did you see my comment about how you connect to the signal in the previous mail? That is at least one problem, if there are still problems after that we can take another look. -- Sebastian Dröge, Centricular Ltd · http://www.centricular.com _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel signature.asc (968 bytes) Download Attachment |
Thanks for your answer,
after fixing the problem you told me now the app is not stopping. What happens is that it is still unable to play the file and the logcat shows the next messages: 04-18 13:26:08.350 24062-24154/com.sample.app I/GLib+stdout: In dynamic ADDING PAD video_0065So it seems there is a problem with the aac decoder. I already posted a bug of the aac decoder of android (https://bugzilla.gnome.org/show_bug.cgi?id=765050), but I do not know if this time is also directly related to the same issue. Thanks for your replies, Dani El 18/04/16 a las 13:31, Sebastian
Dröge escribió:
On Mo, 2016-04-18 at 12:46 +0200, Dani wrote:Thanks for your suggestions, I have just used gdb for debugging and I am quite confident it is related to dynamically linking pads.Did you see my comment about how you connect to the signal in the previous mail? That is at least one problem, if there are still problems after that we can take another look. _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
On Mo, 2016-04-18 at 13:36 +0200, Dani wrote:
> Thanks for your answer, > after fixing the problem you told me now the app is not stopping. What happens is that it is still unable to play the file and the logcat shows the next messages: > > 04-18 13:26:08.615 24062-24154/com.sample.app W/GStreamer+basesrc: > 0:00:02.845565209 0x9e23e260 > gstbasesrc.c:2943:gst_base_src_loop: error: Internal data > flow error. > 04-18 13:26:08.615 24062-24154/com.sample.app W/GStreamer+basesrc: > 0:00:02.845637417 0x9e23e260 > gstbasesrc.c:2943:gst_base_src_loop: error: streaming task > paused, reason not-negotiated (-4) > 04-18 13:26:08.615 24062-24110/com.sample.app D/GStreamer+tutorial-5: > 0:00:02.846137917 0x9e23f520 src/main/jni/tutorial- > 5.c:132:set_ui_message Setting message to: Error received from > element http-src: Internal data flow error. converter between decoders and sink, or are linking a decoder/parser that doesn't actually support the stream. -- Sebastian Dröge, Centricular Ltd · http://www.centricular.com _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel signature.asc (968 bytes) Download Attachment |
Free forum by Nabble | Edit this page |