Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
hiroshihorie committed Feb 1, 2025
1 parent 56645a0 commit 735612d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Sources/LiveKit/Track/AudioManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ public extension AudioManager {
extension AudioManager {
func buildEngineObserverChain() -> (any AudioEngineObserver)? {
var objects = _state.engineObservers
guard objects.count > 1 else { return nil }
guard !objects.isEmpty else { return nil }

for i in 0 ..< objects.count - 1 {
objects[i].next = objects[i + 1]
Expand Down
6 changes: 4 additions & 2 deletions Tests/LiveKitTests/AudioEngineTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -282,9 +282,10 @@ class AudioEngineTests: XCTestCase {
}

final class SineWaveNodeHook: AudioEngineObserver {
var next: (any LiveKit.AudioEngineObserver)?

Check warning on line 285 in Tests/LiveKitTests/AudioEngineTests.swift

View workflow job for this annotation

GitHub Actions / test (macos-14, 15.4, macOS)

stored property 'next' of 'Sendable'-conforming class 'SineWaveNodeHook' is mutable

let sineWaveNode = SineWaveSourceNode()

func setNext(_: any LiveKit.AudioEngineObserver) {}
func engineDidCreate(_ engine: AVAudioEngine) {
engine.attach(sineWaveNode)
}
Expand All @@ -301,6 +302,8 @@ final class SineWaveNodeHook: AudioEngineObserver {
}

final class PlayerNodeHook: AudioEngineObserver {
var next: (any LiveKit.AudioEngineObserver)?

Check warning on line 305 in Tests/LiveKitTests/AudioEngineTests.swift

View workflow job for this annotation

GitHub Actions / test (macos-14, 15.4, macOS)

stored property 'next' of 'Sendable'-conforming class 'PlayerNodeHook' is mutable

public let playerNode = AVAudioPlayerNode()
public let playerMixerNode = AVAudioMixerNode()
public let playerNodeFormat: AVAudioFormat
Expand All @@ -309,7 +312,6 @@ final class PlayerNodeHook: AudioEngineObserver {
self.playerNodeFormat = playerNodeFormat
}

func setNext(_: any LiveKit.AudioEngineObserver) {}
public func engineDidCreate(_ engine: AVAudioEngine) {
engine.attach(playerNode)
engine.attach(playerMixerNode)
Expand Down

0 comments on commit 735612d

Please sign in to comment.