Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/sharp-bikes-grab.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"client-sdk-android": minor
---

AudioOptions: Added disableAudioPrewarming flag
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023-2025 LiveKit, Inc.
* Copyright 2023-2026 LiveKit, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -140,6 +140,17 @@ class AudioOptions(
* Options for processing the mic and incoming audio.
*/
val audioProcessorOptions: AudioProcessorOptions? = null,

/**
* Devices may take some time initializing the audio stack for recording.
* Prewarming allows starting up the underlying audio recording prior to publish, letting
* the audio device be ready immediately when the track is fully published.
*
* If set to true, disables audio recording prewarming (and the related
* [LocalAudioTrack.prewarm] function), and audio resources are only used while the
* track is connected and published. Defaults to false.
*/
val disableAudioPrewarming: Boolean = false,
)

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023-2024 LiveKit, Inc.
* Copyright 2023-2026 LiveKit, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -55,6 +55,7 @@ object InjectionNames {
const val OVERRIDE_AUDIO_DEVICE_MODULE = "override_audio_device_module"
const val OVERRIDE_AUDIO_PROCESSOR_OPTIONS = "override_audio_processor_options"
const val OVERRIDE_JAVA_AUDIO_DEVICE_MODULE_CUSTOMIZER = "override_java_audio_device_module_customizer"
const val OVERRIDE_DISABLE_AUDIO_PREWARM = "override_disable_audio_prewarm"
const val OVERRIDE_VIDEO_ENCODER_FACTORY = "override_video_encoder_factory"
const val OVERRIDE_VIDEO_DECODER_FACTORY = "override_video_decoder_factory"
const val OVERRIDE_AUDIO_HANDLER = "override_audio_handler"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023-2024 LiveKit, Inc.
* Copyright 2023-2026 LiveKit, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -69,6 +69,10 @@ class OverridesModule(private val overrides: LiveKitOverrides) {
@Named(InjectionNames.OVERRIDE_AUDIO_OUTPUT_TYPE)
fun audioOutputType() = overrides.audioOptions?.audioOutputType

@Provides
@Named(InjectionNames.OVERRIDE_DISABLE_AUDIO_PREWARM)
fun disableAudioPrewarm() = overrides.audioOptions?.disableAudioPrewarming ?: false

@Provides
@Named(InjectionNames.OVERRIDE_PEER_CONNECTION_FACTORY_OPTIONS)
fun peerConnectionFactoryOptions() = overrides.peerConnectionFactoryOptions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,10 +250,17 @@ internal object RTCModule {
}

@Provides
fun audioPrewarmer(audioDeviceModule: AudioDeviceModule): AudioRecordPrewarmer {
return if (audioDeviceModule is JavaAudioDeviceModule) {
fun audioPrewarmer(
@Named(InjectionNames.OVERRIDE_DISABLE_AUDIO_PREWARM)
disableAudioPrewarm: Boolean,
audioDeviceModule: AudioDeviceModule,
): AudioRecordPrewarmer {
return if (disableAudioPrewarm) {
NoAudioRecordPrewarmer()
} else if (audioDeviceModule is JavaAudioDeviceModule) {
JavaAudioRecordPrewarmer(audioDeviceModule)
} else {
LKLog.w { "Custom audio device module detected. Audio record prewarming is not available." }
NoAudioRecordPrewarmer()
}
}
Expand Down
Loading