I'm trying to play udp stream using Gstreamer on android. (I've used this tutorial from the official Gstreamer website). I can play rtsp and https streams, but when I pass udp uri (like this: udp://@238.0.0.1:1234
) nothing happens (there is a black screen). In the log I have: Error received from element uridecodebin1: Your GStreamer installation is missing a plug-in.
I've found some documentation here about installing plugins, but I don't understand how to do that.
Here is the piece of the code I use:
data->context = g_main_context_new ();
g_main_context_push_thread_default (data->context);
/* Build pipeline */
data->pipeline = gst_parse_launch ("playbin", &error);
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;
}
and the 2nd one:
/* 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 gchar *char_uri = (*env)->GetStringUTFChars (env, uri, NULL);
GST_DEBUG ("Setting URI to %s", char_uri);
if (data->target_state >= GST_STATE_READY)
gst_element_set_state (data->pipeline, GST_STATE_READY);
g_object_set (data->pipeline, "uri", char_uri, NULL);
(*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);
}
Full code is here
This is the first thing I'm doing in C and JNI, so I would be grateful for working code snippet.
Ok, I've accidentaly found the solution. I just modified my Android.mk
file by adding $(GSTREAMER_PLUGINS_CODECS_RESTRICTED)
into GSTREAMER_PLUGINS
line. Now udp streams works fine!