-
Notifications
You must be signed in to change notification settings - Fork 121
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:
|
I checked also the example app on macCatalyst with LiveKit version 2.2.1 and there bug also exist there.
|
@kalavski Does this happen when simply enabling the mic ? |
I used LiveKit example app from your repository and from what I see it is just enabling the mic, nothing more.
|
@kalavski Thanks... that's odd I can't reproduce it. Thank you for your information, this helps debugging this issue. |
@hiroshihorie Thank you for your help. There is one thing that I changed in example app environment and it is a multipath capabilities. I removed that capability from the project. Yes, it happens every time I tap mic button. Mac version: MacBook Pro with M1 Pro There is nothing connected to my Mac. |
@kalavski The Multipath Entitlement ? I don't think it's related. Do you remember if the mic permission dialog appeared ? Is this granted ? |
@hiroshihorie Yes, the permission is granted. And I checked one more thing in my settings and I had virtual input device selected as a microphone and that cause the issue. So all is good rn. |
@kalavski Okay, good to know it works now. However, it shouldn’t crash, and I’m working on a patch. |
@hiroshihorie I don't know if this is connected to that issue but I still have similar crash.
It happens when I connect to the existing room on iPad app. |
@kalavski Hmm this is odd only iPad ? is this simulator or device ? Anything unique to your setup ? |
@hiroshihorie I reproduced it only on iPad. On iPhone and macCatalyst all is good rn. |
@kalavski is this simulator or device ? Anything unique to your setup ? |
@hiroshihorie Just iPad device.
This is how I make connection to server. |
@kalavski If you can reproduce it on iPad, can you show me the SDK logs ? |
WebRTC patches: webrtc-sdk/webrtc@4a5ac4c webrtc-sdk/webrtc@b1074f3 webrtc-sdk/webrtc@0b84894 Possibly related to: #577
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: