refactor: improve background streaming handler by optimizing active stream management
- Removed unnecessary clearing of active streams in the Android implementation, allowing for more efficient management of stream IDs. - Updated iOS implementation to use formUnion and formIntersection for better handling of active and microphone streams, enhancing performance and clarity in stream management. - Ensured that microphone activation only occurs when there are active microphone streams, improving resource utilization.
This commit is contained in:
@@ -130,9 +130,13 @@ class BackgroundStreamingHandler: NSObject {
|
||||
}
|
||||
|
||||
private func startBackgroundExecution(streamIds: [String], requiresMic: Bool) {
|
||||
activeStreams = Set(streamIds)
|
||||
activeStreams.formUnion(streamIds)
|
||||
microphoneStreams.formIntersection(activeStreams)
|
||||
if requiresMic {
|
||||
microphoneStreams = microphoneStreams.union(streamIds)
|
||||
microphoneStreams.formUnion(streamIds)
|
||||
}
|
||||
|
||||
if !microphoneStreams.isEmpty {
|
||||
VoiceBackgroundAudioManager.shared.activate()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user