From 66866249a2699c46fb06d749f97bae2bc073c732 Mon Sep 17 00:00:00 2001 From: Frank Praznik Date: Wed, 2 Feb 2022 11:09:02 -0500 Subject: [PATCH] audio: pipewire: Condition variable doesn't need to be atomic The condition variable is guarded by a mutex, so no need for it to be atomic. --- src/audio/pipewire/SDL_pipewire.c | 4 ++-- src/audio/pipewire/SDL_pipewire.h | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/audio/pipewire/SDL_pipewire.c b/src/audio/pipewire/SDL_pipewire.c index 5c6e10495..9c3d0b2cd 100644 --- a/src/audio/pipewire/SDL_pipewire.c +++ b/src/audio/pipewire/SDL_pipewire.c @@ -1012,7 +1012,7 @@ stream_state_changed_callback(void *data, enum pw_stream_state old, enum pw_stre _THIS = data; if (state == PW_STREAM_STATE_STREAMING || state == PW_STREAM_STATE_ERROR) { - SDL_AtomicSet(&this->hidden->stream_initialized, 1); + this->hidden->stream_initialized = 1; PIPEWIRE_pw_thread_loop_signal(this->hidden->loop, false); } } @@ -1167,7 +1167,7 @@ PIPEWIRE_OpenDevice(_THIS, const char *devname) /* Wait until the stream is either running or failed */ PIPEWIRE_pw_thread_loop_lock(priv->loop); - if (!SDL_AtomicGet(&priv->stream_initialized)) { + if (!priv->stream_initialized) { PIPEWIRE_pw_thread_loop_wait(priv->loop); } PIPEWIRE_pw_thread_loop_unlock(priv->loop); diff --git a/src/audio/pipewire/SDL_pipewire.h b/src/audio/pipewire/SDL_pipewire.h index 731a2027f..ba7d6fc30 100644 --- a/src/audio/pipewire/SDL_pipewire.h +++ b/src/audio/pipewire/SDL_pipewire.h @@ -37,9 +37,9 @@ struct SDL_PrivateAudioData struct pw_context *context; struct SDL_DataQueue *buffer; - size_t buffer_period_size; - Sint32 stride; /* Bytes-per-frame */ - SDL_atomic_t stream_initialized; + size_t buffer_period_size; + Sint32 stride; /* Bytes-per-frame */ + int stream_initialized; }; #endif /* SDL_pipewire_h_ */