Skip to content

Commit 801518a

Browse files
committed
ref(stats) Delete Jvb121EventGenerator class.
Use JitsiConferenceEvents._MEDIA_SESSION_ACTIVE_CHANGED event instead to trigger JVB stats reset.
1 parent 819cdfb commit 801518a

File tree

5 files changed

+7
-89
lines changed

5 files changed

+7
-89
lines changed

JitsiConference.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import VADNoiseDetection from './modules/detection/VADNoiseDetection';
2828
import VADTalkMutedDetection from './modules/detection/VADTalkMutedDetection';
2929
import { E2EEncryption } from './modules/e2ee/E2EEncryption';
3030
import E2ePing from './modules/e2eping/e2eping';
31-
import Jvb121EventGenerator from './modules/event/Jvb121EventGenerator';
3231
import FeatureFlags from './modules/flags/FeatureFlags';
3332
import { LiteModeContext } from './modules/litemode/LiteModeContext';
3433
import { QualityController } from './modules/qualitycontrol/QualityController';
@@ -316,7 +315,6 @@ export default class JitsiConference extends Listenable {
316315
public rtc?: RTC;
317316
public qualityController?: QualityController;
318317
public statistics?: Statistics;
319-
public jvb121Status?: Jvb121EventGenerator;
320318
public p2pDominantSpeakerDetection?: P2PDominantSpeakerDetection;
321319
public authIdentity?: string;
322320
public p2pEstablishmentDuration?: number;
@@ -735,12 +733,6 @@ export default class JitsiConference extends Listenable {
735733
this.setLastN(config.channelLastN);
736734
}
737735

738-
/**
739-
* Emits {@link JitsiConferenceEvents.JVB121_STATUS}.
740-
* @type {Jvb121EventGenerator}
741-
*/
742-
this.jvb121Status = new Jvb121EventGenerator(this);
743-
744736
// creates dominant speaker detection that works only in p2p mode
745737
this.p2pDominantSpeakerDetection = new P2PDominantSpeakerDetection(this);
746738

JitsiConferenceEvents.spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ describe( "/JitsiConferenceEvents members", () => {
3737
expect( JitsiConferenceEvents.FILE_SHARING_FILES_RECEIVED ).toBe( 'conference.file_sharing.files_received' );
3838
expect( JitsiConferenceEvents.FILE_SHARING_FILE_ADDED ).toBe( 'conference.file_sharing.file_added' );
3939
expect( JitsiConferenceEvents.FILE_SHARING_FILE_REMOVED ).toBe( 'conference.file_sharing.file_removed' );
40-
expect( JitsiConferenceEvents.JVB121_STATUS ).toBe( 'conference.jvb121Status' );
4140
expect( JitsiConferenceEvents.KICKED ).toBe( 'conference.kicked' );
4241
expect( JitsiConferenceEvents.PARTICIPANT_KICKED ).toBe( 'conference.participant_kicked' );
4342
expect( JitsiConferenceEvents.LAST_N_ENDPOINTS_CHANGED ).toBe( 'conference.lastNEndpointsChanged' );

JitsiConferenceEvents.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -227,20 +227,6 @@ export enum JitsiConferenceEvents {
227227
*/
228228
FORWARDED_SOURCES_CHANGED = 'conference.forwardedSourcesChanged',
229229

230-
/**
231-
* NOTE This is lib-jitsi-meet internal event and can be removed at any time !
232-
*
233-
* Event emitted when conference transits, between one to one and multiparty JVB
234-
* conference. If the conference switches to P2P it's neither one to one nor
235-
* a multiparty JVB conference, but P2P (the status argument of this event will
236-
* be <tt>false</tt>).
237-
*
238-
* The first argument is a boolean which carries the previous value and
239-
* the seconds argument is a boolean with the new status. The event is emitted
240-
* only if the previous and the new values are different.
241-
*/
242-
JVB121_STATUS = 'conference.jvb121Status',
243-
244230
/**
245231
* You are kicked from the conference.
246232
* @param {JitsiParticipant} the participant that initiated the kick.

modules/event/Jvb121EventGenerator.ts

Lines changed: 0 additions & 58 deletions
This file was deleted.

modules/statistics/AvgRTPStatsReporter.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
import TraceablePeerConnection from '../RTC/TraceablePeerConnection';
1515
import browser from '../browser';
1616
import { isValidNumber } from '../util/MathUtil';
17+
import JingleSession from '../xmpp/JingleSession';
1718

1819
import Statistics from './statistics';
1920

@@ -374,7 +375,7 @@ export default class AvgRTPStatsReporter {
374375
_cachedTransportStats: Optional<Record<string, unknown>>;
375376
_onLocalStatsUpdated: (data: any) => void;
376377
_onP2PStatusChanged: () => void;
377-
_onJvb121StatusChanged: (oldStatus: boolean, newStatus: boolean) => void;
378+
_onJvb121StatusChanged: (activeSession: JingleSession) => void;
378379
jvbStatsMonitor: ConnectionAvgStats;
379380
p2pStatsMonitor: ConnectionAvgStats;
380381

@@ -592,17 +593,15 @@ export default class AvgRTPStatsReporter {
592593
ConferenceEvents.P2P_STATUS,
593594
this._onP2PStatusChanged);
594595

595-
this._onJvb121StatusChanged = (oldStatus: boolean, newStatus: boolean) => {
596-
// We want to reset only on the transition from false => true,
597-
// because otherwise those stats are resetted on JVB <=> P2P
598-
// transition.
599-
if (newStatus === true) {
596+
this._onJvb121StatusChanged = activeSession => {
597+
598+
if (activeSession === conference.jvbJingleSession) {
600599
logger.info('Resetting JVB avg RTP stats');
601600
this._resetAvgJvbStats();
602601
}
603602
};
604603
conference.on(
605-
ConferenceEvents.JVB121_STATUS,
604+
ConferenceEvents._MEDIA_SESSION_ACTIVE_CHANGED,
606605
this._onJvb121StatusChanged);
607606

608607
this.jvbStatsMonitor
@@ -1052,7 +1051,7 @@ export default class AvgRTPStatsReporter {
10521051
ConnectionQualityEvents.LOCAL_STATS_UPDATED,
10531052
this._onLocalStatsUpdated);
10541053
this._conference.off(
1055-
ConferenceEvents.JVB121_STATUS,
1054+
ConferenceEvents._MEDIA_SESSION_ACTIVE_CHANGED,
10561055
this._onJvb121StatusChanged);
10571056
this.jvbStatsMonitor.dispose();
10581057
this.p2pStatsMonitor.dispose();

0 commit comments

Comments
 (0)