changing souphttpsrc location property on android

Dani dmr.dev.rdp at gmail.com
Mon May 23 11:07:58 UTC 2016


Thanks for your suggestion,
you are right so what I have done is writing the pipeline, making, 
adding and linking elements one by one.
What happens to me now is that, when dynamically adding audio and video 
pads from tsdemux to their own queues before the parsers, they are 
refused and there is no playout.
The function for dynamically adding pads is (I know the conditional 
instructions are not implemented in an efficient way as I wrote them 
just to check where it failed):

    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")) { GstElement *q_audio; q_audio
    = gst_bin_get_by_name (GST_BIN(data->pipeline), "queue_audio");
    GstPad *audiodemuxsink = gst_element_get_static_pad(q_audio,"sink");
    if(gst_pad_link(new_pad,audiodemuxsink) == GST_PAD_LINK_OK)
    g_print("Audio successfully linked!\n"); else
    if(gst_pad_link(new_pad,audiodemuxsink) ==
    GST_PAD_LINK_WRONG_HIERARCHY) g_print("Audio link wrong
    hierarchy!\n"); else if(gst_pad_link(new_pad,audiodemuxsink) ==
    GST_PAD_LINK_WAS_LINKED) g_print("Audio already linked!\n"); else
    if(gst_pad_link(new_pad,audiodemuxsink) ==
    GST_PAD_LINK_WRONG_DIRECTION) g_print("Audio link wrong
    direction!\n"); else if(gst_pad_link(new_pad,audiodemuxsink) ==
    GST_PAD_LINK_NOFORMAT) g_print("Audio link noformat!\n"); else
    if(gst_pad_link(new_pad,audiodemuxsink) == GST_PAD_LINK_NOSCHED)
    g_print("Audio link nosched!\n"); else
    if(gst_pad_link(new_pad,audiodemuxsink) == GST_PAD_LINK_REFUSED)
    g_print("Audio link refused!\n"); g_print ("Sink pad link: '%s'\n",
    pad_name); gst_object_unref(q_audio); } else if
    (g_str_has_prefix(pad_name,"video")) { GstElement *q_video; q_video
    = gst_bin_get_by_name(GST_BIN(data->pipeline), "queue_video");
    GstPad *videodemuxsink = gst_element_get_static_pad(q_video,"sink");
    if(gst_pad_link(new_pad,videodemuxsink) == GST_PAD_LINK_OK)
    g_print("Video successfully linked!\n"); else
    if(gst_pad_link(new_pad,videodemuxsink) ==
    GST_PAD_LINK_WRONG_HIERARCHY) g_print("Video link wrong
    hierarchy!\n"); else if(gst_pad_link(new_pad,videodemuxsink) ==
    GST_PAD_LINK_WAS_LINKED) g_print("Video link already linked!\n");
    else if(gst_pad_link(new_pad,videodemuxsink) ==
    GST_PAD_LINK_WRONG_DIRECTION) g_print("Video link wrong
    direction!\n"); else if(gst_pad_link(new_pad,videodemuxsink) ==
    GST_PAD_LINK_NOFORMAT) g_print("Video link noformat!\n"); else
    if(gst_pad_link(new_pad,videodemuxsink) == GST_PAD_LINK_NOSCHED)
    g_print("Video link nosched!\n"); else
    if(gst_pad_link(new_pad,videodemuxsink) == GST_PAD_LINK_REFUSED)
    g_print("Video link refused!\n"); g_print ("Sink pad link: '%s'\n",
    pad_name); gst_object_unref(q_video); } }

So the log prints the "Video link refused!" sentence and after that one:

    05-23 12:38:58.675 8461-8526/com.sample.app
    W/GStreamer+mpegtspacketizer: 0:00:01.503897667 0x9e11a260
    mpegtspacketizer.c:2509:mpegts_packetizer_pts_to_ts Not enough
    information to calculate proper timestamp

Which is understandable as there is no linking and therefore it has no 
info. There the log stops and the app does not crash but keeps a black 
video surface.
Anyway I know where the problem is (dynamic linking) but I would 
appreciate any suggestions to solve it, I don't know why there is a link 
refusement for both audio and video streams, with the gst-launch way it 
was working correctly at this point. And the pc-equivalent code works 
fine exactly as shown on this post.
The modifications implemented for the main method in android c source 
are as seen here:

    static void *app_function (void *userdata) { [...] GST_DEBUG
    ("Creating pipeline in CustomData at %p", data); /* Create our own
    GLib Main Context and make it the default one */ data->context =
    g_main_context_new ();
    g_main_context_push_thread_default(data->context); /* Build pipeline
    */ data->pipeline = gst_pipeline_new ("pipeline"); data->httpsrc =
    gst_element_factory_make ("souphttpsrc", "http_src"); data->tsdemux
    = gst_element_factory_make ("tsdemux", "demux"); data->queue_video =
    gst_element_factory_make("queue2", "queue_video"); data->h264parse =
    gst_element_factory_make ("h264parse", "h264_parse"); data->h264dec
    = gst_element_factory_make ("avdec_h264", "h264dec");
    data->video_convert =
    gst_element_factory_make("videoconvert","video_convert");
    data->videosink = gst_element_factory_make ("glimagesink",
    "video_sink"); data->queue_audio = gst_element_factory_make
    ("queue2", "queue_audio"); data->aacparse = gst_element_factory_make
    ("aacparse", "aacparse"); data->faad = gst_element_factory_make
    ("faad", "faad"); data->audio_convert =
    gst_element_factory_make("audioconvert", "audio_convert");
    data->audiosink = gst_element_factory_make ("autoaudiosink",
    "audio_sink"); g_signal_connect (data->tsdemux, "pad-added",
    G_CALLBACK (dynamic_addpad), &data);
    gst_bin_add_many(GST_BIN(data->pipeline), data->httpsrc,
    data->tsdemux, data->queue_video, data->h264parse, data->h264dec,
    data->video_convert, data->videosink, data->queue_audio,
    data->aacparse, data->faad, data->audio_convert, data->audiosink,
    NULL); gst_element_link(data->httpsrc, data->tsdemux);
    gst_element_link_many(data->queue_video, data->h264parse,
    data->h264dec, data->video_convert, data->videosink, NULL);
    gst_element_link_many(data->queue_audio, data->aacparse, data->faad,
    data->audio_convert, data->audiosink, NULL); if (error) { gchar
    *message = g_strdup_printf("Unable to build pipeline: %s",
    error->message); g_clear_error (&error); set_ui_message(message,
    data); g_free (message); return NULL; } [...] }

Thanks for your time,

Dani

El 18/05/16 a las 14:31, Sebastian Dröge escribió:
> On Di, 2016-05-17 at 11:12 +0200, Dani wrote:
>>   
>> So as this function is called, when it used to be a playbin, just by
>> adding the GST_STATE_READY and the g_object_set() for the uri worked
>> fine. Now I have a working pipeline with a checked .ts and it
>> initially works, but not when this function is called. The debug logs
>> for the location property gets changed but what happens is that the
>> app gets paused (no crash at all) with the outdated video. The
>> initially working pipeline -using gst_parse_launch()- is:
>>
>> souphttpsrc name=http_src location=http://192.168.0.32/videos/sintel.
>> ts ! queue ! tsdemux name=demux
>> demux. ! queue ! h264parse ! avdec_h264 ! videoconvert ! glimagesink
>> name=video_sink
>> demux. ! queue ! aacparse ! faad ! audioconvert ! autoaudiosink
>> name=audio_sink
>>
>>
>> The related log is:
>> [...]
> Can you get a full log? But in general, re-using gst_parse_launch()
> pipelines (that is, going back to READY/NULL and starting them again)
> is generally not working well. It's better to recreate the whole
> pipeline.
>
> If you want to re-use pipelines, you better build them manually instead
> and handle the linking of pads in your code.
>
>
>
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20160523/2c4ca81c/attachment.html>


More information about the gstreamer-devel mailing list