From beda14db4d9d74ce97f8fdda4e1e54bc5934c8d2 Mon Sep 17 00:00:00 2001 From: Hiroshi Horie <548776+hiroshihorie@users.noreply.github.com> Date: Tue, 28 Nov 2023 08:40:22 +0900 Subject: [PATCH] fix: pass report stats option for simplified api --- Sources/LiveKit/Participant/LocalParticipant.swift | 9 ++++++--- Sources/LiveKit/Track/Local/LocalAudioTrack.swift | 5 +++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Sources/LiveKit/Participant/LocalParticipant.swift b/Sources/LiveKit/Participant/LocalParticipant.swift index eee5606d9..a47c9a47e 100644 --- a/Sources/LiveKit/Participant/LocalParticipant.swift +++ b/Sources/LiveKit/Participant/LocalParticipant.swift @@ -506,10 +506,12 @@ public extension LocalParticipant { } else if enabled { // Try to create a new track if source == .camera { - let localTrack = LocalVideoTrack.createCameraTrack(options: (captureOptions as? CameraCaptureOptions) ?? room._state.options.defaultCameraCaptureOptions) + let localTrack = LocalVideoTrack.createCameraTrack(options: (captureOptions as? CameraCaptureOptions) ?? room._state.options.defaultCameraCaptureOptions, + reportStatistics: room._state.options.reportRemoteTrackStatistics) return try await publish(videoTrack: localTrack, publishOptions: publishOptions as? VideoPublishOptions) } else if source == .microphone { - let localTrack = LocalAudioTrack.createTrack(options: (captureOptions as? AudioCaptureOptions) ?? room._state.options.defaultAudioCaptureOptions) + let localTrack = LocalAudioTrack.createTrack(options: (captureOptions as? AudioCaptureOptions) ?? room._state.options.defaultAudioCaptureOptions, + reportStatistics: room._state.options.reportRemoteTrackStatistics) return try await publish(audioTrack: localTrack, publishOptions: publishOptions as? AudioPublishOptions) } else if source == .screenShareVideo { #if os(iOS) @@ -533,7 +535,8 @@ public extension LocalParticipant { if #available(macOS 12.3, *) { let mainDisplay = try await MacOSScreenCapturer.mainDisplaySource() let track = LocalVideoTrack.createMacOSScreenShareTrack(source: mainDisplay, - options: (captureOptions as? ScreenShareCaptureOptions) ?? self.room._state.options.defaultScreenShareCaptureOptions) + options: (captureOptions as? ScreenShareCaptureOptions) ?? self.room._state.options.defaultScreenShareCaptureOptions, + reportStatistics: room._state.options.reportRemoteTrackStatistics) return try await publish(videoTrack: track, publishOptions: publishOptions as? VideoPublishOptions) } #endif diff --git a/Sources/LiveKit/Track/Local/LocalAudioTrack.swift b/Sources/LiveKit/Track/Local/LocalAudioTrack.swift index 0a2790f0b..f8199cc00 100644 --- a/Sources/LiveKit/Track/Local/LocalAudioTrack.swift +++ b/Sources/LiveKit/Track/Local/LocalAudioTrack.swift @@ -33,7 +33,8 @@ public class LocalAudioTrack: Track, LocalTrack, AudioTrack { } public static func createTrack(name: String = Track.microphoneName, - options: AudioCaptureOptions? = nil) -> LocalAudioTrack + options: AudioCaptureOptions? = nil, + reportStatistics: Bool = false) -> LocalAudioTrack { let options = options ?? AudioCaptureOptions() @@ -57,7 +58,7 @@ public class LocalAudioTrack: Track, LocalTrack, AudioTrack { return LocalAudioTrack(name: name, source: .microphone, track: rtcTrack, - reportStatistics: true) + reportStatistics: reportStatistics) } @discardableResult