LibMedia: Note that PlaybackStream callbacks cannot run simultaneously

This is a requirement of implementations of PlaybackStream, so we
should have a little comment about it. Otherwise, we may encounter data
races later.
This commit is contained in:
Zaggy1024 2025-09-04 12:11:33 -05:00 committed by Tim Flynn
commit 33e97fa5d7
Notes: github-actions[bot] 2025-09-04 17:30:48 +00:00

View file

@ -34,8 +34,9 @@ public:
// //
// The initial_output_state parameter determines whether it will begin playback immediately. // The initial_output_state parameter determines whether it will begin playback immediately.
// //
// The AudioDataRequestCallback will be called when the Output needs more audio data to fill // The AudioDataRequestCallback will be called when the Output needs more audio data to fill its buffers and
// its buffers and continue playback. // continue playback. This callback will only be allowed to run on one thread at a time, to prevent any data
// race on the resource used by the callback.
static ErrorOr<NonnullRefPtr<PlaybackStream>> create(OutputState initial_output_state, u32 sample_rate, u8 channels, u32 target_latency_ms, AudioDataRequestCallback&&); static ErrorOr<NonnullRefPtr<PlaybackStream>> create(OutputState initial_output_state, u32 sample_rate, u8 channels, u32 target_latency_ms, AudioDataRequestCallback&&);
virtual ~PlaybackStream() = default; virtual ~PlaybackStream() = default;