From 61a58a005a17768bf473ccac22651ac0d4b9d5b1 Mon Sep 17 00:00:00 2001 From: Roman Melnyk Date: Tue, 26 Mar 2024 12:43:04 +0200 Subject: [PATCH] #2489 Move isCollectingLocalStats to the statistics. Mark JitsiMeetJS.isCollectingLocalStats as deprecated with warning to use Statistics.isCollectingLocalStats instead. --- JitsiMeetJS.ts | 11 +++++++---- modules/statistics/statistics.js | 9 +++++++++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/JitsiMeetJS.ts b/JitsiMeetJS.ts index a9c7d21658..1541a4c5b0 100644 --- a/JitsiMeetJS.ts +++ b/JitsiMeetJS.ts @@ -24,7 +24,6 @@ import ProxyConnectionService from './modules/proxyconnection/ProxyConnectionService'; import recordingConstants from './modules/recording/recordingConstants'; import Settings from './modules/settings/Settings'; -import LocalStatsCollector from './modules/statistics/LocalStatsCollector'; import Statistics from './modules/statistics/statistics'; import ScriptUtil from './modules/util/ScriptUtil'; import * as VideoSIPGWConstants from './modules/videosipgw/VideoSIPGWConstants'; @@ -338,7 +337,7 @@ export default { 'success', getAnalyticsAttributesFromOptions(restOptions))); - if (this.isCollectingLocalStats()) { + if (Statistics.isCollectingLocalStats()) { for (let i = 0; i < tracks.length; i++) { const track = tracks[i]; @@ -512,10 +511,14 @@ export default { /** * Checks if local tracks can collect stats and collection is enabled. * - * @param {boolean} True if stats are being collected for local tracks. + * @returns {boolean} True if stats are being collected for local tracks. + * @deprecated use Statistics.isCollectingLocalStats instead */ isCollectingLocalStats() { - return Statistics.audioLevelsEnabled && LocalStatsCollector.isLocalStatsSupported(); + logger.warn('This method is deprecated, use ' + + 'Statistics.isCollectingLocalStats instead'); + + return Statistics.isCollectingLocalStats(); }, /** diff --git a/modules/statistics/statistics.js b/modules/statistics/statistics.js index 4748e4c5e4..1ecf2ce739 100644 --- a/modules/statistics/statistics.js +++ b/modules/statistics/statistics.js @@ -318,6 +318,15 @@ Statistics.stopLocalStats = function(track) { } }; +/** + * Checks if local tracks can collect stats and collection is enabled. + * + * @returns {boolean} True if stats are being collected for local tracks. + */ +Statistics.isCollectingLocalStats = function() { + return Statistics.audioLevelsEnabled && LocalStats.isLocalStatsSupported(); +}; + /** * Stops remote RTP stats for given peerconnection ID. * @param {string} tpcId {@link TraceablePeerConnection.id}