make 64bit atomics also align on 32bit (#2386)
do this by simply putting them at the front of each struct see https://pkg.go.dev/sync/atomic#pkg-note-BUG fixes #2383 Co-authored-by: akarl10 <mike@mwys.mine.bz>
This commit is contained in:
@@ -137,6 +137,10 @@ type ParticipantParams struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ParticipantImpl struct {
|
type ParticipantImpl struct {
|
||||||
|
// utils.TimedVersion is a atomic. To be correctly aligned also on 32bit archs
|
||||||
|
// 64it atomics need to be at the front of a struct
|
||||||
|
timedVersion utils.TimedVersion
|
||||||
|
|
||||||
params ParticipantParams
|
params ParticipantParams
|
||||||
|
|
||||||
isClosed atomic.Bool
|
isClosed atomic.Bool
|
||||||
@@ -200,7 +204,6 @@ type ParticipantImpl struct {
|
|||||||
|
|
||||||
dirty atomic.Bool
|
dirty atomic.Bool
|
||||||
version atomic.Uint32
|
version atomic.Uint32
|
||||||
timedVersion utils.TimedVersion
|
|
||||||
|
|
||||||
// callbacks & handlers
|
// callbacks & handlers
|
||||||
onTrackPublished func(types.LocalParticipant, types.MediaTrack)
|
onTrackPublished func(types.LocalParticipant, types.MediaTrack)
|
||||||
|
|||||||
+9
-5
@@ -80,6 +80,15 @@ type disconnectSignalOnResumeNoMessages struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Room struct {
|
type Room struct {
|
||||||
|
// atomics always need to be 64bit/8byte aligned
|
||||||
|
// on 32bit arch only the beginning of the struct
|
||||||
|
// starts at such a boundary.
|
||||||
|
// time the first participant joined the room
|
||||||
|
joinedAt atomic.Int64
|
||||||
|
// time that the last participant left the room
|
||||||
|
leftAt atomic.Int64
|
||||||
|
holds atomic.Int32
|
||||||
|
|
||||||
lock sync.RWMutex
|
lock sync.RWMutex
|
||||||
|
|
||||||
protoRoom *livekit.Room
|
protoRoom *livekit.Room
|
||||||
@@ -109,11 +118,6 @@ type Room struct {
|
|||||||
batchedUpdates map[livekit.ParticipantIdentity]*participantUpdate
|
batchedUpdates map[livekit.ParticipantIdentity]*participantUpdate
|
||||||
batchedUpdatesMu sync.Mutex
|
batchedUpdatesMu sync.Mutex
|
||||||
|
|
||||||
// time the first participant joined the room
|
|
||||||
joinedAt atomic.Int64
|
|
||||||
holds atomic.Int32
|
|
||||||
// time that the last participant left the room
|
|
||||||
leftAt atomic.Int64
|
|
||||||
closed chan struct{}
|
closed chan struct{}
|
||||||
|
|
||||||
trailer []byte
|
trailer []byte
|
||||||
|
|||||||
@@ -37,6 +37,10 @@ type UpTrackManagerParams struct {
|
|||||||
|
|
||||||
// UpTrackManager manages all uptracks from a participant
|
// UpTrackManager manages all uptracks from a participant
|
||||||
type UpTrackManager struct {
|
type UpTrackManager struct {
|
||||||
|
// utils.TimedVersion is a atomic. To be correctly aligned also on 32bit archs
|
||||||
|
// 64it atomics need to be at the front of a struct
|
||||||
|
subscriptionPermissionVersion utils.TimedVersion
|
||||||
|
|
||||||
params UpTrackManagerParams
|
params UpTrackManagerParams
|
||||||
|
|
||||||
closed bool
|
closed bool
|
||||||
@@ -44,7 +48,6 @@ type UpTrackManager struct {
|
|||||||
// publishedTracks that participant is publishing
|
// publishedTracks that participant is publishing
|
||||||
publishedTracks map[livekit.TrackID]types.MediaTrack
|
publishedTracks map[livekit.TrackID]types.MediaTrack
|
||||||
subscriptionPermission *livekit.SubscriptionPermission
|
subscriptionPermission *livekit.SubscriptionPermission
|
||||||
subscriptionPermissionVersion utils.TimedVersion
|
|
||||||
// subscriber permission for published tracks
|
// subscriber permission for published tracks
|
||||||
subscriberPermissions map[livekit.ParticipantIdentity]*livekit.TrackPermission // subscriberIdentity => *livekit.TrackPermission
|
subscriberPermissions map[livekit.ParticipantIdentity]*livekit.TrackPermission // subscriberIdentity => *livekit.TrackPermission
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user