sendonly: Don't assume we're building on UNIX

Fixes https://github.com/centricular/gstwebrtc-demos/issues/203
This commit is contained in:
Nirbheek Chauhan 2020-06-22 17:39:12 +05:30 committed by Matthew Waters
parent 751d06af6f
commit d44b2316fa
2 changed files with 16 additions and 10 deletions

View file

@ -1,9 +1,12 @@
#include <locale.h>
#include <glib.h>
#include <glib-unix.h>
#include <gst/gst.h>
#include <gst/sdp/sdp.h>
#ifdef G_OS_UNIX
#include <glib-unix.h>
#endif
#define GST_USE_UNSTABLE_API
#include <gst/webrtc/webrtc.h>
@ -50,8 +53,6 @@ void soup_websocket_handler (G_GNUC_UNUSED SoupServer * server,
static gchar *get_string_from_json_object (JsonObject * object);
gboolean exit_sighandler (gpointer user_data);
@ -649,7 +650,7 @@ get_string_from_json_object (JsonObject * object)
return text;
}
#ifdef G_OS_UNIX
gboolean
exit_sighandler (gpointer user_data)
{
@ -658,7 +659,7 @@ exit_sighandler (gpointer user_data)
g_main_loop_quit (mainloop);
return TRUE;
}
#endif
int
main (int argc, char *argv[])
@ -677,8 +678,10 @@ main (int argc, char *argv[])
mainloop = g_main_loop_new (NULL, FALSE);
g_assert (mainloop != NULL);
#ifdef G_OS_UNIX
g_unix_signal_add (SIGINT, exit_sighandler, mainloop);
g_unix_signal_add (SIGTERM, exit_sighandler, mainloop);
#endif
soup_server =
soup_server_new (SOUP_SERVER_SERVER_HEADER, "webrtc-soup-server", NULL);

View file

@ -1,9 +1,12 @@
#include <locale.h>
#include <glib.h>
#include <glib-unix.h>
#include <gst/gst.h>
#include <gst/sdp/sdp.h>
#ifdef G_OS_UNIX
#include <glib-unix.h>
#endif
#define GST_USE_UNSTABLE_API
#include <gst/webrtc/webrtc.h>
@ -42,8 +45,6 @@ void soup_websocket_handler (G_GNUC_UNUSED SoupServer * server,
static gchar *get_string_from_json_object (JsonObject * object);
gboolean exit_sighandler (gpointer user_data);
struct _ReceiverEntry
{
SoupWebsocketConnection *connection;
@ -531,7 +532,7 @@ get_string_from_json_object (JsonObject * object)
return text;
}
#ifdef G_OS_UNIX
gboolean
exit_sighandler (gpointer user_data)
{
@ -540,7 +541,7 @@ exit_sighandler (gpointer user_data)
g_main_loop_quit (mainloop);
return TRUE;
}
#endif
int
main (int argc, char *argv[])
@ -559,8 +560,10 @@ main (int argc, char *argv[])
mainloop = g_main_loop_new (NULL, FALSE);
g_assert (mainloop != NULL);
#ifdef G_OS_UNIX
g_unix_signal_add (SIGINT, exit_sighandler, mainloop);
g_unix_signal_add (SIGTERM, exit_sighandler, mainloop);
#endif
soup_server =
soup_server_new (SOUP_SERVER_SERVER_HEADER, "webrtc-soup-server", NULL);