Check for all necessary plugins at startup

People seem to be having problems ensuring that they have all the
right plugins built, so make it a bit easier for them.
This commit is contained in:
Nirbheek Chauhan 2018-03-10 01:54:48 +05:30
parent fa2adc717b
commit 55e86469d9
2 changed files with 54 additions and 0 deletions

View file

@ -893,6 +893,30 @@ connect_to_websocket_server_async (void)
app_state = SERVER_CONNECTING;
}
static gboolean
check_plugins (void)
{
int i;
gboolean ret;
GstPlugin *plugin;
GstRegistry *registry;
const gchar *needed[] = { "opus", "nice", "webrtc", "dtls", "srtp"
"rtpmanager", "audiotestsrc", NULL};
registry = gst_registry_get ();
ret = TRUE;
for (i = 0; i < g_strv_length ((gchar **) needed); i++) {
plugin = gst_registry_find_plugin (registry, needed[i]);
if (!plugin) {
g_print ("Required gstreamer plugin '%s' not found\n", needed[i]);
ret = FALSE;
continue;
}
gst_object_unref (plugin);
}
return ret;
}
int
main (int argc, char *argv[])
{
@ -908,6 +932,9 @@ main (int argc, char *argv[])
return -1;
}
if (!check_plugins ())
return -1;
if (!room_id) {
g_printerr ("--room-id is a required argument\n");
return -1;

View file

@ -568,6 +568,30 @@ connect_to_websocket_server_async (void)
app_state = SERVER_CONNECTING;
}
static gboolean
check_plugins (void)
{
int i;
gboolean ret;
GstPlugin *plugin;
GstRegistry *registry;
const gchar *needed[] = { "opus", "vpx", "nice", "webrtc", "dtls", "srtp",
"rtpmanager", "videotestsrc", "audiotestsrc", NULL};
registry = gst_registry_get ();
ret = TRUE;
for (i = 0; i < g_strv_length ((gchar **) needed); i++) {
plugin = gst_registry_find_plugin (registry, needed[i]);
if (!plugin) {
g_print ("Required gstreamer plugin '%s' not found\n", needed[i]);
ret = FALSE;
continue;
}
gst_object_unref (plugin);
}
return ret;
}
int
main (int argc, char *argv[])
{
@ -583,6 +607,9 @@ main (int argc, char *argv[])
return -1;
}
if (!check_plugins ())
return -1;
if (!peer_id) {
g_printerr ("--peer-id is a required argument\n");
return -1;