changing souphttpsrc location property on android

Dani dmr.dev.rdp at gmail.com
Tue May 17 09:12:14 UTC 2016


Hi everyone,
I am trying to change the location uri for the souphttpsrc on android 
and this is the code I have written (based on tutorial5 for android):

    /* Set playbin2's URI */ void gst_native_set_uri (JNIEnv* env,
    jobject thiz, jstring uri) { CustomData *data = GET_CUSTOM_DATA
    (env, thiz, custom_data_field_id); if (!data || !data->pipeline)
    return; const jbyte *char_uri = (*env)->GetStringUTFChars (env, uri,
    NULL); GstElement *http_src;//mod gchar *location;//mod gchar
    *next_location = g_strdup(char_uri); http_src = gst_bin_get_by_name
    (GST_BIN(data->pipeline), "http_src");//mod
    if(!http_src)//modGST_DEBUG("GstElement http_src ERROR!");//mod
    else//mod GST_DEBUG("GstElement http_src OK");//mod GST_DEBUG
    ("Setting URI to %s", char_uri); /*This the modified part of the
    function*/ data->target_state = GST_STATE_READY;//mod
    gst_element_set_state(data->pipeline, GST_STATE_READY);//mod
    GST_DEBUG("Pipeline state: READY");//mod
    g_object_get(G_OBJECT(http_src), "location", &location, NULL);//mod
    g_print("Current http-src location: %s", location);//mod
    g_object_set(G_OBJECT(http_src), "location", char_uri, NULL);//mod
    g_object_get(G_OBJECT(http_src), "location", &location, NULL);//mod
    g_print("Current http-src location: %s", location);//mod
    data->target_state = GST_STATE_PLAYING;//mod
    gst_element_set_state(data->pipeline, GST_STATE_PLAYING);//mod
    GST_DEBUG("Pipeline state: PLAYING");//mod gst_object_unref
    (http_src);//mod /*End of modified code*/
    (*env)->ReleaseStringUTFChars (env, uri, char_uri); data->duration =
    GST_CLOCK_TIME_NONE; data->is_live = (gst_element_set_state
    (data->pipeline, data->target_state) == GST_STATE_CHANGE_NO_PREROLL); }


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:

    05-17 11:04:54.500 19858-19924/com.sample.app W/GStreamer+basesrc:
    0:00:11.130733339 0x9e012490
    gstbasesrc.c:2943:gst_base_src_loop:<http_src> error: Internal data
    flow error.
    05-17 11:04:54.500 19858-19924/com.sample.app W/GStreamer+basesrc:
    0:00:11.130925589 0x9e012490
    gstbasesrc.c:2943:gst_base_src_loop:<http_src> error: streaming task
    paused, reason not-negotiated (-4)
    05-17 11:04:54.500 19858-19924/com.sample.app W/GStreamer+queue:
    0:00:11.131194839 0x9e012490
    gstqueue.c:968:gst_queue_handle_sink_event:<queue3> error: Internal
    data flow error.
    05-17 11:04:54.500 19858-19924/com.sample.app W/GStreamer+queue:
    0:00:11.131370672 0x9e012490
    gstqueue.c:968:gst_queue_handle_sink_event:<queue3> error: streaming
    task paused, reason not-negotiated (-4)

Can anyone give a clue for what I am missing?

Thanks in advance,

Dani
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20160517/e460c85d/attachment.html>


More information about the gstreamer-devel mailing list