sendonly: Don't assume we're building on UNIX
authorNirbheek Chauhan <nirbheek@centricular.com>
Mon, 22 Jun 2020 12:09:12 +0000 (17:39 +0530)
committerMatthew Waters <matthew@centricular.com>
Thu, 25 Jun 2020 08:36:18 +0000 (18:36 +1000)
Fixes https://github.com/centricular/gstwebrtc-demos/issues/203

webrtc/sendonly/webrtc-recvonly-h264.c
webrtc/sendonly/webrtc-unidirectional-h264.c

index 9ba7fe4..87b24f2 100644 (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);
index 4887c7e..b806014 100644 (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);