Skip to content

Commit

Permalink
#2489 Move isCollectingLocalStats to the statistics. Mark JitsiMeetJS…
Browse files Browse the repository at this point in the history
….isCollectingLocalStats as deprecated with warning to use Statistics.isCollectingLocalStats instead.
  • Loading branch information
Romick2005 committed Mar 26, 2024
1 parent a419b4e commit 61a58a0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
11 changes: 7 additions & 4 deletions JitsiMeetJS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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];

Expand Down Expand Up @@ -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();
},

/**
Expand Down
9 changes: 9 additions & 0 deletions modules/statistics/statistics.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down

0 comments on commit 61a58a0

Please sign in to comment.