From fa6034a426f762391d832476c5d2bb61b6beb722 Mon Sep 17 00:00:00 2001 From: QuentinArguillere Date: Wed, 16 Oct 2024 18:34:33 +0200 Subject: [PATCH] Add LossRate and JitterBufferSize to call stats --- .../CallStatisticsSheetBottomSheet.swift | 15 +++++++++++++++ Linphone/UI/Call/Model/CallStatsModel.swift | 16 ++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/Linphone/UI/Call/Fragments/CallStatisticsSheetBottomSheet.swift b/Linphone/UI/Call/Fragments/CallStatisticsSheetBottomSheet.swift index 3b94f53b5..0ec6bd92e 100644 --- a/Linphone/UI/Call/Fragments/CallStatisticsSheetBottomSheet.swift +++ b/Linphone/UI/Call/Fragments/CallStatisticsSheetBottomSheet.swift @@ -66,6 +66,16 @@ struct CallStatisticsSheetBottomSheet: View { Spacer() + Text(callViewModel.callStatsModel.audioLossRate) + .default_text_style_white(styleSize: 15) + + Spacer() + + Text(callViewModel.callStatsModel.audioJitterBufferSize) + .default_text_style_white(styleSize: 15) + + Spacer() + if callViewModel.callStatsModel.isVideoEnabled { Text("Vidéo") .default_text_style_white_600(styleSize: 15) @@ -83,6 +93,11 @@ struct CallStatisticsSheetBottomSheet: View { Spacer() + Text(callViewModel.callStatsModel.videoLossRate) + .default_text_style_white(styleSize: 15) + + Spacer() + Text(callViewModel.callStatsModel.videoResolution) .default_text_style_white(styleSize: 15) diff --git a/Linphone/UI/Call/Model/CallStatsModel.swift b/Linphone/UI/Call/Model/CallStatsModel.swift index 605cb95cb..7e19cfe62 100644 --- a/Linphone/UI/Call/Model/CallStatsModel.swift +++ b/Linphone/UI/Call/Model/CallStatsModel.swift @@ -25,10 +25,13 @@ class CallStatsModel: ObservableObject { @Published var audioCodec = "" @Published var audioBandwidth = "" + @Published var audioLossRate = "" + @Published var audioJitterBufferSize = "" @Published var isVideoEnabled = false @Published var videoCodec = "" @Published var videoBandwidth = "" + @Published var videoLossRate = "" @Published var videoResolution = "" @Published var videoFps = "" @@ -52,9 +55,17 @@ class CallStatsModel: ObservableObject { let downloadBandwidth = Int(stats.downloadBandwidth.rounded()) let bandwidthLabel = "Bandwidth: " + "↑ \(uploadBandwidth) kbits/s ↓ \(downloadBandwidth) kbits/s" + let senderLossRate = Int(stats.senderLossRate.rounded()) + let receiverLossRate = Int(stats.receiverLossRate.rounded()) + let lossRateLabel = "Lossrate: ↑ \(senderLossRate)% ↓ \(receiverLossRate)%" + + let jitterBufferSize = Int(stats.jitterBufferSizeMs.rounded()) + let jitterBufferSizeLabel = "Jitter buffer: \(jitterBufferSize)ms" DispatchQueue.main.async { self.audioCodec = codecLabel self.audioBandwidth = bandwidthLabel + self.audioLossRate = lossRateLabel + self.audioJitterBufferSize = jitterBufferSizeLabel } } case .Video: @@ -72,6 +83,10 @@ class CallStatsModel: ObservableObject { let downloadBandwidth = Int(stats.downloadBandwidth.rounded()) let bandwidthLabel = "Bandwidth: " + "↑ \(uploadBandwidth) kbits/s ↓ \(downloadBandwidth) kbits/s" + let senderLossRate = Int(stats.senderLossRate.rounded()) + let receiverLossRate = Int(stats.receiverLossRate.rounded()) + let lossRateLabel = "Lossrate: ↑ \(senderLossRate)% ↓ \(receiverLossRate)%" + let sentResolution = call.currentParams!.sentVideoDefinition!.name let receivedResolution = call.currentParams!.receivedVideoDefinition!.name let resolutionLabel = "Resolution: " + "↑ \(sentResolution!) ↓ \(receivedResolution!)" @@ -83,6 +98,7 @@ class CallStatsModel: ObservableObject { DispatchQueue.main.async { self.videoCodec = codecLabel self.videoBandwidth = bandwidthLabel + self.videoLossRate = lossRateLabel self.videoResolution = resolutionLabel self.videoFps = fpsLabel }