[vlc-commits] aout: convert to standard atomic ops
Rémi Denis-Courmont
git at videolan.org
Thu Dec 13 17:57:37 CET 2012
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Dec 13 18:47:58 2012 +0200| [17d2ca87e661f1761bcaddc8773e070de2b54cf5] | committer: Rémi Denis-Courmont
aout: convert to standard atomic ops
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=17d2ca87e661f1761bcaddc8773e070de2b54cf5
---
src/audio_output/aout_internal.h | 2 +-
src/audio_output/dec.c | 13 +++++--------
2 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/src/audio_output/aout_internal.h b/src/audio_output/aout_internal.h
index 785a193..f05cb84 100644
--- a/src/audio_output/aout_internal.h
+++ b/src/audio_output/aout_internal.h
@@ -75,7 +75,7 @@ typedef struct
bool recycle_vout;
atomic_uint buffers_lost;
- vlc_atomic_t restart;
+ atomic_uchar restart;
} aout_owner_t;
typedef struct
diff --git a/src/audio_output/dec.c b/src/audio_output/dec.c
index 3dccce6..ad31ae4 100644
--- a/src/audio_output/dec.c
+++ b/src/audio_output/dec.c
@@ -33,7 +33,6 @@
#include <vlc_common.h>
#include <vlc_aout.h>
#include <vlc_input.h>
-#include <vlc_atomic.h>
#include "aout_internal.h"
#include "libvlc.h"
@@ -76,7 +75,7 @@ int aout_DecNew( audio_output_t *p_aout,
/* Create the audio output stream */
owner->volume = aout_volume_New (p_aout, p_replay_gain);
- vlc_atomic_set (&owner->restart, 0);
+ atomic_store (&owner->restart, 0);
owner->input_format = *p_format;
owner->mixer_format = owner->input_format;
@@ -129,11 +128,9 @@ static int aout_CheckReady (audio_output_t *aout)
aout_assert_locked (aout);
- int restart = vlc_atomic_swap (&owner->restart, 0);
+ int restart = atomic_exchange (&owner->restart, 0);
if (unlikely(restart))
{
- assert (restart & AOUT_RESTART_INPUT);
-
const aout_request_vout_t request_vout = owner->request_vout;
aout_FiltersDelete (aout);
@@ -168,8 +165,8 @@ static void aout_RequestRestart (audio_output_t *aout)
{
aout_owner_t *owner = aout_owner (aout);
- /* DO NOT remove AOUT_RESTART_INPUT. You need to change the atomic ops. */
- vlc_atomic_set (&owner->restart, AOUT_RESTART_OUTPUT|AOUT_RESTART_INPUT);
+ /* NOTE: restarting output requires restarting input. */
+ atomic_fetch_or (&owner->restart, AOUT_RESTART_OUTPUT);
}
int aout_ChannelsRestart (vlc_object_t *obj, const char *varname,
@@ -196,7 +193,7 @@ void aout_InputRequestRestart (audio_output_t *aout)
{
aout_owner_t *owner = aout_owner (aout);
- vlc_atomic_compare_swap (&owner->restart, 0, AOUT_RESTART_INPUT);
+ atomic_fetch_or (&owner->restart, AOUT_RESTART_INPUT);
}
More information about the vlc-commits
mailing list