#include "gstwasapisink.h"
+#include <avrt.h>
+
GST_DEBUG_CATEGORY_STATIC (gst_wasapi_sink_debug);
#define GST_CAT_DEFAULT gst_wasapi_sink_debug
gst_audio_ring_buffer_set_channel_positions (GST_AUDIO_BASE_SINK
(self)->ringbuffer, self->positions);
+#if defined(_MSC_VER) || defined(GST_FORCE_WIN_AVRT)
+ /* Increase the thread priority to reduce glitches */
+ {
+ DWORD taskIndex = 0;
+ self->thread_priority_handle =
+ AvSetMmThreadCharacteristics (TEXT ("Pro Audio"), &taskIndex);
+ }
+#endif
+
res = TRUE;
beach:
if (self->sharemode == AUDCLNT_SHAREMODE_EXCLUSIVE)
CoUninitialize ();
+#if defined(_MSC_VER) || defined(GST_FORCE_WIN_AVRT)
+ if (self->thread_priority_handle != NULL) {
+ AvRevertMmThreadCharacteristics (self->thread_priority_handle);
+ self->thread_priority_handle = NULL;
+ }
+#endif
+
if (self->client != NULL) {
IAudioClient_Stop (self->client);
}
IAudioClient *client;
IAudioRenderClient *render_client;
HANDLE event_handle;
+ HANDLE thread_priority_handle;
/* Actual size of the allocated buffer */
guint buffer_frame_count;
#include "gstwasapisrc.h"
+#include <avrt.h>
+
GST_DEBUG_CATEGORY_STATIC (gst_wasapi_src_debug);
#define GST_CAT_DEFAULT gst_wasapi_src_debug
gst_audio_ring_buffer_set_channel_positions (GST_AUDIO_BASE_SRC
(self)->ringbuffer, self->positions);
+#if defined(_MSC_VER) || defined(GST_FORCE_WIN_AVRT)
+ /* Increase the thread priority to reduce glitches */
+ {
+ DWORD taskIndex = 0;
+ self->thread_priority_handle =
+ AvSetMmThreadCharacteristics (TEXT ("Pro Audio"), &taskIndex);
+ }
+#endif
+
res = TRUE;
beach:
if (self->sharemode == AUDCLNT_SHAREMODE_EXCLUSIVE)
CoUninitialize ();
+#if defined(_MSC_VER) || defined(GST_FORCE_WIN_AVRT)
+ if (self->thread_priority_handle != NULL) {
+ AvRevertMmThreadCharacteristics (self->thread_priority_handle);
+ self->thread_priority_handle = NULL;
+ }
+#endif
+
if (self->client != NULL) {
IAudioClient_Stop (self->client);
}
guint64 client_clock_freq;
IAudioCaptureClient *capture_client;
HANDLE event_handle;
+ HANDLE thread_priority_handle;
/* Actual size of the allocated buffer */
guint buffer_frame_count;