1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-11 18:20:43 +09:00

LibAudio: Ensure that Serenity playback streams are always stereo

The Serenity AudioServer assumes that all audio is stereo, so we
cannot output audio with a channel count other than 2.
This commit is contained in:
Zaggy1024 2023-11-11 20:30:11 -06:00 committed by Andreas Kling
parent d64ffb1b9b
commit f9068c7f2e
Notes: sideshowbarker 2024-07-17 07:11:12 +09:00

View file

@ -10,8 +10,12 @@
namespace Audio {
ErrorOr<NonnullRefPtr<PlaybackStream>> PlaybackStreamSerenity::create(OutputState initial_state, u32 sample_rate, [[maybe_unused]] u8 channels, [[maybe_unused]] u32 target_latency_ms, AudioDataRequestCallback&& data_request_callback)
ErrorOr<NonnullRefPtr<PlaybackStream>> PlaybackStreamSerenity::create(OutputState initial_state, u32 sample_rate, u8 channels, [[maybe_unused]] u32 target_latency_ms, AudioDataRequestCallback&& data_request_callback)
{
// ConnectionToServer can only handle stereo audio currently. If it is able to accept mono audio
// later, this can be removed.
VERIFY(channels == 2);
VERIFY(data_request_callback);
auto connection = TRY(ConnectionToServer::try_create());
if (auto result = connection->try_set_self_sample_rate(sample_rate); result.is_error())