Skip to content

Mark _muted and _disposed as volatile in RtcAudioSource#227

Merged
MaxHeimbrock merged 1 commit intomainfrom
max/fix-audio-source-volatile
Apr 10, 2026
Merged

Mark _muted and _disposed as volatile in RtcAudioSource#227
MaxHeimbrock merged 1 commit intomainfrom
max/fix-audio-source-volatile

Conversation

@MaxHeimbrock
Copy link
Copy Markdown
Contributor

Background

These fields are written on the main thread (SetMute, Dispose) and read on the audio callback thread (OnAudioRead). Without volatile, the audio thread may not see updates promptly. Volatile forces the value to be read from memory instead of potentially the CPU cache.

Changes

What did you do?

  • mark _muted and _disposed as volatile

These fields are written on the main thread (SetMute, Dispose)
and read on the audio callback thread (OnAudioRead). Without
volatile, the audio thread may not see updates promptly.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@MaxHeimbrock MaxHeimbrock marked this pull request as ready for review April 10, 2026 13:12
@MaxHeimbrock MaxHeimbrock merged commit 1d65ec2 into main Apr 10, 2026
12 of 13 checks passed
@MaxHeimbrock MaxHeimbrock deleted the max/fix-audio-source-volatile branch April 10, 2026 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant