Files
ladybird/Libraries/LibMedia/Audio/PlaybackStream.cpp
Zaggy1024 39d865b403 LibMedia: Provide new PlaybackStreams through promises
This allows us to avoid returning a PlaybackStream in cases where the
async initialization fails.

This is a step towards more graceful fallbacks when audio fails in
AudioMixingSink.
2026-03-21 23:11:47 -05:00

23 lines
634 B
C++

/*
* Copyright (c) 2023-2025, Gregory Bertilson <gregory@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include "PlaybackStream.h"
namespace Audio {
#if !defined(AK_OS_WINDOWS)
NonnullRefPtr<PlaybackStream::CreatePromise> __attribute__((weak)) PlaybackStream::create(OutputState, u32, AudioDataRequestCallback&&)
#else
NonnullRefPtr<PlaybackStream::CreatePromise> PlaybackStream::create(OutputState, u32, AudioDataRequestCallback&&)
#endif
{
auto promise = CreatePromise::construct();
promise->reject(Error::from_string_literal("Audio output is not available for this platform"));
return promise;
}
}