[vlc-devel] [PATCH 7/8] aout: stream: remove atomic
Thomas Guillem
thomas at gllm.fr
Fri Mar 8 17:24:45 CET 2019
Since this variable is always read/write from the same thread now.
---
src/audio_output/aout_internal.h | 2 +-
src/audio_output/stream.c | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/audio_output/aout_internal.h b/src/audio_output/aout_internal.h
index 71b2224a3e..ccdbd967b0 100644
--- a/src/audio_output/aout_internal.h
+++ b/src/audio_output/aout_internal.h
@@ -95,7 +95,7 @@ typedef struct
atomic_uint buffers_lost;
atomic_uint buffers_played;
- atomic_uchar restart;
+ unsigned restart_flag;
} aout_owner_t;
typedef struct
diff --git a/src/audio_output/stream.c b/src/audio_output/stream.c
index 8c7975450c..0dae4d3116 100644
--- a/src/audio_output/stream.c
+++ b/src/audio_output/stream.c
@@ -78,7 +78,7 @@ int aout_StreamStart(audio_output_t *p_aout, const audio_sample_format_t *p_form
/* Create the audio output stream */
owner->volume = aout_volume_New (p_aout, p_replay_gain);
- atomic_store_explicit(&owner->restart, 0, memory_order_relaxed);
+ owner->restart_flag = 0;
owner->input_format = *p_format;
owner->mixer_format = owner->input_format;
owner->sync.clock = clock;
@@ -135,8 +135,8 @@ static int aout_CheckReady (audio_output_t *aout)
aout_owner_t *owner = aout_owner (aout);
int status = AOUT_DEC_SUCCESS;
- int restart = atomic_exchange_explicit(&owner->restart, 0,
- memory_order_acquire);
+ int restart = owner->restart_flag;
+ owner->restart_flag = 0;
if (unlikely(restart))
{
if (owner->mixer_format.i_format)
@@ -193,7 +193,7 @@ static int aout_CheckReady (audio_output_t *aout)
void aout_StreamRestart (audio_output_t *aout, unsigned mode)
{
aout_owner_t *owner = aout_owner (aout);
- atomic_fetch_or_explicit(&owner->restart, mode, memory_order_release);
+ owner->restart_flag = mode;
msg_Dbg (aout, "restart requested (%u)", mode);
}
--
2.20.1
More information about the vlc-devel
mailing list