-
Notifications
You must be signed in to change notification settings - Fork 28
Enhancement/hifi implementation #919
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
base: develop
Are you sure you want to change the base?
Conversation
Generated by 🚫 Danger |
Public Interface open class StreamAudioFilterProcessingModule: RTCDefaultAudioProcessingModule, AudioProcessingModule, @unchecked Sendable
- public var activeAudioFilter: AudioFilter?
+ public var isHiFiEnabled: Bool
-
+ public var activeAudioFilter: AudioFilter?
-
+
- public init(config: RTCAudioProcessingConfig? = nil,capturePostProcessingDelegate: AudioFilterCapturePostProcessingModule = StreamAudioFilterCapturePostProcessingModule(),renderPreProcessingDelegate: RTCAudioCustomProcessingDelegate? = nil)
+
-
+ public init(config: RTCAudioProcessingConfig? = nil,capturePostProcessingDelegate: AudioFilterCapturePostProcessingModule = StreamAudioFilterCapturePostProcessingModule(),renderPreProcessingDelegate: RTCAudioCustomProcessingDelegate? = nil)
-
+
- override public func apply(_ config: RTCAudioProcessingConfig)
+
- public func setAudioFilter(_ filter: AudioFilter?)
+ override public func apply(_ config: RTCAudioProcessingConfig)
+ public func setAudioFilter(_ filter: AudioFilter?)
public final class MicrophoneManager: ObservableObject, CallSettingsManager, @unchecked Sendable
- public func disable()async throws
+ public func disable()async throws
+ public func setHiFiEnabled(_ isEnabled: Bool)async
open class StreamAudioFilterCapturePostProcessingModule: NSObject, AudioFilterCapturePostProcessingModule, @unchecked Sendable
- public private var audioFilter: AudioFilter?
+ public var isHiFiEnabled: Bool
- public private var sampleRate: Int
+ public private var audioFilter: AudioFilter?
- public private var channels: Int
+ public private var sampleRate: Int
-
+ public private var channels: Int
-
+
- override public init()
+
-
+ override public init()
-
+
- open func setAudioFilter(_ audioFilter: AudioFilter?)
+
- open func audioProcessingInitialize(sampleRate sampleRateHz: Int,channels: Int)
+ open func setAudioFilter(_ audioFilter: AudioFilter?)
- open func audioProcessingProcess(audioBuffer: RTCAudioBuffer)
+ open func audioProcessingInitialize(sampleRate sampleRateHz: Int,channels: Int)
- open func audioProcessingRelease()
+ open func audioProcessingProcess(audioBuffer: RTCAudioBuffer)
+ open func audioProcessingRelease() |
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.
Pull Request Overview
This PR implements HiFi (High-Fidelity) audio support by exposing audio media constraints configuration throughout the WebRTC stack. The implementation allows disabling iOS audio processing features like echo cancellation and noise suppression to preserve original audio quality.
Key changes:
- Added HiFi audio constraints that disable audio processing features for high-quality audio capture
- Introduced a PeerConnectionFactory protocol to abstract peer connection creation and support better testing
- Exposed setHiFiEnabled API through MicrophoneManager for public consumption
Reviewed Changes
Copilot reviewed 54 out of 54 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
Sources/StreamVideo/WebRTC/DefaultRTCMediaConstraints.swift | Added HiFi audio constraints with disabled processing features |
Sources/StreamVideo/CallSettings/MicrophoneManager.swift | Added public setHiFiEnabled API for controlling HiFi audio mode |
Sources/StreamVideo/Controllers/CallController.swift | Added internal setHiFiEnabled method that delegates to WebRTC coordinator |
Sources/StreamVideo/WebRTC/v2/WebRTCCoordinator.swift | Added setHiFiEnabled method to configure audio constraints |
Sources/StreamVideo/WebRTC/v2/WebRTCStateAdapter.swift | Added audioMediaConstraints property and setAudioMediaConstraints method |
Sources/StreamVideo/WebRTC/PeerConnectionFactory/PeerConnectionFactory.swift | Added PeerConnectionFactory protocol for better abstraction |
StreamVideoTests/Mock/MockPeerConnectionFactory.swift | Created MockPeerConnectionFactory implementing the new protocol |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
@@ -82,6 +82,9 @@ actor WebRTCStateAdapter: ObservableObject, StreamAudioSessionAdapterDelegate { | |||
|
|||
// Various private and internal properties. | |||
private(set) var initialCallSettings: CallSettings? | |||
/// The current audio media constraints used for audio track creation. | |||
/// Defaults to standard constraints with audio processing enabled. |
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.
The comment should clarify that this property affects only newly created audio tracks, not existing ones. Consider adding a note about when constraints are applied.
/// Defaults to standard constraints with audio processing enabled. | |
/// Note: This property only affects newly created audio tracks; changing it does not impact existing tracks. | |
/// Constraints are applied only at the time an audio track is created. Defaults to standard constraints with audio processing enabled. |
Copilot uses AI. Check for mistakes.
@@ -464,6 +490,68 @@ final class WebRTCStateAdapter_Tests: XCTestCase, @unchecked Sendable { | |||
XCTAssertEqual(mockPublisher.timesCalled(.beginScreenSharing), 0) | |||
} | |||
|
|||
func test_configurePeerConnections_defaultAudioMediaConstraints_publisherWasConfiguredWithCorrectAudioeMediaConstraints( |
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.
There's a typo in the function name: 'AudioeMediaConstraints' should be 'AudioMediaConstraints'.
func test_configurePeerConnections_defaultAudioMediaConstraints_publisherWasConfiguredWithCorrectAudioeMediaConstraints( | |
func test_configurePeerConnections_defaultAudioMediaConstraints_publisherWasConfiguredWithCorrectAudioMediaConstraints( |
Copilot uses AI. Check for mistakes.
XCTAssertEqual(publisherRecordedInput.audioMediaConstraints, .defaultConstraints) | ||
} | ||
|
||
func test_configurePeerConnections_HiFiAudioMediaConstraints_publisherWasConfiguredWithCorrectAudioeMediaConstraints( |
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.
There's a typo in the function name: 'AudioeMediaConstraints' should be 'AudioMediaConstraints'.
func test_configurePeerConnections_HiFiAudioMediaConstraints_publisherWasConfiguredWithCorrectAudioeMediaConstraints( | |
func test_configurePeerConnections_HiFiAudioMediaConstraints_publisherWasConfiguredWithCorrectAudioMediaConstraints( |
Copilot uses AI. Check for mistakes.
SDK Size
|
|
🔗 Issue Links
Resolves https://linear.app/stream/issue/VID-798/disable-ios-audio-processing-by-exposing-sethifienabled
🎯 Goal
Allow enabling/disabling HiFi audio.
🛠 Implementation
Provide a detailed description of the implementation and explain your decisions if you find them relevant.
🎨 Showcase
Add relevant screenshots and/or videos/gifs to easily see what this PR changes, if applicable.
img
img
🧪 Manual Testing Notes
Explain how this change can be tested manually, if applicable.
☑️ Contributor Checklist