mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-28 18:47:15 +02:00
Instead of specifying the sample rate, channel count/map, etc. to the PlaybackStream, we'll now use the output device's sample specification whenever possible. If necessary, the stream will fall back to sane default. This hugely simplifies AudioMixingSink, since it no longer has to take care of reinitializing the stream with a new sample specification when it encounters a track with a higher sample rate or more channels. We wouldn't be likely to benefit from this anyway, since it turns out that at least Windows's virtual surround doesn't work through WASAPI at all, and WASAPI likely wouldn't support downmixing. This commit breaks playback of audio files that don't match the system default audio device's sample rate and channel count. The next commit introduces a converter into the pipeline to allow mixing of any sample specification.
21 lines
607 B
C++
21 lines
607 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)
|
|
ErrorOr<NonnullRefPtr<PlaybackStream>> __attribute__((weak)) PlaybackStream::create(OutputState, u32, SampleSpecificationCallback&&, AudioDataRequestCallback&&)
|
|
#else
|
|
ErrorOr<NonnullRefPtr<PlaybackStream>> PlaybackStream::create(OutputState, u32, SampleSpecificationCallback&&, AudioDataRequestCallback&&)
|
|
#endif
|
|
{
|
|
return Error::from_string_literal("Audio output is not available for this platform");
|
|
}
|
|
|
|
}
|