Skip to content
Permalink
Browse files
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-base/-/merge_requests/1073>
  • Loading branch information
ystreet authored and GStreamer Marge Bot committed Mar 19, 2021
1 parent 00a7111 commit 98249a57dbd57dffbda12bfa9cb841fa41b28bbd
Showing with 71 additions and 71 deletions.
  1. +1 −1 ext/gl/gstgleffects.c
  2. +1 −1 ext/gl/gstglimagesink.h
  3. +5 −5 ext/opus/gstopusenc.c
  4. +1 −1 gst-libs/gst/audio/gstaudiodecoder.c
  5. +4 −4 gst-libs/gst/audio/gstaudiometa.c
  6. +1 −1 gst-libs/gst/audio/streamvolume.c
  7. +1 −1 gst-libs/gst/gl/cocoa/gstglcaopengllayer.m
  8. +1 −1 gst-libs/gst/gl/egl/gstgldisplay_egl.c
  9. +1 −1 gst-libs/gst/gl/gbm/gstgldisplay_gbm.c
  10. +2 −2 gst-libs/gst/gl/gl_mkenum.py
  11. +1 −1 gst-libs/gst/gl/gstglbasememory.c
  12. +1 −1 gst-libs/gst/gl/gstglbuffer.c
  13. +2 −2 gst-libs/gst/gl/gstglcontext.c
  14. +1 −1 gst-libs/gst/gl/gstgldebug.c
  15. +1 −1 gst-libs/gst/gl/gstgldisplay.c
  16. +1 −1 gst-libs/gst/gl/gstglfeature.c
  17. +1 −1 gst-libs/gst/gl/gstglmemory.c
  18. +1 −1 gst-libs/gst/gl/gstglmemorypbo.c
  19. +1 −1 gst-libs/gst/gl/gstglquery.c
  20. +1 −1 gst-libs/gst/gl/gstglrenderbuffer.c
  21. +1 −1 gst-libs/gst/gl/gstglsl.c
  22. +2 −2 gst-libs/gst/gl/gstglsyncmeta.c
  23. +2 −2 gst-libs/gst/gl/gstglutils.c
  24. +1 −1 gst-libs/gst/gl/gstglwindow.c
  25. +1 −1 gst-libs/gst/gl/wayland/wayland_event_source.c
  26. +4 −4 gst-libs/gst/pbutils/encoding-profile.c
  27. +1 −1 gst-libs/gst/pbutils/gstaudiovisualizer.c
  28. +1 −1 gst-libs/gst/rtp/gstrtpmeta.c
  29. +1 −1 gst-libs/gst/rtsp/gstrtspextension.c
  30. +1 −1 gst-libs/gst/tag/gsttagmux.c
  31. +1 −1 gst-libs/gst/tag/xmpwriter.c
  32. +1 −1 gst-libs/gst/video/gstvideoaffinetransformationmeta.c
  33. +4 −4 gst-libs/gst/video/gstvideoaggregator.c
  34. +1 −1 gst-libs/gst/video/gstvideodecoder.c
  35. +1 −1 gst-libs/gst/video/gstvideoencoder.c
  36. +5 −5 gst-libs/gst/video/gstvideometa.c
  37. +3 −3 gst-libs/gst/video/video-anc.c
  38. +1 −1 gst-libs/gst/video/video-hdr.c
  39. +2 −2 gst-libs/gst/video/video-multiview.c
  40. +1 −1 gst-libs/gst/video/video-overlay-composition.c
  41. +2 −2 gst/adder/gstadder.h
  42. +1 −1 gst/encoding/gstencodebasebin.c
  43. +2 −2 gst/playback/gstplay-enum.c
  44. +1 −1 gst/videorate/gstvideorate.h
  45. +1 −1 gst/videoscale/gstvideoscale.c
@@ -660,7 +660,7 @@ gst_gl_effects_filters_descriptors (void)
gboolean
gst_gl_effects_register_filters (GstPlugin * plugin, GstRank rank)
{
static volatile gsize registered = 0;
static gsize registered = 0;

if (g_once_init_enter (&registered)) {
GTypeInfo info = {
@@ -106,7 +106,7 @@ struct _GstGLImageSink
GstBuffer *next_sync;
GstGLSyncMeta *next_sync_meta;

volatile gint to_quit;
gint to_quit;
gboolean keep_aspect_ratio;
gint par_n, par_d;

@@ -80,7 +80,7 @@ gst_opus_enc_bandwidth_get_type (void)
{OPUS_AUTO, "Auto", "auto"},
{0, NULL, NULL}
};
static volatile GType id = 0;
static GType id = 0;

if (g_once_init_enter ((gsize *) & id)) {
GType _id;
@@ -106,7 +106,7 @@ gst_opus_enc_frame_size_get_type (void)
{60, "60", "60"},
{0, NULL, NULL}
};
static volatile GType id = 0;
static GType id = 0;

if (g_once_init_enter ((gsize *) & id)) {
GType _id;
@@ -130,7 +130,7 @@ gst_opus_enc_audio_type_get_type (void)
"restricted-lowdelay"},
{0, NULL, NULL}
};
static volatile GType id = 0;
static GType id = 0;

if (g_once_init_enter ((gsize *) & id)) {
GType _id;
@@ -153,7 +153,7 @@ gst_opus_enc_bitrate_type_get_type (void)
{BITRATE_TYPE_CONSTRAINED_VBR, "Constrained VBR", "constrained-vbr"},
{0, NULL, NULL}
};
static volatile GType id = 0;
static GType id = 0;

if (g_once_init_enter ((gsize *) & id)) {
GType _id;
@@ -819,7 +819,7 @@ gst_opus_enc_sink_event (GstAudioEncoder * benc, GstEvent * event)
static GstCaps *
gst_opus_enc_get_sink_template_caps (void)
{
static volatile gsize init = 0;
static gsize init = 0;
static GstCaps *caps = NULL;

if (g_once_init_enter (&init)) {
@@ -338,7 +338,7 @@ static void gst_audio_decoder_init (GstAudioDecoder * dec,
GType
gst_audio_decoder_get_type (void)
{
static volatile gsize audio_decoder_type = 0;
static gsize audio_decoder_type = 0;

if (g_once_init_enter (&audio_decoder_type)) {
GType _type;
@@ -177,7 +177,7 @@ gst_buffer_add_audio_downmix_meta (GstBuffer * buffer,
GType
gst_audio_downmix_meta_api_get_type (void)
{
static volatile GType type;
static GType type;
static const gchar *tags[] =
{ GST_META_TAG_AUDIO_STR, GST_META_TAG_AUDIO_CHANNELS_STR, NULL };

@@ -280,7 +280,7 @@ gst_buffer_add_audio_clipping_meta (GstBuffer * buffer,
GType
gst_audio_clipping_meta_api_get_type (void)
{
static volatile GType type;
static GType type;
static const gchar *tags[] =
{ GST_META_TAG_AUDIO_STR, GST_META_TAG_AUDIO_RATE_STR, NULL };

@@ -463,7 +463,7 @@ gst_buffer_add_audio_meta (GstBuffer * buffer, const GstAudioInfo * info,
GType
gst_audio_meta_api_get_type (void)
{
static volatile GType type;
static GType type;
static const gchar *tags[] = {
GST_META_TAG_AUDIO_STR, GST_META_TAG_AUDIO_CHANNELS_STR,
GST_META_TAG_AUDIO_RATE_STR, NULL
@@ -505,7 +505,7 @@ gst_audio_meta_get_info (void)
GType
gst_audio_level_meta_api_get_type (void)
{
static volatile GType type = 0;
static GType type = 0;
static const gchar *tags[] = { NULL };

if (g_once_init_enter (&type)) {
@@ -66,7 +66,7 @@ gst_stream_volume_class_init (GstStreamVolumeInterface * iface)
GType
gst_stream_volume_get_type (void)
{
static volatile gsize type = 0;
static gsize type = 0;
if (g_once_init_enter (&type)) {
GType tmp;
static const GTypeInfo info = {
@@ -33,7 +33,7 @@
static void
_init_debug (void)
{
static volatile gsize _init = 0;
static gsize _init = 0;

if (g_once_init_enter (&_init)) {
GST_DEBUG_CATEGORY_INIT(gst_gl_ca_opengl_layer_debug, "glcaopengllayer",
@@ -74,7 +74,7 @@ static guintptr gst_gl_display_egl_get_handle (GstGLDisplay * display);
static void
init_debug (void)
{
static volatile gsize _init = 0;
static gsize _init = 0;

if (g_once_init_enter (&_init)) {
GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "gldisplayegl", 0,
@@ -398,7 +398,7 @@ gst_gl_display_gbm_shutdown_gbm (GstGLDisplayGBM * display_gbm)
static void
_init_debug (void)
{
static volatile gsize _init = 0;
static gsize _init = 0;

if (g_once_init_enter (&_init)) {
GST_DEBUG_CATEGORY_GET (gst_gl_display_debug, "gldisplay");
@@ -22,11 +22,11 @@
'--fprod',
"\n/* enumerations from \"@basename@\" */",
'--vhead',
"GType\n@enum_name@_get_type (void)\n{\n static volatile gsize g_define_type_id__volatile = 0;\n if (g_once_init_enter (&g_define_type_id__volatile)) {\n static const G@Type@Value values[] = {",
"GType\n@enum_name@_get_type (void)\n{\n static gsize static_g_define_type_id = 0;\n if (g_once_init_enter (&static_g_define_type_id)) {\n static const G@Type@Value values[] = {",
'--vprod',
" { C_@TYPE@ (@VALUENAME@), \"@VALUENAME@\", \"@valuenick@\" },",
'--vtail',
" { 0, NULL, NULL }\n };\n GType g_define_type_id = g_@type@_register_static (\"@EnumName@\", values);\n g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);\n }\n return g_define_type_id__volatile;\n}\n"
" { 0, NULL, NULL }\n };\n GType g_define_type_id = g_@type@_register_static (\"@EnumName@\", values);\n g_once_init_leave (&static_g_define_type_id, g_define_type_id);\n }\n return static_g_define_type_id;\n}\n"
]

cmd = []
@@ -503,7 +503,7 @@ _mem_free (GstAllocator * allocator, GstMemory * memory)
void
gst_gl_base_memory_init_once (void)
{
static volatile gsize _init = 0;
static gsize _init = 0;

if (g_once_init_enter (&_init)) {
GST_DEBUG_CATEGORY_INIT (GST_CAT_GL_BASE_MEMORY, "glbasememory", 0,
@@ -457,7 +457,7 @@ gst_gl_buffer_allocator_init (GstGLBufferAllocator * allocator)
void
gst_gl_buffer_init_once (void)
{
static volatile gsize _init = 0;
static gsize _init = 0;

if (g_once_init_enter (&_init)) {
gst_gl_base_memory_init_once ();
@@ -150,7 +150,7 @@ load_self_module (gpointer user_data)
*/
struct ContextShareGroup
{
volatile int refcount;
int refcount;
};

static struct ContextShareGroup *
@@ -305,7 +305,7 @@ gst_gl_context_class_init (GstGLContextClass * klass)
static void
_init_debug (void)
{
static volatile gsize _init = 0;
static gsize _init = 0;

if (g_once_init_enter (&_init)) {
GST_DEBUG_CATEGORY_INIT (gst_gl_context_debug, "glcontext", 0,
@@ -105,7 +105,7 @@ GST_DEBUG_CATEGORY_STATIC (gst_gl_marker_debug);
static void
_init_debug (void)
{
static volatile gsize _init = 0;
static gsize _init = 0;

if (g_once_init_enter (&_init)) {
GST_DEBUG_CATEGORY_GET (gst_performance, "GST_PERFORMANCE");
@@ -277,7 +277,7 @@ gst_gl_display_new (void)
{
GstGLDisplay *display = NULL;
const gchar *user_choice, *platform_choice;
static volatile gsize _init = 0;
static gsize _init = 0;

if (g_once_init_enter (&_init)) {
GST_DEBUG_CATEGORY_INIT (gst_gl_display_debug, "gldisplay", 0,
@@ -43,7 +43,7 @@ GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
static void
_init_debug (void)
{
static volatile gsize _init = 0;
static gsize _init = 0;

if (g_once_init_enter (&_init)) {
GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "glfeature", 0,
@@ -1109,7 +1109,7 @@ gst_gl_memory_get_texture_id (GstGLMemory * gl_mem)
void
gst_gl_memory_init_once (void)
{
static volatile gsize _init = 0;
static gsize _init = 0;

if (g_once_init_enter (&_init)) {
gst_gl_base_memory_init_once ();
@@ -818,7 +818,7 @@ gst_gl_memory_pbo_upload_transfer (GstGLMemoryPBO * gl_mem)
void
gst_gl_memory_pbo_init_once (void)
{
static volatile gsize _init = 0;
static gsize _init = 0;

if (g_once_init_enter (&_init)) {
gst_gl_memory_init_once ();
@@ -58,7 +58,7 @@ GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
static void
_init_debug (void)
{
static volatile gsize _init = 0;
static gsize _init = 0;

if (g_once_init_enter (&_init)) {
GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "glquery", 0, "glquery element");
@@ -312,7 +312,7 @@ gst_gl_renderbuffer_get_id (GstGLRenderbuffer * gl_mem)
void
gst_gl_renderbuffer_init_once (void)
{
static volatile gsize _init = 0;
static gsize _init = 0;

if (g_once_init_enter (&_init)) {
gst_gl_base_memory_init_once ();
@@ -40,7 +40,7 @@ GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
static void
_init_debug (void)
{
static volatile gsize _init = 0;
static gsize _init = 0;

if (g_once_init_enter (&_init)) {
GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "glsl", 0,
@@ -333,7 +333,7 @@ static gboolean
_gst_gl_sync_meta_init (GstGLSyncMeta * sync_meta, gpointer params,
GstBuffer * buffer)
{
static volatile gsize _init;
static gsize _init;

if (g_once_init_enter (&_init)) {
GST_DEBUG_CATEGORY_INIT (gst_gl_sync_meta_debug, "glsyncmeta", 0,
@@ -359,7 +359,7 @@ _gst_gl_sync_meta_init (GstGLSyncMeta * sync_meta, gpointer params,
GType
gst_gl_sync_meta_api_get_type (void)
{
static volatile GType type = 0;
static GType type = 0;
static const gchar *tags[] = { NULL };

if (g_once_init_enter (&type)) {
@@ -56,7 +56,7 @@ GST_DEBUG_CATEGORY_STATIC (gst_gl_utils_debug);
static GstDebugCategory *
_init_gl_utils_debug_category (void)
{
static volatile gsize _init = 0;
static gsize _init = 0;

if (g_once_init_enter (&_init)) {
GST_DEBUG_CATEGORY_INIT (gst_gl_utils_debug, "glutils", 0,
@@ -87,7 +87,7 @@ static void
_init_context_debug (void)
{
#ifndef GST_DISABLE_GST_DEBUG
static volatile gsize _init = 0;
static gsize _init = 0;

if (g_once_init_enter (&_init)) {
GST_DEBUG_CATEGORY_GET (GST_CAT_CONTEXT, "GST_CONTEXT");
@@ -160,7 +160,7 @@ gst_gl_window_default_close (GstGLWindow * window)
static void
_init_debug (void)
{
static volatile gsize _init = 0;
static gsize _init = 0;

if (g_once_init_enter (&_init)) {
GST_DEBUG_CATEGORY_INIT (gst_gl_window_debug, "glwindow", 0,
@@ -45,7 +45,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, "glwaylandeventsource", 0,
@@ -360,9 +360,9 @@ gst_encoding_profile_class_intern_init (gpointer klass)
GType
gst_encoding_profile_get_type (void)
{
static volatile gsize g_define_type_id__volatile = 0;
static gsize g_define_type_id_init = 0;

if (g_once_init_enter (&g_define_type_id__volatile)) {
if (g_once_init_enter (&g_define_type_id_init)) {
GType g_define_type_id = g_type_register_static_simple (G_TYPE_OBJECT,
g_intern_static_string ("GstEncodingProfile"),
sizeof (GstEncodingProfileClass),
@@ -385,9 +385,9 @@ gst_encoding_profile_get_type (void)
/* Register gst-specific GValue functions */
gst_value_register (&gstvtable);

g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
g_once_init_leave (&g_define_type_id_init, g_define_type_id);
}
return g_define_type_id__volatile;
return g_define_type_id_init;
}


@@ -499,7 +499,7 @@ gst_audio_visualizer_change_shader (GstAudioVisualizer * scope)
GType
gst_audio_visualizer_get_type (void)
{
static volatile gsize audio_visualizer_type = 0;
static gsize audio_visualizer_type = 0;

if (g_once_init_enter (&audio_visualizer_type)) {
static const GTypeInfo audio_visualizer_info = {
@@ -190,7 +190,7 @@ gst_rtp_source_meta_append_csrc (GstRTPSourceMeta * meta, const guint32 * csrc,
GType
gst_rtp_source_meta_api_get_type (void)
{
static volatile GType type = 0;
static GType type = 0;
static const gchar *tags[] = { NULL };

if (g_once_init_enter (&type)) {
@@ -49,7 +49,7 @@ static guint gst_rtsp_extension_signals[LAST_SIGNAL] = { 0 };
GType
gst_rtsp_extension_get_type (void)
{
static volatile gsize gst_rtsp_extension_type = 0;
static gsize gst_rtsp_extension_type = 0;
static const GTypeInfo gst_rtsp_extension_info = {
sizeof (GstRTSPExtensionInterface),
(GBaseInitFunc) gst_rtsp_extension_iface_init,
@@ -90,7 +90,7 @@ static gboolean gst_tag_mux_sink_event (GstPad * pad, GstObject * parent,
GType
gst_tag_mux_get_type (void)
{
static volatile gsize tag_mux_type = 0;
static gsize tag_mux_type = 0;

if (g_once_init_enter (&tag_mux_type)) {
const GInterfaceInfo interface_info = { NULL, NULL, NULL };
@@ -53,7 +53,7 @@ typedef struct
GType
gst_tag_xmp_writer_get_type (void)
{
static volatile gsize xmp_config_type = 0;
static gsize xmp_config_type = 0;

if (g_once_init_enter (&xmp_config_type)) {
GType _type;
@@ -36,7 +36,7 @@
GType
gst_video_affine_transformation_meta_api_get_type (void)
{
static volatile GType type = 0;
static GType type = 0;
static const gchar *tags[] =
{ GST_META_TAG_VIDEO_STR, GST_META_TAG_VIDEO_ORIENTATION_STR,
GST_META_TAG_VIDEO_ORIENTATION_STR, NULL

0 comments on commit 98249a5

Please sign in to comment.