Skip to content

Commit d5e6437

Browse files
committed
Older Swift
1 parent 4fcd651 commit d5e6437

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

Sources/LiveKit/Agent/Chat/Receive/TranscriptionStreamReceiver.swift

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,17 +89,18 @@ actor TranscriptionStreamReceiver: MessageReceiver, Loggable {
8989
func messages() async throws -> AsyncStream<ReceivedMessage> {
9090
let (stream, continuation) = AsyncStream.makeStream(of: ReceivedMessage.self)
9191

92+
let topic = topic
93+
9294
try await room.registerTextStreamHandler(for: topic) { [weak self] reader, participantIdentity in
93-
guard let self else { return }
9495
for try await message in reader where !message.isEmpty {
96+
guard let self else { return }
9597
await continuation.yield(processIncoming(partialMessage: message, reader: reader, participantIdentity: participantIdentity))
9698
}
9799
}
98100

99-
continuation.onTermination = { [weak self] _ in
100-
Task {
101-
guard let self else { return }
102-
await self.room.unregisterTextStreamHandler(for: self.topic)
101+
continuation.onTermination = { _ in
102+
Task { [weak self] in
103+
await self?.room.unregisterTextStreamHandler(for: topic)
103104
}
104105
}
105106

Sources/LiveKit/Agent/LocalMedia.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ open class LocalMedia: ObservableObject {
9696
try await AudioManager.shared.setRecordingAlwaysPreparedMode(true)
9797
}
9898

99-
AudioManager.shared.onDeviceUpdate = { [weak self] _ in
100-
Task { @MainActor in
99+
AudioManager.shared.onDeviceUpdate = { _ in
100+
Task { @MainActor [weak self] in
101101
self?.audioDevices = AudioManager.shared.inputDevices
102102
self?.selectedAudioDeviceID = AudioManager.shared.defaultInputDevice.deviceId
103103
}

0 commit comments

Comments
 (0)