-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crash on incoming audio (0 Hz setting) #577
Comments
Thanks for the report, will investigate this one today. |
Hmm I can't reproduce it, but I have seen this when the AudioSession config was not correct. |
@hiroshihorie Yeah. I have this modified config initially copied from v2.0.8. Now, I see that it has been changed inside the SDK. AudioManager.shared.customConfigureAudioSessionFunc = { newState, oldState in
DispatchQueue.liveKitWebRTC.async { [weak self] in
guard let self else { return }
// prepare config
let configuration = LKRTCAudioSessionConfiguration.webRTC()
configuration.category = AVAudioSession.Category.playAndRecord.rawValue
configuration.mode = AVAudioSession.Mode.voiceChat.rawValue
configuration.categoryOptions = [
.allowBluetooth,
.duckOthers,
.defaultToSpeaker
]
var setActive: Bool?
if newState.trackState != .none, oldState.trackState == .none {
// activate audio session when there is any local/remote audio track
setActive = true
} else if newState.trackState == .none, oldState.trackState != .none {
// deactivate audio session when there are no more local/remote audio tracks
setActive = false
}
// configure session
let session = LKRTCAudioSession.sharedInstance()
session.lockForConfiguration()
// always unlock
defer { session.unlockForConfiguration() }
do {
if let setActive {
try session.setConfiguration(configuration, active: setActive)
} else {
try session.setConfiguration(configuration)
}
} catch {
self.print("Failed to configure audio session with error: \(error)")
}
}
} |
Ok that won't work, it must be sync not async. The new audio engine will now precisely invoke the method right before it starts, It's too late if it's async and the engine will fail to start. |
@hiroshihorie Got it! Thanks. But I do need to always have |
If you simply want playAndRecord all the time:
let session = AVAudioSession.sharedInstance()
try session.setCategory(.playAndRecord, mode: .voiceChat)
try session.setActive(true) Would that work for you ? |
Not really. Meanwhile, it works fine for me on v2.0.19 using the customConfigureAudioSessionFunc approach. Moreover, having The crash:
|
Describe the bug
Sometimes when I subscribe on an remote publication I get the crash:
Both listener and streamer are my local iOS devices connected to Xcode. I stream opus audio only.
As far as I understand this is because of
0 Hz
audio settings.SDK Version
v2.1.0
LiveKit Cloud
iOS/macOS Version
iOS 18.3
Xcode Version
Version 16.2 (16B5100e)
Steps to Reproduce
It happens randomly. I've never seen it before. I used an older version of the SDK (2.0.8). Probably, moving from background <-> foreground affects this.
What I'm doing is basically this:
Expected behavior
No crash
The text was updated successfully, but these errors were encountered: