-
Notifications
You must be signed in to change notification settings - Fork 28
[Enhancement]Improved audio session management #906
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
[Enhancement]Improved audio session management #906
Conversation
SDK Size
|
Public Interface+ extension RTCAudioSession
+
+ case isActive
+ case category
+ case mode
+ case useManualAudio
+ case isAudioEnabled
+ case device
+ case deviceIsExternal = "device.isExternal"
+ case deviceIsSpeaker = "device.isSpeaker"
+ case deviceIsReceiver = "device.isReceiver"
+
+
+ public func encode(to encoder: Encoder)throws
public enum ApplicationState: String, Sendable, Equatable
- case foreground, background
+ case unknown, foreground, background |
Generated by 🚫 Danger |
9dd1d4d
to
0ae3530
Compare
0ae3530
to
d5c90bf
Compare
Sources/StreamVideo/Utils/AudioSession/StreamAudioSession.swift
Outdated
Show resolved
Hide resolved
Public Interface public enum ApplicationState: String, Sendable, Equatable
- case foreground, background
+ case unknown, foreground, background
- public struct AudioSessionConfiguration: ReflectiveStringConvertible, Equatable
+ public struct AudioSessionConfiguration: ReflectiveStringConvertible, Equatable, Sendable
public class Call: @unchecked Sendable, WSEventsSubscriber
- public func updateAudioSessionPolicy(_ policy: AudioSessionPolicy)async throws
+ public func updateAudioSessionPolicy(_ policy: AudioSessionPolicy)async |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really nice implementation! Left few minor comments, and let's test this extensively.
Sources/StreamVideo/WebRTC/v2/StateMachine/Stages/WebRTCCoordinator+Joined.swift
Show resolved
Hide resolved
@@ -124,15 +124,7 @@ actor WebRTCStateAdapter: ObservableObject, StreamAudioSessionAdapterDelegate { | |||
self.rtcPeerConnectionCoordinatorFactory = rtcPeerConnectionCoordinatorFactory | |||
self.videoCaptureSessionProvider = videoCaptureSessionProvider | |||
self.screenShareSessionProvider = screenShareSessionProvider | |||
self.audioSession = .init(audioDeviceModule: peerConnectionFactory.audioDeviceModule) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should test audio filters and noise cancellation after these changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Audio filters shouldn't be affected as they are running directly in the WebRTC audio device module pipeline (which is the lower lever of the AudioSession we are using). In any case we should test them
.../StreamVideo/Utils/AudioSession/RTCAudioStore/Effects/RTCAudioStore+InterruptionEffect.swift
Show resolved
Hide resolved
b7a8c95
to
9b20956
Compare
8d31967
to
3a21a9d
Compare
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! ✅
🔗 Issue Links
Resolves https://linear.app/stream/issue/IOS-1046/audio-issues
🎯 Goal
Provide a consistent and centralised way for managing AudioSession updates across SDK Components and Calls.
🛠 Implementation
This revision introduces
RTCAudioStore
which is meant to be the control centre for AudioSession for the SDK, completely abstracting AVAudioSession and RTCAudioSession. The reason for this abstraction is that AVAudioSessionManagement and CallKit require things to happen in serial order. This order is whatRTCAudioStore
offers.The architecture is Redux-based with 2 main Reducers (RTCAudioSessionReducer and CallKitAudioSessionReducer). Each of them is responsible with interacting with one external component (in this case RTCAudioSession and CallKit).
☑️ Contributor Checklist