Merge pull request from overte-org/fix/audio_lock2

Initialize AudioClient properties earlier.
This commit is contained in:
ksuprynowicz 2025-03-24 19:40:18 +01:00 committed by GitHub
commit 371eb74723
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -320,6 +320,18 @@ AudioClient::AudioClient() {
// avoid putting a lock in the device callback
assert(_localSamplesAvailable.is_lock_free());
// Set up the desired audio format, since scripting API expects it to be set and audio scripting API
// is initialized before audio thread starts.
_desiredInputFormat.setSampleRate(AudioConstants::SAMPLE_RATE);
_desiredInputFormat.setSampleSize(16);
_desiredInputFormat.setCodec("audio/pcm");
_desiredInputFormat.setSampleType(QAudioFormat::SignedInt);
_desiredInputFormat.setByteOrder(QAudioFormat::LittleEndian);
_desiredInputFormat.setChannelCount(1);
_desiredOutputFormat = _desiredInputFormat;
_desiredOutputFormat.setChannelCount(OUTPUT_CHANNEL_COUNT);
// deprecate legacy settings
{
Setting::Handle<int>::Deprecated("maxFramesOverDesired", InboundAudioStream::MAX_FRAMES_OVER_DESIRED);