gst: don't use volatile to mean atomic

volatile is not sufficient to provide atomic guarantees and real atomics
should be used instead.  GCC 11 has started warning about using volatile
with atomic operations.

https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1719

Discovered in https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/issues/868

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/911>
This commit is contained in:
Matthew Waters 2021-03-18 19:52:53 +11:00
parent 95ef0a1df8
commit 612102fdbc
14 changed files with 26 additions and 26 deletions

View file

@ -28,7 +28,7 @@
GType
gst_jack_connect_get_type (void)
{
static volatile gsize jack_connect_type = 0;
static gsize jack_connect_type = 0;
if (g_once_init_enter (&jack_connect_type)) {
static const GEnumValue jack_connect_enums[] = {
@ -50,7 +50,7 @@ gst_jack_connect_get_type (void)
GType
gst_jack_transport_get_type (void)
{
static volatile gsize type = 0;
static gsize type = 0;
if (g_once_init_enter (&type)) {
static const GFlagsValue flag_values[] = {
@ -84,7 +84,7 @@ gst_jack_client_free (gpointer jclient)
GType
gst_jack_client_get_type (void)
{
static volatile gsize jack_client_type = 0;
static gsize jack_client_type = 0;
if (g_once_init_enter (&jack_client_type)) {
/* hackish, but makes it show up nicely in gst-inspect */

View file

@ -131,7 +131,7 @@ gst_jack_audio_sink_free_channels (GstJackAudioSink * sink)
static GType
gst_jack_ring_buffer_get_type (void)
{
static volatile gsize ringbuffer_type = 0;
static gsize ringbuffer_type = 0;
if (g_once_init_enter (&ringbuffer_type)) {
static const GTypeInfo ringbuffer_info = {

View file

@ -151,7 +151,7 @@ gst_jack_audio_src_free_channels (GstJackAudioSrc * src)
static GType
gst_jack_ring_buffer_get_type (void)
{
static volatile gsize ringbuffer_type = 0;
static gsize ringbuffer_type = 0;
if (g_once_init_enter (&ringbuffer_type)) {
static const GTypeInfo ringbuffer_info = { sizeof (GstJackRingBufferClass),

View file

@ -72,7 +72,7 @@ struct _GstPulseSink
GstStructure *properties;
pa_proplist *proplist;
volatile gint format_lost;
gint format_lost;
GstClockTime format_lost_time;
};

View file

@ -35,7 +35,7 @@ GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
GstQSGTexture::GstQSGTexture ()
{
static volatile gsize _debug;
static gsize _debug;
initializeOpenGLFunctions();

View file

@ -66,7 +66,7 @@ gst_qt_get_gl_display ()
{
GstGLDisplay *display = NULL;
QGuiApplication *app = static_cast<QGuiApplication *> (QCoreApplication::instance ());
static volatile gsize _debug;
static gsize _debug;
g_assert (app != NULL);

View file

@ -22,7 +22,7 @@ GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
static void
init_debug (void)
{
static volatile gsize _debug;
static gsize _debug;
if (g_once_init_enter (&_debug)) {
GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "qtglrenderer", 0,
@ -115,7 +115,7 @@ typedef enum
struct SharedRenderData
{
volatile int refcount;
int refcount;
SharedRenderDataState state;
GMutex lock;
GCond cond;
@ -130,7 +130,7 @@ shared_render_data_new (void)
{
struct SharedRenderData *ret = g_new0 (struct SharedRenderData, 1);
ret->refcount = 1;
g_atomic_int_set (&ret->refcount, 1);
g_mutex_init (&ret->lock);
return ret;

View file

@ -112,7 +112,7 @@ void InitializeSceneGraph::run()
QtGLVideoItem::QtGLVideoItem()
{
static volatile gsize _debug;
static gsize _debug;
if (g_once_init_enter (&_debug)) {
GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "qtglwidget", 0, "Qt GL Widget");

View file

@ -103,7 +103,7 @@ QtGLWindow::QtGLWindow ( QWindow * parent, QQuickWindow *src ) :
QQuickWindow( parent ), source (src)
{
QGuiApplication *app = static_cast<QGuiApplication *> (QCoreApplication::instance ());
static volatile gsize _debug;
static gsize _debug;
g_assert (app != NULL);
@ -152,7 +152,7 @@ QtGLWindow::beforeRendering()
g_mutex_lock (&this->priv->lock);
static volatile gsize once = 0;
static gsize once = 0;
if (g_once_init_enter(&once)) {
this->priv->start = QDateTime::currentDateTime().toMSecsSinceEpoch();
g_once_init_leave(&once,1);

View file

@ -79,7 +79,7 @@ gst_vpx_dec_post_processing_flags_get_type (void)
{C_FLAGS (VP8_MFQE), "Multi-frame quality enhancement", "mfqe"},
{0, NULL, NULL}
};
static volatile GType id = 0;
static GType id = 0;
if (g_once_init_enter ((gsize *) & id)) {
GType _id;

View file

@ -169,7 +169,7 @@ gst_vpx_enc_end_usage_get_type (void)
{VPX_CQ, "Constant Quality Mode (CQ) mode", "cq"},
{0, NULL, NULL}
};
static volatile GType id = 0;
static GType id = 0;
if (g_once_init_enter ((gsize *) & id)) {
GType _id;
@ -192,7 +192,7 @@ gst_vpx_enc_multipass_mode_get_type (void)
{VPX_RC_LAST_PASS, "Last pass of multipass encoding", "last-pass"},
{0, NULL, NULL}
};
static volatile GType id = 0;
static GType id = 0;
if (g_once_init_enter ((gsize *) & id)) {
GType _id;
@ -214,7 +214,7 @@ gst_vpx_enc_kf_mode_get_type (void)
{VPX_KF_DISABLED, "Don't automatically place keyframes", "disabled"},
{0, NULL, NULL}
};
static volatile GType id = 0;
static GType id = 0;
if (g_once_init_enter ((gsize *) & id)) {
GType _id;
@ -236,7 +236,7 @@ gst_vpx_enc_tuning_get_type (void)
{VP8_TUNE_SSIM, "Tune for SSIM", "ssim"},
{0, NULL, NULL}
};
static volatile GType id = 0;
static GType id = 0;
if (g_once_init_enter ((gsize *) & id)) {
GType _id;
@ -260,7 +260,7 @@ gst_vpx_enc_scaling_mode_get_type (void)
{VP8E_ONETWO, "1:2", "1:2"},
{0, NULL, NULL}
};
static volatile GType id = 0;
static GType id = 0;
if (g_once_init_enter ((gsize *) & id)) {
GType _id;
@ -284,7 +284,7 @@ gst_vpx_enc_token_partitions_get_type (void)
{VP8_EIGHT_TOKENPARTITION, "Eight token partitions", "8"},
{0, NULL, NULL}
};
static volatile GType id = 0;
static GType id = 0;
if (g_once_init_enter ((gsize *) & id)) {
GType _id;
@ -307,7 +307,7 @@ gst_vpx_enc_er_flags_get_type (void)
"Allow partitions to be decoded independently", "partitions"},
{0, NULL, NULL}
};
static volatile GType id = 0;
static GType id = 0;
if (g_once_init_enter ((gsize *) & id)) {
GType _id;
@ -336,7 +336,7 @@ gst_vpx_enc_ts_layer_flags_get_type (void)
{VP8_EFLAG_NO_UPD_ENTROPY, "Disable entropy update", "no-upd-entropy"},
{0, NULL, NULL}
};
static volatile GType id = 0;
static GType id = 0;
if (g_once_init_enter ((gsize *) & id)) {
GType _id;

View file

@ -62,7 +62,7 @@ struct _GstAc3Parse {
gint blocks;
gboolean eac;
gboolean sent_codec_tag;
volatile gint align;
gint align;
GstPadChainFunction baseparse_chainfunc;
};

View file

@ -292,7 +292,7 @@ gst_rpi_cam_src_sensor_mode_get_type (void)
"640x480 4:3 60.1-90fps", "640x480-fast"},
{0, NULL, NULL}
};
static volatile GType id = 0;
static GType id = 0;
if (g_once_init_enter ((gsize *) & id)) {
GType _id;
_id = g_enum_register_static ("GstRpiCamSrcSensorMode", values);

View file

@ -26,7 +26,7 @@
GType
gst_meta_ximage_api_get_type (void)
{
static volatile GType type;
static GType type;
static const gchar *tags[] = { "memory", NULL };
if (g_once_init_enter (&type)) {