gstaudioutilsprivate: Fix warnings while setting thread priority
authorNirbheek Chauhan <nirbheek@centricular.com>
Mon, 24 Sep 2018 13:55:28 +0000 (19:25 +0530)
committerNirbheek Chauhan <nirbheek@centricular.com>
Mon, 24 Sep 2018 14:14:28 +0000 (19:44 +0530)
Also use G_OS_WIN32 instead of _WIN32 for clarity.

gst-libs/gst/audio/gstaudioutilsprivate.c
gst-libs/gst/audio/gstaudioutilsprivate.h

index cb3935c..5034975 100644 (file)
 #include "config.h"
 #endif
 
-#ifdef _WIN32
+#include <gst/audio/audio.h>
+#ifdef G_OS_WIN32
 #include <windows.h>
 #endif
 
-#include <gst/audio/audio.h>
 #include "gstaudioutilsprivate.h"
 
 /*
@@ -217,15 +217,15 @@ exit:
   return res;
 }
 
-#ifdef _WIN32
+#ifdef G_OS_WIN32
 /* *INDENT-OFF* */
 static struct
 {
   HMODULE dll;
   gboolean tried_loading;
 
-    HANDLE (WINAPI * AvSetMmThreadCharacteristics) (LPCSTR, LPDWORD);
-    BOOL (WINAPI * AvRevertMmThreadCharacteristics) (HANDLE);
+  FARPROC AvSetMmThreadCharacteristics;
+  FARPROC AvRevertMmThreadCharacteristics;
 } _gst_audio_avrt_tbl = { 0 };
 /* *INDENT-ON* */
 #endif
@@ -233,7 +233,7 @@ static struct
 static gboolean
 __gst_audio_init_thread_priority (void)
 {
-#ifdef _WIN32
+#ifdef G_OS_WIN32
   if (_gst_audio_avrt_tbl.tried_loading)
     return _gst_audio_avrt_tbl.dll != NULL;
 
@@ -261,19 +261,22 @@ __gst_audio_init_thread_priority (void)
 /*
  * Increases the priority of the thread it's called from
  */
-gpointer
+gboolean
 __gst_audio_set_thread_priority (void)
 {
+#ifdef G_OS_WIN32
+  DWORD taskIndex = 0;
+#endif
+
   if (!__gst_audio_init_thread_priority ())
-    return NULL;
+    return FALSE;
 
-#ifdef _WIN32
-  DWORD taskIndex = 0;
+#ifdef G_OS_WIN32
   /* This is only used from ringbuffer thread functions, so we don't need to
    * ever need to revert the thread priorities. */
   return _gst_audio_avrt_tbl.AvSetMmThreadCharacteristics (TEXT ("Pro Audio"),
-      &taskIndex);
+      &taskIndex) != 0;
 #else
-  return NULL;
+  return TRUE;
 #endif
 }
index b9db8d8..4e2b61a 100644 (file)
@@ -43,7 +43,7 @@ gboolean __gst_audio_encoded_audio_convert (GstAudioInfo * fmt, gint64 bytes,
                                             gint64 * dest_value);
 
 G_GNUC_INTERNAL
-gpointer __gst_audio_set_thread_priority   (void);
+gboolean __gst_audio_set_thread_priority   (void);
 
 G_END_DECLS