diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2018-09-24 19:25:28 +0530 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2018-09-24 19:44:28 +0530 |
commit | d002cd33d377075bcfd1b04b09edd3687c79ae3a (patch) | |
tree | 8d6e65a6f2b664345317331ddd9b525163453ca0 | |
parent | dc29bc4e13ea1c25b1179efe362dd5b2bc071fd5 (diff) | |
download | gst-plugins-base-d002cd33d377075bcfd1b04b09edd3687c79ae3a.tar.gz gst-plugins-base-d002cd33d377075bcfd1b04b09edd3687c79ae3a.tar.xz |
gstaudioutilsprivate: Fix warnings while setting thread priority
Also use G_OS_WIN32 instead of _WIN32 for clarity.
-rw-r--r-- | gst-libs/gst/audio/gstaudioutilsprivate.c | 27 | ||||
-rw-r--r-- | gst-libs/gst/audio/gstaudioutilsprivate.h | 2 |
2 files changed, 16 insertions, 13 deletions
diff --git a/gst-libs/gst/audio/gstaudioutilsprivate.c b/gst-libs/gst/audio/gstaudioutilsprivate.c index cb3935c3c..5034975dc 100644 --- a/gst-libs/gst/audio/gstaudioutilsprivate.c +++ b/gst-libs/gst/audio/gstaudioutilsprivate.c @@ -23,11 +23,11 @@ #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 } diff --git a/gst-libs/gst/audio/gstaudioutilsprivate.h b/gst-libs/gst/audio/gstaudioutilsprivate.h index b9db8d802..4e2b61a5c 100644 --- a/gst-libs/gst/audio/gstaudioutilsprivate.h +++ b/gst-libs/gst/audio/gstaudioutilsprivate.h @@ -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 |