From 27bed62e66acf4269f4236036850fa1d77807999 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 13 Dec 2023 12:10:18 +0100 Subject: [PATCH] audioconvert: avoid bitfield data races Move the driver and warned bits after the int field in the struct so that they are placed in separate memory. Otherwise, a write from the data thread might race with a write from the main thread and leave the bits in the wrong state. --- spa/plugins/audioconvert/audioadapter.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/spa/plugins/audioconvert/audioadapter.c b/spa/plugins/audioconvert/audioadapter.c index 6c97af46a..4b04f08f8 100644 --- a/spa/plugins/audioconvert/audioadapter.c +++ b/spa/plugins/audioconvert/audioadapter.c @@ -89,13 +89,14 @@ struct impl { unsigned int add_listener:1; unsigned int have_format:1; unsigned int started:1; - unsigned int warned:1; unsigned int ready:1; - unsigned int driver:1; unsigned int async:1; unsigned int passthrough:1; unsigned int follower_removing:1; unsigned int in_recalc; + + unsigned int warned:1; + unsigned int driver:1; }; /** \endcond */