@abrar71/lib-jitsi-meet 2131.0.0 → 2133.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/types/index.d.ts CHANGED
@@ -312,6 +312,15 @@ declare module "JitsiConferenceEvents" {
312
312
  * sources
313
313
  */
314
314
  FORWARDED_SOURCES_CHANGED = "conference.forwardedSourcesChanged",
315
+ /**
316
+ * Indicates that inbound video stats have been received for remote video streams that are receiving
317
+ * media bytes but decoding no frames. Fired when at least one such stream exists, and once more with an
318
+ * empty map when all previously-failing streams have recovered (all-clear signal).
319
+ *
320
+ * @param {TraceablePeerConnection} tpc - The peer connection.
321
+ * @param {Map<number, { bitrateDownload: number, fps: number, participantId: string }>} stats - Stats per SSRC.
322
+ */
323
+ INBOUND_VIDEO_STATS_RECEIVED = "conference.inbound_video_stats_received",
315
324
  /**
316
325
  * You are kicked from the conference.
317
326
  * @param {JitsiParticipant} the participant that initiated the kick.
@@ -920,6 +929,18 @@ declare module "service/statistics/AnalyticsEvents" {
920
929
  * mediaType: the media type of the local track ('audio' or 'video').
921
930
  */
922
931
  NO_BYTES_SENT = "track.no-bytes-sent",
932
+ /**
933
+ * Indicates a change in the decoding state of a remote video stream that is receiving media bytes.
934
+ * Fired after the condition persists for at least 3 consecutive stats polling cycles (~30 seconds),
935
+ * and again when the condition resolves.
936
+ *
937
+ * Properties:
938
+ * stopped: true when frame decoding has stopped while bytes are still received,
939
+ * false when decoding resumes.
940
+ * participantId: the ID of the participant whose video stream is affected.
941
+ * ssrc: the SSRC of the affected stream.
942
+ */
943
+ REMOTE_VIDEO_DECODING = "remote.video.decoding",
923
944
  /**
924
945
  * Indicates that a track was unmuted (?).
925
946
  *
@@ -2626,7 +2647,19 @@ declare module "service/statistics/Events" {
2626
2647
  /**
2627
2648
  * An event carrying the encode time stats for all the local video sources.
2628
2649
  */
2629
- ENCODE_TIME_STATS = "statistics.encode_time_stats"
2650
+ ENCODE_TIME_STATS = "statistics.encode_time_stats",
2651
+ /**
2652
+ * An event carrying per-SSRC inbound video stats for remote video streams that are receiving bytes but
2653
+ * decoding no frames. Fired in two situations:
2654
+ * 1. When at least one such stream exists (stats map is non-empty).
2655
+ * 2. Once more with an empty map when the set of failing streams transitions from non-empty to empty,
2656
+ * giving consumers the opportunity to fire resolution events and clean up state.
2657
+ * No event is emitted while all remote streams are healthy.
2658
+ *
2659
+ * @param {TraceablePeerConnection} tpc - The peer connection.
2660
+ * @param {Map<number, { bitrateDownload: number, fps: number, participantId: string }>} stats - Stats per SSRC.
2661
+ */
2662
+ INBOUND_VIDEO_STATS = "statistics.inbound_video_stats"
2630
2663
  }
2631
2664
  }
2632
2665
  declare module "service/statistics/constants" {
@@ -3096,6 +3129,16 @@ declare module "modules/RTCStats/RTCStatsEvents" {
3096
3129
  * Event that indicates that a remote video source is suspended by the JVB because of BWE issues.
3097
3130
  */
3098
3131
  REMOTE_SOURCE_SUSPENDED_EVENT = "remoteSourceSuspended",
3132
+ /**
3133
+ * Event that indicates a change in the decoding state of a remote video stream that is receiving media bytes.
3134
+ *
3135
+ * @param {object} data - The event data.
3136
+ * @param {boolean} data.stopped - True when frame decoding has stopped while bytes are still received,
3137
+ * false when decoding resumes.
3138
+ * @param {string} data.participantId - The participant whose video stream is affected.
3139
+ * @param {number} data.ssrc - The SSRC of the affected stream.
3140
+ */
3141
+ REMOTE_VIDEO_DECODING_EVENT = "remoteVideoDecoding",
3099
3142
  /**
3100
3143
  * Event emitted when any PeerConnection event is triggered.
3101
3144
  *
@@ -7979,6 +8022,13 @@ declare module "modules/statistics/RTPStatsCollector" {
7979
8022
  * @type {Map<number,SsrcStats}
7980
8023
  */
7981
8024
  ssrc2stats: Map<number, SsrcStats>;
8025
+ /**
8026
+ * Tracks whether the previous stats cycle had any inbound video SSRCs in the bad state
8027
+ * (bytes received, no frames decoded). Used to emit a final all-clear call to QualityController
8028
+ * when the set transitions from non-empty to empty.
8029
+ * @type {boolean}
8030
+ */
8031
+ _hadBadInboundSsrcs: boolean;
7982
8032
  /**
7983
8033
  * Set the list of the remote speakers for which audio levels are to be calculated.
7984
8034
  *
@@ -8291,6 +8341,17 @@ declare module "modules/statistics/statistics" {
8291
8341
  * @param {Function} listener - The listener to remove
8292
8342
  */
8293
8343
  removeEncodeTimeStatsListener(listener: (...args: any[]) => void): void;
8344
+ /**
8345
+ * Adds a listener for inbound video stats events. The event fires when at least one remote video stream is
8346
+ * receiving bytes but decoding no frames, and once more with an empty map when all such streams recover.
8347
+ * @param {Function} listener - The listener to add
8348
+ */
8349
+ addInboundVideoStatsListener(listener: (...args: any[]) => void): void;
8350
+ /**
8351
+ * Removes an inbound video stats listener.
8352
+ * @param {Function} listener - The listener to remove
8353
+ */
8354
+ removeInboundVideoStatsListener(listener: (...args: any[]) => void): void;
8294
8355
  /**
8295
8356
  * Adds a listener for byte sent stats events.
8296
8357
  * @param {Function} listener - The listener to add
@@ -11093,1454 +11154,1472 @@ declare module "modules/RTC/JitsiRemoteTrack" {
11093
11154
  toString(): string;
11094
11155
  }
11095
11156
  }
11096
- declare module "JitsiParticipant" {
11157
+ declare module "modules/qualitycontrol/CodecSelection" {
11097
11158
  import JitsiConference from "JitsiConference";
11098
- import JitsiRemoteTrack from "modules/RTC/JitsiRemoteTrack";
11099
- import { MediaType } from "service/RTC/MediaType";
11100
- import { SourceName } from "service/RTC/SignalingLayer";
11101
- import { VideoType } from "service/RTC/VideoType";
11102
- export interface ISourceInfo {
11103
- muted: boolean;
11104
- videoType: string;
11159
+ import JitsiLocalTrack from "modules/RTC/JitsiLocalTrack";
11160
+ import JingleSessionPC from "modules/xmpp/JingleSessionPC";
11161
+ export interface ICodecSelectionOptions {
11162
+ [connectionType: string]: {
11163
+ disabledCodec?: string;
11164
+ enableAV1ForFF?: boolean;
11165
+ preferenceOrder?: string[];
11166
+ preferredCodec?: string;
11167
+ screenshareCodec?: string;
11168
+ };
11105
11169
  }
11170
+ export type CodecPreferenceOrder = {
11171
+ [connectionType: string]: string[];
11172
+ };
11173
+ export type ScreenshareCodec = {
11174
+ [connectionType: string]: string;
11175
+ };
11106
11176
  /**
11107
- * Represents a participant in (i.e. a member of) a conference.
11177
+ * This class handles the codec selection mechanism for the conference based on the config.js settings.
11178
+ * The preferred codec is selected based on the settings and the list of codecs supported by the browser.
11179
+ * The preferred codec is published in presence which is then used by the other endpoints in the
11180
+ * conference to pick a supported codec at join time and when the call transitions between p2p and jvb
11181
+ * connections.
11108
11182
  */
11109
- export default class JitsiParticipant {
11110
- private _jid;
11111
- private _id;
11112
- private _conference;
11113
- private _role;
11114
- private _hidden;
11115
- private _statsID?;
11116
- private _properties;
11117
- private _identity?;
11118
- private _isReplacing?;
11119
- private _isReplaced?;
11120
- private _isSilent?;
11121
- private _features;
11122
- private _sources;
11123
- private _botType?;
11124
- private _connectionJid?;
11183
+ export class CodecSelection {
11184
+ private codecPreferenceOrder;
11185
+ private conference;
11186
+ private encodeTimeStats;
11187
+ private options;
11188
+ private screenshareCodec;
11189
+ private visitorCodecs;
11125
11190
  /**
11126
- * Initializes a new JitsiParticipant instance.
11191
+ * Creates a new instance for a given conference.
11127
11192
  *
11128
- * @param jid the conference XMPP jid
11129
- * @param conference
11130
- * @param displayName
11131
- * @param {Boolean} hidden - True if the new JitsiParticipant instance is to
11132
- * represent a hidden participant; otherwise, false.
11133
- * @param {string} statsID - optional participant statsID
11134
- * @param {string} status - the initial status if any.
11135
- * @param {object} identity - the xmpp identity
11136
- * @param {boolean?} isReplacing - whether this is a participant replacing another into the meeting.
11137
- * @param {boolean?} isReplaced - whether this is a participant to be kicked and replaced into the meeting.
11138
- * @param {boolean?} isSilent - whether participant has joined without audio
11193
+ * @param {JitsiConference} conference the conference instance
11194
+ * @param {*} options
11195
+ * @param {string} options.jvb settings (codec list, preferred and disabled) for the jvb connection.
11196
+ * @param {string} options.p2p settings (codec list, preferred and disabled) for the p2p connection.
11139
11197
  */
11140
- constructor(jid: string, conference: JitsiConference, displayName: string, hidden: boolean, statsID?: string, status?: string, identity?: object, isReplacing?: boolean, isReplaced?: boolean, isSilent?: boolean);
11198
+ constructor(conference: JitsiConference, options: ICodecSelectionOptions);
11141
11199
  /**
11142
- * Determines whether all JitsiTracks which are of a specific MediaType and which belong to this
11143
- * JitsiParticipant are muted.
11200
+ * Returns a list of video codecs that are supported by the browser.
11144
11201
  *
11145
- * @param {MediaType} mediaType - The MediaType of the JitsiTracks to be checked.
11146
- * @private
11147
- * @returns {Boolean} True if all JitsiTracks which are of the specified mediaType and which belong to this
11148
- * JitsiParticipant are muted; otherwise, false.
11202
+ * @param {string} connectionType - media connection type, p2p or jvb.
11203
+ * @returns {Array}
11149
11204
  */
11150
- _isMediaTypeMuted(mediaType: MediaType): boolean;
11205
+ _getSupportedVideoCodecs(connectionType: string): string[];
11151
11206
  /**
11152
- * Sets source info.
11153
- * @param {MediaType} mediaType The media type, 'audio' or 'video'.
11154
- * @param {boolean} muted The new muted state.
11155
- * @param {SourceName} sourceName The name of the source.
11156
- * @param {string} videoType The video type of the source.
11157
- * @returns {void}
11207
+ * Returns the current codec preference order for the given connection type.
11208
+ *
11209
+ * @param {String} connectionType The media connection type, 'p2p' or 'jvb'.
11210
+ * @returns {Array<string>}
11158
11211
  */
11159
- _setSources(mediaType: MediaType, muted: boolean, sourceName: SourceName, videoType: VideoType): void;
11212
+ getCodecPreferenceList(connectionType: string): string[];
11160
11213
  /**
11161
- * Returns the bot type for the participant.
11214
+ * Returns the preferred screenshare codec for the given connection type.
11162
11215
  *
11163
- * @returns {Optional<string>} - The bot type of the participant.
11216
+ * @param {Optional} connectionType The media connection type, 'p2p' or 'jvb'.
11217
+ * @returns CodecMimeType
11164
11218
  */
11165
- getBotType(): Optional<string>;
11219
+ getScreenshareCodec(connectionType: string): Optional<string>;
11166
11220
  /**
11167
- * @returns {JitsiConference} The conference that this participant belongs
11168
- * to.
11221
+ * Sets the codec on the media session based on the codec preference order configured in config.js and the supported
11222
+ * codecs published by the remote participants in their presence.
11223
+ *
11224
+ * @param {JingleSessionPC} mediaSession session for which the codec selection has to be made.
11169
11225
  */
11170
- getConference(): JitsiConference;
11226
+ selectPreferredCodec(mediaSession?: JingleSessionPC): void;
11171
11227
  /**
11172
- * Returns the connection jid for the participant.
11228
+ * Changes the codec preference order.
11173
11229
  *
11174
- * @returns {Optional<string>} - The connection jid of the participant.
11230
+ * @param {JitsiLocalTrack} localTrack - The local video track.
11231
+ * @param {CodecMimeType} codec - The codec used for encoding the given local video track.
11232
+ * @returns boolean - Returns true if the codec order has been updated, false otherwise.
11175
11233
  */
11176
- getConnectionJid(): Optional<string>;
11234
+ changeCodecPreferenceOrder(localTrack: JitsiLocalTrack, codec: string): boolean;
11177
11235
  /**
11178
- * @returns {String} The human-readable display name of this participant.
11236
+ * Updates the aggregate list of the codecs supported by all the visitors in the call and calculates the
11237
+ * selected codec if needed.
11238
+ * @param {Array} codecList - visitor codecs.
11239
+ * @returns {void}
11179
11240
  */
11180
- getDisplayName(): string;
11241
+ updateVisitorCodecs(codecList: string[]): void;
11242
+ }
11243
+ }
11244
+ declare module "modules/qualitycontrol/ReceiveAudioController" {
11245
+ import JitsiConference from "JitsiConference";
11246
+ import { IReceiverAudioSubscriptionMessage, ReceiverAudioSubscription } from "service/RTC/ReceiverAudioSubscription";
11247
+ /**
11248
+ * Controller for managing audio subscriptions in a Jitsi conference. It allows subscribing to remote audio streams
11249
+ * based on different modes such as ALL, EXCLUDE, INCLUDE, and NONE.
11250
+ */
11251
+ export class ReceiverAudioController {
11252
+ private _rtc;
11181
11253
  /**
11182
- * Returns a set with the features for the participant.
11183
- * @returns {Promise<Set<String>>}
11254
+ * The list of remote audio sources that the local endpoint is subscribed/unsubscribed to.
11255
+ * This is used when the subscription mode is set to INCLUDE or EXCLUDE.
11184
11256
  */
11185
- getFeatures(): Promise<Set<string>>;
11257
+ private _sourceList;
11186
11258
  /**
11187
- * @returns {String} The ID of this participant.
11259
+ * The audio subscription options for remote audio streams.
11188
11260
  */
11189
- getId(): string;
11261
+ private _subscriptionMode;
11190
11262
  /**
11191
- * Returns the XMPP identity. This is defined by your application in the
11192
- * JWT `context` claims section.
11193
- *
11194
- * @returns {Optional<object>} - XMPP user identity.
11263
+ * Creates a new instance of the ReceiverAudioController.
11195
11264
  */
11196
- getIdentity(): Optional<object>;
11265
+ constructor(conference: JitsiConference);
11197
11266
  /**
11198
- * @returns {String} The JID of this participant.
11267
+ * Gets the current audio subscription option.
11268
+ *
11269
+ * @returns {ReceiverAudioSubscription} The current audio subscription option.
11199
11270
  */
11200
- getJid(): string;
11271
+ get audioSubscription(): ReceiverAudioSubscription;
11201
11272
  /**
11202
- * Gets the value of a property of this participant.
11273
+ * Mutes or unmutes the remote audio streams based on the provided parameter.
11274
+ *
11275
+ * @param {boolean} muted - Indicates whether the remote audio should be muted or not.
11276
+ * @returns {void}
11203
11277
  */
11204
- getProperty(name: string): any;
11278
+ muteRemoteAudio(muted: boolean): void;
11205
11279
  /**
11206
- * @returns {String} The role of this participant.
11280
+ * Sets the audio subscription options.
11281
+ *
11282
+ * @param message The audio subscription message containing the mode and optional source list.
11283
+ * @returns {void}
11207
11284
  */
11208
- getRole(): string;
11285
+ setAudioSubscriptionMode(message: IReceiverAudioSubscriptionMessage): void;
11286
+ }
11287
+ }
11288
+ declare module "modules/qualitycontrol/SendVideoController" {
11289
+ import JitsiConference from "JitsiConference";
11290
+ import JingleSessionPC from "modules/xmpp/JingleSessionPC";
11291
+ export interface IVideoConstraint {
11292
+ maxHeight: number;
11293
+ sourceName: string;
11294
+ }
11295
+ /**
11296
+ * The class manages send video constraints across media sessions({@link JingleSessionPC}) which belong to
11297
+ * {@link JitsiConference}. It finds the lowest common value, between the local user's send preference and
11298
+ * the remote party's receive preference. Also this module will consider only the active session's receive value,
11299
+ * because local tracks are shared and while JVB may have no preference, the remote p2p may have and they may be totally
11300
+ * different.
11301
+ */
11302
+ export default class SendVideoController {
11303
+ private _conference;
11304
+ private _preferredSendMaxFrameHeight;
11209
11305
  /**
11210
- * Returns the sources associated with this participant.
11211
- * @returns Map<string, Map<string, Object>>
11306
+ * Source name based sender constraints.
11307
+ * @type {Map<string, number>};
11212
11308
  */
11213
- getSources(): Map<MediaType, Map<string, ISourceInfo>>;
11309
+ private _sourceSenderConstraints;
11214
11310
  /**
11215
- * @returns {String} The stats ID of this participant.
11311
+ * Creates new instance for a given conference.
11312
+ *
11313
+ * @param {JitsiConference} conference - the conference instance for which the new instance will be managing
11314
+ * the send video quality constraints.
11216
11315
  */
11217
- getStatsID(): string;
11316
+ constructor(conference: JitsiConference);
11218
11317
  /**
11219
- * @returns {String} The status of the participant.
11318
+ * Figures out the send video constraint as specified by {@link _selectSendMaxFrameHeight} and sets it on all media
11319
+ * sessions for the reasons mentioned in this class description.
11320
+ *
11321
+ * @param {string} sourceName - The source for which sender constraints have changed.
11322
+ * @returns {Promise<void>}
11323
+ * @private
11220
11324
  */
11221
- getStatus(): string;
11325
+ _propagateSendMaxFrameHeight(sourceName: string): Promise<void>;
11222
11326
  /**
11223
- * @returns {Array.<JitsiRemoteTrack>} The list of media tracks for this
11224
- * participant.
11327
+ * Selects the lowest common value for the local video send constraint by looking at local user's preference and
11328
+ * the active media session's receive preference set by the remote party.
11329
+ *
11330
+ * @param {string} sourceName - The source for which sender constraints have changed.
11331
+ * @returns {Optional<number>}
11332
+ * @private
11225
11333
  */
11226
- getTracks(): (JitsiRemoteTrack)[];
11334
+ _selectSendMaxFrameHeight(sourceName: string): Optional<number>;
11227
11335
  /**
11228
- * @param {MediaType} mediaType
11229
- * @returns {Array.<JitsiRemoteTrack>} an array of media tracks for this
11230
- * participant, for given media type.
11336
+ * Configures the video encodings on the local sources when a media connection is established or becomes active.
11337
+ *
11338
+ * @returns {void}
11231
11339
  */
11232
- getTracksByMediaType(mediaType: MediaType): (JitsiRemoteTrack)[];
11340
+ configureConstraintsForLocalSources(): void;
11233
11341
  /**
11234
- * Checks current set features.
11235
- * @param {String} feature - the feature to check.
11236
- * @return {boolean} <tt>true</tt> if this <tt>participant</tt> contains the
11237
- * <tt>feature</tt>.
11238
- */
11239
- hasFeature(feature: string): boolean;
11240
- /**
11241
- * @returns {Boolean} Whether this participant has muted their audio.
11242
- */
11243
- isAudioMuted(): boolean;
11244
- /**
11245
- * @returns {Boolean} Whether this participant is a hidden participant. Some
11246
- * special system participants may want to join hidden (like for example the
11247
- * recorder).
11342
+ * Handles the {@link JitsiConferenceEvents.MEDIA_SESSION_STARTED}, that is when the conference creates new media
11343
+ * session. It doesn't mean it's already active though. For example the JVB connection may be created after
11344
+ * the conference has entered the p2p mode already.
11345
+ *
11346
+ * @param {JingleSessionPC} mediaSession - the started media session.
11248
11347
  */
11249
- isHidden(): boolean;
11348
+ onMediaSessionStarted(mediaSession: JingleSessionPC): void;
11250
11349
  /**
11251
- * @returns {Boolean} Whether this participant is a hidden participant. Some
11252
- * special system participants may want to join hidden (like for example the
11253
- * recorder).
11350
+ * Propagates the video constraints if they have changed.
11351
+ *
11352
+ * @param {IVideoConstraint} videoConstraints - The sender video constraints received from the bridge.
11353
+ * @returns {Promise<void>}
11254
11354
  */
11255
- isHiddenFromRecorder(): boolean;
11355
+ onSenderConstraintsReceived(videoConstraints: IVideoConstraint): Promise<void>;
11256
11356
  /**
11257
- * @returns {Boolean} Whether this participant is a moderator or not.
11357
+ * Sets local preference for max send video frame height.
11358
+ *
11359
+ * @param {number} maxFrameHeight - the new value to set.
11360
+ * @returns {Promise<void>} - resolved when the operation is complete.
11258
11361
  */
11259
- isModerator(): boolean;
11362
+ setPreferredSendMaxFrameHeight(maxFrameHeight: number): Promise<void>;
11363
+ }
11364
+ }
11365
+ declare module "modules/qualitycontrol/QualityController" {
11366
+ import JitsiConference from "JitsiConference";
11367
+ import { CodecMimeType } from "service/RTC/CodecMimeType";
11368
+ import JitsiLocalTrack from "modules/RTC/JitsiLocalTrack";
11369
+ import TraceablePeerConnection from "modules/RTC/TraceablePeerConnection";
11370
+ import { CodecSelection } from "modules/qualitycontrol/CodecSelection";
11371
+ import { ReceiverAudioController } from "modules/qualitycontrol/ReceiveAudioController";
11372
+ import ReceiveVideoController from "modules/qualitycontrol/ReceiveVideoController";
11373
+ import SendVideoController from "modules/qualitycontrol/SendVideoController";
11374
+ export const NOT_DECODING_THRESHOLD_CYCLES = 6;
11375
+ enum QualityLimitationReason {
11376
+ BANDWIDTH = "bandwidth",
11377
+ CPU = "cpu",
11378
+ NONE = "none"
11379
+ }
11380
+ interface IResolution {
11381
+ height: number;
11382
+ width: number;
11383
+ }
11384
+ interface IOutboundRtpStats {
11385
+ codec: CodecMimeType;
11386
+ encodeTime: number;
11387
+ qualityLimitationReason: QualityLimitationReason;
11388
+ resolution: IResolution;
11389
+ timestamp: number;
11390
+ }
11391
+ export interface ISourceStats {
11392
+ avgEncodeTime: number;
11393
+ codec: CodecMimeType;
11394
+ encodeResolution: number;
11395
+ localTrack: JitsiLocalTrack;
11396
+ qualityLimitationReason: QualityLimitationReason;
11397
+ timestamp: number;
11398
+ tpc: TraceablePeerConnection;
11399
+ }
11400
+ export interface IInboundVideoStats {
11401
+ bitrateDownload: number;
11402
+ fps: number;
11403
+ participantId: string;
11404
+ }
11405
+ export class FixedSizeArray {
11406
+ private _data;
11407
+ private _maxSize;
11408
+ constructor(size: number);
11409
+ add(item: ISourceStats): void;
11410
+ get(index: number): Optional<ISourceStats>;
11411
+ size(): number;
11412
+ }
11413
+ /**
11414
+ * QualityController class that is responsible for maintaining optimal video quality experience on the local endpoint
11415
+ * by controlling the codec, encode resolution and receive resolution of the remote video streams. It also makes
11416
+ * adjustments based on the outbound and inbound rtp stream stats reported by the underlying peer connection.
11417
+ */
11418
+ export class QualityController {
11419
+ private _audioController;
11420
+ private _codecController;
11421
+ private _conference;
11422
+ private _enableAdaptiveMode;
11423
+ private _encodeTimeStats;
11424
+ private _isLastNRampupBlocked;
11425
+ private _lastNRampupTime;
11426
+ private _lastNRampupTimeout;
11427
+ private _limitedByCpuTimeout;
11428
+ private _notDecodingVideoTracker;
11429
+ private _receiveVideoController;
11430
+ private _sendVideoController;
11431
+ private _timer;
11260
11432
  /**
11261
- * @returns {Boolean} Wheter this participants will be replaced by another
11262
- * participant in the meeting.
11433
+ *
11434
+ * @param {JitsiConference} conference - The JitsiConference instance.
11435
+ * @param {Object} options - video quality settings passed through config.js.
11263
11436
  */
11264
- isReplaced(): boolean;
11437
+ constructor(conference: JitsiConference, options: {
11438
+ enableAdaptiveMode: boolean;
11439
+ jvb: object;
11440
+ lastNRampupTime: number;
11441
+ p2p: object;
11442
+ });
11265
11443
  /**
11266
- * @returns {Boolean} Whether this participant replaces another participant
11267
- * from the meeting.
11444
+ * Creates a debounced function that delays the execution of the provided function until after the specified delay
11445
+ * has elapsed. Unlike typical debounce implementations, the timer does not reset when the function is called again
11446
+ * within the delay period.
11447
+ *
11448
+ * @param {Function} func - The function to be debounced.
11449
+ * @param {number} delay - The delay in milliseconds.
11450
+ * @returns {Function} - The debounced function.
11268
11451
  */
11269
- isReplacing(): boolean;
11452
+ _debounce(func: Function, delay: number): (...args: any) => void;
11270
11453
  /**
11271
- * @returns {Boolean} Whether this participant has joined without audio.
11454
+ * Adjusts the lastN value so that fewer remote video sources are received from the bridge in an attempt to improve
11455
+ * encode resolution of the outbound video streams based on cpuLimited parameter passed. If cpuLimited is false,
11456
+ * the lastN value will slowly be ramped back up to the channelLastN value set in config.js.
11457
+ *
11458
+ * @param {boolean} cpuLimited - whether the endpoint is cpu limited or not.
11459
+ * @returns boolean - Returns true if an action was taken, false otherwise.
11272
11460
  */
11273
- isSilent(): boolean;
11461
+ _lowerOrRaiseLastN(cpuLimited: boolean): boolean;
11274
11462
  /**
11275
- * @returns {Boolean} Whether this participant has muted their video.
11463
+ * Adjusts the requested resolution for remote video sources by updating the receiver constraints in an attempt to
11464
+ * improve the encode resolution of the outbound video streams.
11465
+ * @return {void}
11276
11466
  */
11277
- isVideoMuted(): boolean;
11467
+ _maybeLowerReceiveResolution(): void;
11278
11468
  /**
11279
- * Sets the bot type for the participant.
11280
- * @param {String} newBotType - The new bot type to set.
11469
+ * Updates the codec preference order for the local endpoint on the active media session and switches the video
11470
+ * codec if needed.
11471
+ *
11472
+ * @param {number} trackId - The track ID of the local video track for which stats have been captured.
11473
+ * @returns {boolean} - Returns true if video codec was changed.
11281
11474
  */
11282
- setBotType(newBotType: string): void;
11475
+ _maybeSwitchVideoCodec(trackId: number): boolean;
11283
11476
  /**
11284
- * Sets the connection jid for the participant.
11285
- * @param {String} newJid - The connection jid to set.
11477
+ * Adjusts codec, lastN or receive resolution based on the send resolution (of the outbound streams) and limitation
11478
+ * reported by the browser in the WebRTC stats. Recovery is also attempted if the limitation goes away. No action
11479
+ * is taken if the adaptive mode has been disabled through config.js.
11480
+ *
11481
+ * @param {ISourceStats} sourceStats - The outbound-rtp stats for a local video track.
11482
+ * @returns {void}
11286
11483
  */
11287
- setConnectionJid(newJid: string): void;
11484
+ _performQualityOptimizations(sourceStats: ISourceStats): void;
11288
11485
  /**
11289
- * Set new features.
11290
- * @param {Set<String>|undefined} newFeatures - Sets new features.
11486
+ * Processes inbound video stats for remote streams that are receiving bytes but decoding no frames.
11487
+ * Only SSRCs already filtered to the problematic condition (bitrateDownload > 0, fps === 0) are passed in.
11488
+ * Tracks each affected SSRC across consecutive polling cycles and fires RTCStats + Amplitude analytics events
11489
+ * after NOT_DECODING_THRESHOLD_CYCLES consecutive bad cycles. Fires again with stopped=false when resolved.
11490
+ *
11491
+ * @param {TraceablePeerConnection} tpc - The peer connection where stats were captured.
11492
+ * @param {Map<number, IInboundVideoStats>} stats - Per-SSRC stats for streams currently failing the check.
11493
+ * @returns {void}
11291
11494
  */
11292
- setFeatures(newFeatures?: Set<string>): void;
11495
+ _processInboundVideoStats(tpc: TraceablePeerConnection, stats: Map<number, IInboundVideoStats>): void;
11293
11496
  /**
11294
- * Sets whether participant is being replaced by another based on jwt.
11295
- * @param {boolean} newIsReplaced - whether is being replaced.
11497
+ * Processes the outbound RTP stream stats as reported by the WebRTC peerconnection and makes runtime adjustments
11498
+ * to the client for better quality experience if the adaptive mode is enabled.
11499
+ *
11500
+ * @param {TraceablePeerConnection} tpc - The underlying WebRTC peerconnection where stats have been captured.
11501
+ * @param {Map<number, IOutboundRtpStats>} stats - Outbound-rtp stream stats per SSRC.
11502
+ * @returns void
11296
11503
  */
11297
- setIsReplaced(newIsReplaced: boolean): void;
11504
+ _processOutboundRtpStats(tpc: TraceablePeerConnection, stats: Map<number, IOutboundRtpStats>): void;
11298
11505
  /**
11299
- * Sets whether participant is replacing another based on jwt.
11300
- * @param {boolean} newIsReplacing - whether is replacing.
11506
+ * Gets the audio controller instance.
11301
11507
  */
11302
- setIsReplacing(newIsReplacing: boolean): void;
11508
+ get audioController(): ReceiverAudioController;
11303
11509
  /**
11304
- * Sets whether participant has joined without audio.
11305
- * @param {boolean} newIsSilent - whether is silent.
11510
+ * Gets the codec controller instance.
11306
11511
  */
11307
- setIsSilent(newIsSilent: boolean): void;
11512
+ get codecController(): CodecSelection;
11308
11513
  /**
11309
- * Sets the value of a property of this participant, and fires an event if
11310
- * the value has changed.
11311
- * @param {string} name the name of the property.
11312
- * @param {any} value the value to set.
11514
+ * Gets the receive video controller instance.
11313
11515
  */
11314
- setProperty(name: string, value: any): void;
11516
+ get receiveVideoController(): ReceiveVideoController;
11315
11517
  /**
11316
- * Sets a new participant role.
11317
- * @param {String} newRole - the new role.
11518
+ * Gets the send video controller instance.
11318
11519
  */
11319
- setRole(newRole: string): void;
11520
+ get sendVideoController(): SendVideoController;
11320
11521
  /**
11321
- *
11522
+ * Cleans up the QualityController by clearing all active timeouts and disposing of controllers.
11523
+ * This prevents memory leaks and ensures proper cleanup when the controller is no longer needed.
11322
11524
  */
11323
- supportsDTMF(): boolean;
11525
+ dispose(): void;
11324
11526
  }
11325
11527
  }
11326
- declare module "modules/recording/recordingXMLUtils" {
11327
- /**
11328
- * A collection of utility functions for taking in XML and parsing it to return
11329
- * certain values.
11330
- */
11331
- export interface IFocusRecordingUpdate {
11332
- error?: string;
11333
- initiator?: string;
11334
- recordingMode?: string;
11335
- sessionID?: string;
11336
- status?: string;
11337
- }
11338
- export interface IHiddenDomainUpdate {
11339
- liveStreamViewURL?: string;
11340
- mode?: string;
11341
- sessionID?: string;
11342
- }
11343
- /**
11344
- * Parses the presence update of the focus and returns an object with the
11345
- * statuses related to recording.
11346
- *
11347
- * @param {Element} presence - An XMPP presence update.
11348
- * @returns {Optional<Object>} The current presence values related to recording.
11349
- */
11350
- export function getFocusRecordingUpdate(presence: Element): Optional<IFocusRecordingUpdate>;
11351
- /**
11352
- * Parses the presence update from a hidden domain participant and returns
11353
- * an object with the statuses related to recording.
11354
- *
11355
- * @param {Element} presence - An XMPP presence update.
11356
- * @returns {Object} The current presence values related to recording.
11357
- */
11358
- export function getHiddenDomainUpdate(presence: Element): IHiddenDomainUpdate;
11359
- /**
11360
- * Returns the recording session ID from a successful IQ.
11361
- *
11362
- * @param {Element} response - The response from the IQ.
11363
- * @returns {string} The session ID of the recording session.
11364
- */
11365
- export function getSessionIdFromIq(response: Element): Nullable<string>;
11366
- /**
11367
- * Returns the recording session ID from a presence, if it exists.
11368
- *
11369
- * @param {Element} presence - An XMPP presence update.
11370
- * @returns {string|null|undefined} The session ID of the recording session.
11371
- */
11372
- export function getSessionId(presence: Element): Optional<Nullable<string>>;
11373
- /**
11374
- * Returns whether or not a presence is from the focus.
11375
- *
11376
- * @param {Element} presence - An XMPP presence update.
11377
- * @returns {boolean} True if the presence is from the focus.
11378
- */
11379
- export function isFromFocus(presence: Element): boolean;
11380
- }
11381
- declare module "modules/recording/JibriSession" {
11382
- import JitsiParticipant from "JitsiParticipant";
11383
- import XmppConnection from "modules/xmpp/XmppConnection";
11384
- export interface IJibriSessionOptions {
11385
- connection?: XmppConnection;
11386
- focusMucJid?: string;
11387
- mode?: string;
11388
- sessionID?: string;
11389
- status?: string;
11390
- }
11391
- export interface IStartOptions {
11392
- appData?: string;
11393
- broadcastId?: string;
11394
- focusMucJid: string;
11395
- streamId?: string;
11396
- }
11397
- export interface IStopOptions {
11398
- focusMucJid: string;
11399
- }
11400
- export interface IQOptions {
11401
- action?: 'start' | 'stop';
11402
- appData?: string;
11403
- broadcastId?: string;
11404
- focusMucJid: string;
11405
- streamId?: string;
11528
+ declare module "JitsiParticipant" {
11529
+ import JitsiConference from "JitsiConference";
11530
+ import JitsiRemoteTrack from "modules/RTC/JitsiRemoteTrack";
11531
+ import { MediaType } from "service/RTC/MediaType";
11532
+ import { SourceName } from "service/RTC/SignalingLayer";
11533
+ import { VideoType } from "service/RTC/VideoType";
11534
+ export interface ISourceInfo {
11535
+ muted: boolean;
11536
+ videoType: string;
11406
11537
  }
11407
11538
  /**
11408
- * Represents a recording session.
11539
+ * Represents a participant in (i.e. a member of) a conference.
11409
11540
  */
11410
- export default class JibriSession {
11411
- private _connection?;
11412
- private _mode?;
11413
- private _jibriJid;
11414
- private _statusFromJicofo;
11415
- private _sessionID?;
11416
- private _status?;
11417
- private _error?;
11418
- private _liveStreamViewURL?;
11419
- private _initiator?;
11420
- private _terminator?;
11421
- private _focusMucJid?;
11541
+ export default class JitsiParticipant {
11542
+ private _jid;
11543
+ private _id;
11544
+ private _conference;
11545
+ private _role;
11546
+ private _hidden;
11547
+ private _statsID?;
11548
+ private _properties;
11549
+ private _identity?;
11550
+ private _isReplacing?;
11551
+ private _isReplaced?;
11552
+ private _isSilent?;
11553
+ private _features;
11554
+ private _sources;
11555
+ private _botType?;
11556
+ private _connectionJid?;
11422
11557
  /**
11423
- * Initializes a new JibriSession instance.
11558
+ * Initializes a new JitsiParticipant instance.
11424
11559
  *
11425
- * @constructor
11560
+ * @param jid the conference XMPP jid
11561
+ * @param conference
11562
+ * @param displayName
11563
+ * @param {Boolean} hidden - True if the new JitsiParticipant instance is to
11564
+ * represent a hidden participant; otherwise, false.
11565
+ * @param {string} statsID - optional participant statsID
11566
+ * @param {string} status - the initial status if any.
11567
+ * @param {object} identity - the xmpp identity
11568
+ * @param {boolean?} isReplacing - whether this is a participant replacing another into the meeting.
11569
+ * @param {boolean?} isReplaced - whether this is a participant to be kicked and replaced into the meeting.
11570
+ * @param {boolean?} isSilent - whether participant has joined without audio
11571
+ */
11572
+ constructor(jid: string, conference: JitsiConference, displayName: string, hidden: boolean, statsID?: string, status?: string, identity?: object, isReplacing?: boolean, isReplaced?: boolean, isSilent?: boolean);
11573
+ /**
11574
+ * Determines whether all JitsiTracks which are of a specific MediaType and which belong to this
11575
+ * JitsiParticipant are muted.
11576
+ *
11577
+ * @param {MediaType} mediaType - The MediaType of the JitsiTracks to be checked.
11578
+ * @private
11579
+ * @returns {Boolean} True if all JitsiTracks which are of the specified mediaType and which belong to this
11580
+ * JitsiParticipant are muted; otherwise, false.
11581
+ */
11582
+ _isMediaTypeMuted(mediaType: MediaType): boolean;
11583
+ /**
11584
+ * Sets source info.
11585
+ * @param {MediaType} mediaType The media type, 'audio' or 'video'.
11586
+ * @param {boolean} muted The new muted state.
11587
+ * @param {SourceName} sourceName The name of the source.
11588
+ * @param {string} videoType The video type of the source.
11589
+ * @returns {void}
11590
+ */
11591
+ _setSources(mediaType: MediaType, muted: boolean, sourceName: SourceName, videoType: VideoType): void;
11592
+ /**
11593
+ * Returns the bot type for the participant.
11594
+ *
11595
+ * @returns {Optional<string>} - The bot type of the participant.
11596
+ */
11597
+ getBotType(): Optional<string>;
11598
+ /**
11599
+ * @returns {JitsiConference} The conference that this participant belongs
11600
+ * to.
11601
+ */
11602
+ getConference(): JitsiConference;
11603
+ /**
11604
+ * Returns the connection jid for the participant.
11605
+ *
11606
+ * @returns {Optional<string>} - The connection jid of the participant.
11607
+ */
11608
+ getConnectionJid(): Optional<string>;
11609
+ /**
11610
+ * @returns {String} The human-readable display name of this participant.
11611
+ */
11612
+ getDisplayName(): string;
11613
+ /**
11614
+ * Returns a set with the features for the participant.
11615
+ * @returns {Promise<Set<String>>}
11616
+ */
11617
+ getFeatures(): Promise<Set<string>>;
11618
+ /**
11619
+ * @returns {String} The ID of this participant.
11426
11620
  */
11427
- constructor(options?: IJibriSessionOptions);
11621
+ getId(): string;
11428
11622
  /**
11429
- * Returns the error related to the session instance, if any.
11623
+ * Returns the XMPP identity. This is defined by your application in the
11624
+ * JWT `context` claims section.
11430
11625
  *
11431
- * @returns {Optional<string>}
11626
+ * @returns {Optional<object>} - XMPP user identity.
11432
11627
  */
11433
- getError(): Optional<string>;
11628
+ getIdentity(): Optional<object>;
11434
11629
  /**
11435
- * Returns the session ID of the session instance.
11436
- *
11437
- * @returns {Optional<string>}
11630
+ * @returns {String} The JID of this participant.
11438
11631
  */
11439
- getID(): Optional<string>;
11632
+ getJid(): string;
11440
11633
  /**
11441
- * Returns the initiator of the session instance.
11442
- *
11443
- * @returns {JitsiParticipant|string} The participant that started the session.
11634
+ * Gets the value of a property of this participant.
11444
11635
  */
11445
- getInitiator(): JitsiParticipant | string;
11636
+ getProperty(name: string): any;
11446
11637
  /**
11447
- * Returns the streaming URL of the session.
11448
- *
11449
- * @returns {Optional<string>}
11638
+ * @returns {String} The role of this participant.
11450
11639
  */
11451
- getLiveStreamViewURL(): Optional<string>;
11640
+ getRole(): string;
11452
11641
  /**
11453
- * Returns the current status of the session.
11454
- *
11455
- * @returns {Optional<string>}
11642
+ * Returns the sources associated with this participant.
11643
+ * @returns Map<string, Map<string, Object>>
11456
11644
  */
11457
- getStatus(): Optional<string>;
11645
+ getSources(): Map<MediaType, Map<string, ISourceInfo>>;
11458
11646
  /**
11459
- * @returns {Optional<string>}
11647
+ * @returns {String} The stats ID of this participant.
11460
11648
  */
11461
- getJibriJid(): Optional<string>;
11649
+ getStatsID(): string;
11462
11650
  /**
11463
- * Returns the jid of the participant that stopped the session.
11464
- *
11465
- * @returns {JitsiParticipant|string} The participant that stopped the session.
11651
+ * @returns {String} The status of the participant.
11466
11652
  */
11467
- getTerminator(): JitsiParticipant | string;
11653
+ getStatus(): string;
11468
11654
  /**
11469
- * Returns the current recording mode of the session, such as "file".
11470
- *
11471
- * @returns {string}
11655
+ * @returns {Array.<JitsiRemoteTrack>} The list of media tracks for this
11656
+ * participant.
11472
11657
  */
11473
- getMode(): string;
11658
+ getTracks(): (JitsiRemoteTrack)[];
11474
11659
  /**
11475
- * Sets the last known error message related to the session.
11476
- *
11477
- * @param {string} error - The error string explaining why the session
11478
- * entered an error state.
11479
- * @returns {void}
11660
+ * @param {MediaType} mediaType
11661
+ * @returns {Array.<JitsiRemoteTrack>} an array of media tracks for this
11662
+ * participant, for given media type.
11480
11663
  */
11481
- setError(error: string): void;
11664
+ getTracksByMediaType(mediaType: MediaType): (JitsiRemoteTrack)[];
11482
11665
  /**
11483
- * Sets the last live stream URL for the session instance. Usually this is
11484
- * a YouTube URL and usually this is only set for "stream" sessions.
11485
- *
11486
- * @param {string} url - The live stream URL associated with the session.
11487
- * @returns {void}
11666
+ * Checks current set features.
11667
+ * @param {String} feature - the feature to check.
11668
+ * @return {boolean} <tt>true</tt> if this <tt>participant</tt> contains the
11669
+ * <tt>feature</tt>.
11488
11670
  */
11489
- setLiveStreamViewURL(url: string): void;
11671
+ hasFeature(feature: string): boolean;
11490
11672
  /**
11491
- * Sets the last known status for this recording session.
11492
- *
11493
- * @param {string} status - The new status to set.
11494
- * @returns {void}
11673
+ * @returns {Boolean} Whether this participant has muted their audio.
11495
11674
  */
11496
- setStatus(status?: string): void;
11675
+ isAudioMuted(): boolean;
11497
11676
  /**
11498
- * Set the session status reported by jicofo. If a jibri is present in the room,
11499
- * the status is always 'on'. Otherwise, we fallback to the status reported by jicofo.
11500
- *
11501
- * @param {string} status
11677
+ * @returns {Boolean} Whether this participant is a hidden participant. Some
11678
+ * special system participants may want to join hidden (like for example the
11679
+ * recorder).
11502
11680
  */
11503
- setStatusFromJicofo(status: string): void;
11681
+ isHidden(): boolean;
11504
11682
  /**
11505
- * Set the JID of the jibri associated with this session.
11506
- *
11507
- * @param {*} jibriJid
11683
+ * @returns {Boolean} Whether this participant is a hidden participant. Some
11684
+ * special system participants may want to join hidden (like for example the
11685
+ * recorder).
11508
11686
  */
11509
- setJibriJid(jibriJid: Nullable<string>): void;
11687
+ isHiddenFromRecorder(): boolean;
11510
11688
  /**
11511
- * Sets the participant that started the session.
11512
- * @param {JitsiParticipant | string} participant - The participant or resource id
11513
- * if local participant.
11689
+ * @returns {Boolean} Whether this participant is a moderator or not.
11514
11690
  */
11515
- setInitiator(participant: JitsiParticipant | string): void;
11691
+ isModerator(): boolean;
11516
11692
  /**
11517
- * Sets the participant that stopped the session.
11518
- * @param {JitsiParticipant | string} participant - The participant or the resource id
11519
- * if local participant.
11693
+ * @returns {Boolean} Wheter this participants will be replaced by another
11694
+ * participant in the meeting.
11520
11695
  */
11521
- setTerminator(participant: JitsiParticipant | string): void;
11696
+ isReplaced(): boolean;
11522
11697
  /**
11523
- * Sends a message to start the actual recording.
11524
- *
11525
- * @param {Object} options - Additional arguments for starting therecording.
11526
- * @param {string} [options.appData] - Data specific to the app/service that the result file will be uploaded.
11527
- * @param {string} [options.broadcastId] - The broadcast ID of an associated YouTube stream, used for knowing the
11528
- * URL from which the stream can be viewed.
11529
- * @param {string} options.focusMucJid - The JID of the focus participant that controls recording.
11530
- * @param {streamId} options.streamId - Necessary for live streaming, this is the stream key needed to start a live
11531
- * streaming session with the streaming service provider.
11532
- * @returns Promise
11698
+ * @returns {Boolean} Whether this participant replaces another participant
11699
+ * from the meeting.
11533
11700
  */
11534
- start({ appData, broadcastId, focusMucJid, streamId }: IStartOptions): Promise<void>;
11701
+ isReplacing(): boolean;
11535
11702
  /**
11536
- * Sends a message to actually stop the recording session.
11537
- *
11538
- * @param {Object} options - Additional arguments for stopping the recording.
11539
- * @param {Object} options.focusMucJid - The JID of the focus participant that controls recording.
11540
- * @returns Promise
11703
+ * @returns {Boolean} Whether this participant has joined without audio.
11541
11704
  */
11542
- stop({ focusMucJid }: IStopOptions): Promise<any>;
11705
+ isSilent(): boolean;
11543
11706
  /**
11544
- * Generates the message to change the status of the recording session.
11545
- *
11546
- * @param {string} [options.action] - The action to set the IQ
11547
- * @param {string} [options.appData] - Data specific to the app/service that
11548
- * the result file will be uploaded.
11549
- * @param {string} [options.broadcastId] - The broadcast ID of an
11550
- * associated YouTube stream, used for knowing the URL from which the stream
11551
- * can be viewed.
11552
- * @param {string} options.focusMucJid - The JID of the focus participant
11553
- * that controls recording.
11554
- * @param {streamId} options.streamId - Necessary for live streaming, this
11555
- * is the stream key needed to start a live streaming session with the
11556
- * streaming service provider.
11557
- * @returns Object - The XMPP IQ message.
11707
+ * @returns {Boolean} Whether this participant has muted their video.
11558
11708
  */
11559
- _createIQ({ action, appData, broadcastId, focusMucJid, streamId }: IQOptions): any;
11709
+ isVideoMuted(): boolean;
11560
11710
  /**
11561
- * Handles the error from an iq and stores the error.
11562
- *
11563
- * @param {Node} errorIq - The error response from an Iq.
11564
- * @private
11565
- * @returns {void}
11711
+ * Sets the bot type for the participant.
11712
+ * @param {String} newBotType - The new bot type to set.
11566
11713
  */
11567
- _setErrorFromIq(errorIq: any): void;
11714
+ setBotType(newBotType: string): void;
11568
11715
  /**
11569
- * Sets the known session ID for this recording session.
11570
- *
11571
- * @param {string} sessionID
11572
- * @private
11573
- * @returns {void}
11716
+ * Sets the connection jid for the participant.
11717
+ * @param {String} newJid - The connection jid to set.
11574
11718
  */
11575
- _setSessionID(sessionID?: string): void;
11576
- }
11577
- }
11578
- declare module "modules/statistics/constants" {
11579
- /**
11580
- * The number of remote speakers for which the audio levels will be calculated using
11581
- * RTCRtpReceiver#getSynchronizationSources. Limit the number of endpoints to save cpu on the client as this API call
11582
- * is known to take longer to execute when there are many audio receivers.
11583
- */
11584
- export const SPEAKERS_AUDIO_LEVELS: number;
11585
- }
11586
- declare module "JitsiConferenceEventManager" {
11587
- import JitsiConference from "JitsiConference";
11588
- /**
11589
- * Setups all event listeners related to conference
11590
- */
11591
- export default class JitsiConferenceEventManager {
11592
- private conference;
11593
- private xmppListeners;
11594
- private chatRoomForwarder?;
11719
+ setConnectionJid(newJid: string): void;
11595
11720
  /**
11596
- * Setups all event listeners related to conference
11597
- * @param conference {JitsiConference} the conference
11721
+ * Set new features.
11722
+ * @param {Set<String>|undefined} newFeatures - Sets new features.
11598
11723
  */
11599
- constructor(conference: JitsiConference);
11724
+ setFeatures(newFeatures?: Set<string>): void;
11600
11725
  /**
11601
- * Add XMPP listener and save its reference for remove on leave conference.
11602
- * @param {string} eventName - The event name.
11603
- * @param {Function} listener - The listener function.
11604
- * @private
11726
+ * Sets whether participant is being replaced by another based on jwt.
11727
+ * @param {boolean} newIsReplaced - whether is being replaced.
11605
11728
  */
11606
- private _addConferenceXMPPListener;
11729
+ setIsReplaced(newIsReplaced: boolean): void;
11607
11730
  /**
11608
- * Setups event listeners related to conference.chatRoom
11731
+ * Sets whether participant is replacing another based on jwt.
11732
+ * @param {boolean} newIsReplacing - whether is replacing.
11609
11733
  */
11610
- setupChatRoomListeners(): void;
11734
+ setIsReplacing(newIsReplacing: boolean): void;
11611
11735
  /**
11612
- * Setups event listeners related to conference.rtc
11736
+ * Sets whether participant has joined without audio.
11737
+ * @param {boolean} newIsSilent - whether is silent.
11613
11738
  */
11614
- setupRTCListeners(): void;
11739
+ setIsSilent(newIsSilent: boolean): void;
11615
11740
  /**
11616
- * Setups event listeners related to conference.statistics
11741
+ * Sets the value of a property of this participant, and fires an event if
11742
+ * the value has changed.
11743
+ * @param {string} name the name of the property.
11744
+ * @param {any} value the value to set.
11617
11745
  */
11618
- setupStatisticsListeners(): void;
11746
+ setProperty(name: string, value: any): void;
11619
11747
  /**
11620
- * Setups event listeners related to conference.xmpp
11748
+ * Sets a new participant role.
11749
+ * @param {String} newRole - the new role.
11621
11750
  */
11622
- setupXMPPListeners(): void;
11751
+ setRole(newRole: string): void;
11623
11752
  /**
11624
- * Removes event listeners related to conference.xmpp
11753
+ *
11625
11754
  */
11626
- removeXMPPListeners(): void;
11755
+ supportsDTMF(): boolean;
11756
+ }
11757
+ }
11758
+ declare module "modules/recording/recordingXMLUtils" {
11759
+ /**
11760
+ * A collection of utility functions for taking in XML and parsing it to return
11761
+ * certain values.
11762
+ */
11763
+ export interface IFocusRecordingUpdate {
11764
+ error?: string;
11765
+ initiator?: string;
11766
+ recordingMode?: string;
11767
+ sessionID?: string;
11768
+ status?: string;
11769
+ }
11770
+ export interface IHiddenDomainUpdate {
11771
+ liveStreamViewURL?: string;
11772
+ mode?: string;
11773
+ sessionID?: string;
11627
11774
  }
11775
+ /**
11776
+ * Parses the presence update of the focus and returns an object with the
11777
+ * statuses related to recording.
11778
+ *
11779
+ * @param {Element} presence - An XMPP presence update.
11780
+ * @returns {Optional<Object>} The current presence values related to recording.
11781
+ */
11782
+ export function getFocusRecordingUpdate(presence: Element): Optional<IFocusRecordingUpdate>;
11783
+ /**
11784
+ * Parses the presence update from a hidden domain participant and returns
11785
+ * an object with the statuses related to recording.
11786
+ *
11787
+ * @param {Element} presence - An XMPP presence update.
11788
+ * @returns {Object} The current presence values related to recording.
11789
+ */
11790
+ export function getHiddenDomainUpdate(presence: Element): IHiddenDomainUpdate;
11791
+ /**
11792
+ * Returns the recording session ID from a successful IQ.
11793
+ *
11794
+ * @param {Element} response - The response from the IQ.
11795
+ * @returns {string} The session ID of the recording session.
11796
+ */
11797
+ export function getSessionIdFromIq(response: Element): Nullable<string>;
11798
+ /**
11799
+ * Returns the recording session ID from a presence, if it exists.
11800
+ *
11801
+ * @param {Element} presence - An XMPP presence update.
11802
+ * @returns {string|null|undefined} The session ID of the recording session.
11803
+ */
11804
+ export function getSessionId(presence: Element): Optional<Nullable<string>>;
11805
+ /**
11806
+ * Returns whether or not a presence is from the focus.
11807
+ *
11808
+ * @param {Element} presence - An XMPP presence update.
11809
+ * @returns {boolean} True if the presence is from the focus.
11810
+ */
11811
+ export function isFromFocus(presence: Element): boolean;
11628
11812
  }
11629
- declare module "service/connectivity/ConnectionQualityEvents" {
11630
- export enum ConnectionQualityEvents {
11631
- /**
11632
- * Indicates that the local connection statistics were updated.
11633
- */
11634
- LOCAL_STATS_UPDATED = "cq.local_stats_updated",
11635
- /**
11636
- * Indicates that the connection statistics for a particular remote participant
11637
- * were updated.
11638
- */
11639
- REMOTE_STATS_UPDATED = "cq.remote_stats_updated"
11813
+ declare module "modules/recording/JibriSession" {
11814
+ import JitsiParticipant from "JitsiParticipant";
11815
+ import XmppConnection from "modules/xmpp/XmppConnection";
11816
+ export interface IJibriSessionOptions {
11817
+ connection?: XmppConnection;
11818
+ focusMucJid?: string;
11819
+ mode?: string;
11820
+ sessionID?: string;
11821
+ status?: string;
11640
11822
  }
11641
- }
11642
- declare module "modules/connectivity/ConnectionQuality" {
11643
- import JitsiConference, { IConferenceOptions } from "JitsiConference";
11644
- import EventEmitter from "modules/util/EventEmitter";
11645
- export interface ILocalStats {
11646
- bandwidth?: {
11647
- download?: number;
11648
- upload?: number;
11649
- };
11650
- bitrate?: {
11651
- upload: number;
11652
- };
11653
- bridgeCount?: number;
11654
- connectionQuality: number;
11655
- jvbRTT?: number;
11656
- maxEnabledResolution?: {
11657
- height: number;
11658
- width: number;
11659
- };
11660
- packetLoss?: {
11661
- upload?: number;
11662
- };
11663
- serverRegion?: string;
11823
+ export interface IStartOptions {
11824
+ appData?: string;
11825
+ broadcastId?: string;
11826
+ focusMucJid: string;
11827
+ streamId?: string;
11828
+ }
11829
+ export interface IStopOptions {
11830
+ focusMucJid: string;
11831
+ }
11832
+ export interface IQOptions {
11833
+ action?: 'start' | 'stop';
11834
+ appData?: string;
11835
+ broadcastId?: string;
11836
+ focusMucJid: string;
11837
+ streamId?: string;
11664
11838
  }
11665
- export type IRemoteStats = Pick<ILocalStats, 'bitrate' | 'connectionQuality' | 'jvbRTT' | 'maxEnabledResolution' | 'packetLoss' | 'serverRegion'>;
11666
11839
  /**
11667
- * A class which monitors the local statistics coming from the RTC modules, and
11668
- * calculates a "connection quality" value, in percent, for the media
11669
- * connection. A value of 100% indicates a very good network connection, and a
11670
- * value of 0% indicates a poor connection.
11840
+ * Represents a recording session.
11671
11841
  */
11672
- export default class ConnectionQuality {
11673
- private eventEmitter;
11674
- private _conference;
11675
- private _localStats;
11676
- private _lastConnectionQualityUpdate;
11677
- private _options;
11678
- private _remoteStats;
11679
- private _timeIceConnected;
11680
- private _timeVideoUnmuted;
11842
+ export default class JibriSession {
11843
+ private _connection?;
11844
+ private _mode?;
11845
+ private _jibriJid;
11846
+ private _statusFromJicofo;
11847
+ private _sessionID?;
11848
+ private _status?;
11849
+ private _error?;
11850
+ private _liveStreamViewURL?;
11851
+ private _initiator?;
11852
+ private _terminator?;
11853
+ private _focusMucJid?;
11681
11854
  /**
11855
+ * Initializes a new JibriSession instance.
11682
11856
  *
11683
- * @param conference
11684
- * @param eventEmitter
11685
- * @param options
11857
+ * @constructor
11686
11858
  */
11687
- constructor(conference: JitsiConference, eventEmitter: EventEmitter, options: IConferenceOptions);
11859
+ constructor(options?: IJibriSessionOptions);
11688
11860
  /**
11689
- * Broadcasts the local statistics to all other participants in the
11690
- * conference.
11861
+ * Returns the error related to the session instance, if any.
11862
+ *
11863
+ * @returns {Optional<string>}
11691
11864
  */
11692
- private _broadcastLocalStats;
11865
+ getError(): Optional<string>;
11693
11866
  /**
11694
- * Calculates a new "connection quality" value.
11695
- * @param videoType {VideoType} the type of the video source (camera or a screen capture).
11696
- * @param isMuted {boolean} whether the local video is muted.
11697
- * @param resolutionName {Resolution} the input resolution used by the camera.
11698
- * @returns {*} the newly calculated connection quality.
11867
+ * Returns the session ID of the session instance.
11868
+ *
11869
+ * @returns {Optional<string>}
11699
11870
  */
11700
- private _calculateConnectionQuality;
11871
+ getID(): Optional<string>;
11701
11872
  /**
11702
- * Sets _timeVideoUnmuted if it was previously unset. If it was already set,
11703
- * doesn't change it.
11873
+ * Returns the initiator of the session instance.
11874
+ *
11875
+ * @returns {JitsiParticipant|string} The participant that started the session.
11704
11876
  */
11705
- private _maybeUpdateUnmuteTime;
11877
+ getInitiator(): JitsiParticipant | string;
11706
11878
  /**
11707
- * Resets the time video was unmuted and triggers a new ramp-up.
11879
+ * Returns the streaming URL of the session.
11708
11880
  *
11709
- * @private
11710
- * @returns {void}
11881
+ * @returns {Optional<string>}
11711
11882
  */
11712
- private _resetVideoUnmuteTime;
11883
+ getLiveStreamViewURL(): Optional<string>;
11713
11884
  /**
11714
- * Updates the localConnectionQuality value
11715
- * @param values {number} the new value. Should be in [0, 100].
11885
+ * Returns the current status of the session.
11886
+ *
11887
+ * @returns {Optional<string>}
11716
11888
  */
11717
- private _updateLocalConnectionQuality;
11889
+ getStatus(): Optional<string>;
11718
11890
  /**
11719
- * Updates the local statistics
11720
- * @param {TraceablePeerConnection} tpc the peerconnection which emitted
11721
- * the stats
11722
- * @param data new statistics
11891
+ * @returns {Optional<string>}
11723
11892
  */
11724
- private _updateLocalStats;
11893
+ getJibriJid(): Optional<string>;
11725
11894
  /**
11726
- * Updates remote statistics
11727
- * @param id the id of the remote participant
11728
- * @param data the statistics received
11895
+ * Returns the jid of the participant that stopped the session.
11896
+ *
11897
+ * @returns {JitsiParticipant|string} The participant that stopped the session.
11729
11898
  */
11730
- private _updateRemoteStats;
11899
+ getTerminator(): JitsiParticipant | string;
11731
11900
  /**
11732
- * Returns the local statistics.
11733
- * Exported only for use in jitsi-meet-torture.
11901
+ * Returns the current recording mode of the session, such as "file".
11902
+ *
11903
+ * @returns {string}
11734
11904
  */
11735
- getStats(): ILocalStats;
11736
- }
11737
- }
11738
- declare module "modules/connectivity/IceFailedHandling" {
11739
- import JitsiConference from "JitsiConference";
11740
- /**
11741
- * This class deals with shenanigans around JVB media session's ICE failed status handling.
11742
- *
11743
- * If ICE connection is not re-established within 2 secs after the internet comes back online, the client will initiate
11744
- * a session restart via 'session-terminate'. This results in Jicofo re-inviting the participant into the conference by
11745
- * recreating the jvb media session so that there is minimla disruption to the user by default.
11746
- */
11747
- export default class IceFailedHandling {
11748
- private _conference;
11749
- private _canceled;
11750
- private _iceFailedTimeout?;
11905
+ getMode(): string;
11751
11906
  /**
11752
- * Creates new {@code DelayedIceFailed} task.
11753
- * @param {JitsiConference} conference
11907
+ * Sets the last known error message related to the session.
11908
+ *
11909
+ * @param {string} error - The error string explaining why the session
11910
+ * entered an error state.
11911
+ * @returns {void}
11754
11912
  */
11755
- constructor(conference: JitsiConference);
11913
+ setError(error: string): void;
11756
11914
  /**
11757
- * After making sure there's no way for the ICE connection to recover this method either sends ICE failed
11758
- * notification to Jicofo or emits the ice failed conference event.
11759
- * @private
11915
+ * Sets the last live stream URL for the session instance. Usually this is
11916
+ * a YouTube URL and usually this is only set for "stream" sessions.
11917
+ *
11918
+ * @param {string} url - The live stream URL associated with the session.
11760
11919
  * @returns {void}
11761
11920
  */
11762
- _actOnIceFailed(): void;
11921
+ setLiveStreamViewURL(url: string): void;
11763
11922
  /**
11764
- * Starts the task.
11923
+ * Sets the last known status for this recording session.
11924
+ *
11925
+ * @param {string} status - The new status to set.
11765
11926
  * @returns {void}
11766
11927
  */
11767
- start(): void;
11928
+ setStatus(status?: string): void;
11768
11929
  /**
11769
- * Cancels the task.
11770
- * @returns {void}
11930
+ * Set the session status reported by jicofo. If a jibri is present in the room,
11931
+ * the status is always 'on'. Otherwise, we fallback to the status reported by jicofo.
11932
+ *
11933
+ * @param {string} status
11771
11934
  */
11772
- cancel(): void;
11773
- }
11774
- }
11775
- declare module "modules/detection/NoAudioSignalDetection" {
11776
- import type JitsiConference from "JitsiConference";
11777
- import EventEmitter from "modules/util/EventEmitter";
11778
- /**
11779
- * Detect if there is no audio input on the current TraceAblePeerConnection selected track. The no audio
11780
- * state must be constant for a configured amount of time in order for the event to be triggered.
11781
- * @fires DetectionEvents.AUDIO_INPUT_STATE_CHANGE
11782
- * @fires DetectionEvents.NO_AUDIO_INPUT
11783
- */
11784
- export default class NoAudioSignalDetection extends EventEmitter {
11785
- private _conference;
11786
- private _timeoutTrigger;
11787
- private _hasAudioInput;
11788
- private _audioTrack;
11789
- private _eventFired;
11935
+ setStatusFromJicofo(status: string): void;
11790
11936
  /**
11791
- * Creates new NoAudioSignalDetection.
11937
+ * Set the JID of the jibri associated with this session.
11792
11938
  *
11793
- * @param conference the JitsiConference instance that created us.
11794
- * @constructor
11939
+ * @param {*} jibriJid
11940
+ */
11941
+ setJibriJid(jibriJid: Nullable<string>): void;
11942
+ /**
11943
+ * Sets the participant that started the session.
11944
+ * @param {JitsiParticipant | string} participant - The participant or resource id
11945
+ * if local participant.
11946
+ */
11947
+ setInitiator(participant: JitsiParticipant | string): void;
11948
+ /**
11949
+ * Sets the participant that stopped the session.
11950
+ * @param {JitsiParticipant | string} participant - The participant or the resource id
11951
+ * if local participant.
11795
11952
  */
11796
- constructor(conference: JitsiConference);
11953
+ setTerminator(participant: JitsiParticipant | string): void;
11797
11954
  /**
11798
- * Clear the timeout state.
11955
+ * Sends a message to start the actual recording.
11956
+ *
11957
+ * @param {Object} options - Additional arguments for starting therecording.
11958
+ * @param {string} [options.appData] - Data specific to the app/service that the result file will be uploaded.
11959
+ * @param {string} [options.broadcastId] - The broadcast ID of an associated YouTube stream, used for knowing the
11960
+ * URL from which the stream can be viewed.
11961
+ * @param {string} options.focusMucJid - The JID of the focus participant that controls recording.
11962
+ * @param {streamId} options.streamId - Necessary for live streaming, this is the stream key needed to start a live
11963
+ * streaming session with the streaming service provider.
11964
+ * @returns Promise
11799
11965
  */
11800
- private _clearTriggerTimeout;
11966
+ start({ appData, broadcastId, focusMucJid, streamId }: IStartOptions): Promise<void>;
11801
11967
  /**
11802
- * Generated event triggered by a change in the current conference audio input state.
11968
+ * Sends a message to actually stop the recording session.
11803
11969
  *
11804
- * @param {number} audioLevel - The audio level of the ssrc.
11805
- * @fires DetectionEvents.AUDIO_INPUT_STATE_CHANGE
11970
+ * @param {Object} options - Additional arguments for stopping the recording.
11971
+ * @param {Object} options.focusMucJid - The JID of the focus participant that controls recording.
11972
+ * @returns Promise
11806
11973
  */
11807
- private _handleAudioInputStateChange;
11974
+ stop({ focusMucJid }: IStopOptions): Promise<any>;
11808
11975
  /**
11809
- * Generate event triggered by a prolonged period of no audio input.
11976
+ * Generates the message to change the status of the recording session.
11810
11977
  *
11811
- * @param {number} audioLevel - The audio level of the ssrc.
11812
- * @fires DetectionEvents.NO_AUDIO_INPUT
11978
+ * @param {string} [options.action] - The action to set the IQ
11979
+ * @param {string} [options.appData] - Data specific to the app/service that
11980
+ * the result file will be uploaded.
11981
+ * @param {string} [options.broadcastId] - The broadcast ID of an
11982
+ * associated YouTube stream, used for knowing the URL from which the stream
11983
+ * can be viewed.
11984
+ * @param {string} options.focusMucJid - The JID of the focus participant
11985
+ * that controls recording.
11986
+ * @param {streamId} options.streamId - Necessary for live streaming, this
11987
+ * is the stream key needed to start a live streaming session with the
11988
+ * streaming service provider.
11989
+ * @returns Object - The XMPP IQ message.
11813
11990
  */
11814
- private _handleNoAudioInputDetection;
11991
+ _createIQ({ action, appData, broadcastId, focusMucJid, streamId }: IQOptions): any;
11815
11992
  /**
11816
- * Receives audio level events for all send and receive streams on the current TraceablePeerConnection.
11993
+ * Handles the error from an iq and stores the error.
11817
11994
  *
11818
- * @param {TraceablePeerConnection} tpc - TraceablePeerConnection of the owning conference.
11819
- * @param {number} ssrc - The synchronization source identifier (SSRC) of the endpoint/participant/stream
11820
- * being reported.
11821
- * @param {number} audioLevel - The audio level of the ssrc.
11822
- * @param {boolean} isLocal - true for local/send streams or false for remote/receive streams.
11995
+ * @param {Node} errorIq - The error response from an Iq.
11996
+ * @private
11997
+ * @returns {void}
11823
11998
  */
11824
- private _audioLevel;
11999
+ _setErrorFromIq(errorIq: any): void;
11825
12000
  /**
11826
- * Notifies NoAudioSignalDetection that a JitsiTrack was added to the associated JitsiConference.
11827
- * Only take into account local audio tracks.
12001
+ * Sets the known session ID for this recording session.
11828
12002
  *
11829
- * @param {JitsiTrack} track - The added JitsiTrack.
12003
+ * @param {string} sessionID
12004
+ * @private
12005
+ * @returns {void}
11830
12006
  */
11831
- private _trackAdded;
12007
+ _setSessionID(sessionID?: string): void;
11832
12008
  }
11833
12009
  }
11834
- declare module "modules/detection/P2PDominantSpeakerDetection" {
11835
- import JitsiConference from "JitsiConference";
12010
+ declare module "modules/statistics/constants" {
11836
12011
  /**
11837
- * The <tt>P2PDominantSpeakerDetection</tt> is activated only when p2p is
11838
- * currently used.
11839
- * Listens for changes in the audio level changes of the local p2p audio track
11840
- * or remote p2p one and fires dominant speaker events to be able to use
11841
- * features depending on those events (speaker stats), to make them work without
11842
- * the video bridge.
12012
+ * The number of remote speakers for which the audio levels will be calculated using
12013
+ * RTCRtpReceiver#getSynchronizationSources. Limit the number of endpoints to save cpu on the client as this API call
12014
+ * is known to take longer to execute when there are many audio receivers.
11843
12015
  */
11844
- export default class P2PDominantSpeakerDetection {
11845
- private conference;
11846
- private myUserID;
11847
- /**
11848
- * Creates P2PDominantSpeakerDetection
11849
- * @param conference the JitsiConference instance that created us.
11850
- * @constructor
11851
- */
11852
- constructor(conference: JitsiConference);
11853
- /**
11854
- * Receives audio level events for all streams in the conference.
11855
- *
11856
- * @param {String} id - The participant id
11857
- * @param {number} audioLevel - The audio level.
11858
- */
11859
- private _audioLevel;
11860
- }
12016
+ export const SPEAKERS_AUDIO_LEVELS: number;
11861
12017
  }
11862
- declare module "modules/detection/VADNoiseDetection" {
11863
- import EventEmitter from "modules/util/EventEmitter";
11864
- import { IVADScore } from "modules/detection/VADAudioAnalyser";
12018
+ declare module "JitsiConferenceEventManager" {
12019
+ import JitsiConference from "JitsiConference";
11865
12020
  /**
11866
- * Detect if provided VAD score and PCM data is considered noise.
12021
+ * Setups all event listeners related to conference
11867
12022
  */
11868
- export default class VADNoiseDetection extends EventEmitter {
11869
- /**
11870
- * Flag which denotes the current state of the detection service i.e.if there is already a processing operation
11871
- * ongoing.
11872
- */
11873
- private _processing;
11874
- /**
11875
- * Buffer that keeps the VAD scores for a period of time.
11876
- */
11877
- private _scoreArray;
11878
- /**
11879
- * Buffer that keeps audio level samples for a period of time.
11880
- */
11881
- private _audioLvlArray;
11882
- /**
11883
- * Current state of the service, if it's not active no processing will occur.
11884
- */
11885
- private _active;
12023
+ export default class JitsiConferenceEventManager {
12024
+ private conference;
12025
+ private xmppListeners;
12026
+ private chatRoomForwarder?;
11886
12027
  /**
11887
- * Timeout reference for processing VAD scores.
12028
+ * Setups all event listeners related to conference
12029
+ * @param conference {JitsiConference} the conference
11888
12030
  */
11889
- private _processTimeout?;
12031
+ constructor(conference: JitsiConference);
11890
12032
  /**
11891
- * Creates <tt>VADNoiseDetection</tt>
11892
- *
11893
- * @constructor
12033
+ * Add XMPP listener and save its reference for remove on leave conference.
12034
+ * @param {string} eventName - The event name.
12035
+ * @param {Function} listener - The listener function.
12036
+ * @private
11894
12037
  */
11895
- constructor();
12038
+ private _addConferenceXMPPListener;
11896
12039
  /**
11897
- * Compute cumulative VAD score and PCM audio levels once the PROCESS_TIME_FRAME_SPAN_MS timeout has elapsed.
11898
- * If the score is above the set threshold fire the event.
11899
- * @returns {void}
11900
- * @fires VAD_NOISY_DEVICE
12040
+ * Setups event listeners related to conference.chatRoom
11901
12041
  */
11902
- private _calculateNoisyScore;
12042
+ setupChatRoomListeners(): void;
11903
12043
  /**
11904
- * Set the active state of the detection service and notify any listeners.
11905
- *
11906
- * @param {boolean} active
11907
- * @fires DETECTOR_STATE_CHANGE
12044
+ * Setups event listeners related to conference.rtc
11908
12045
  */
11909
- private _setActiveState;
12046
+ setupRTCListeners(): void;
11910
12047
  /**
11911
- * Record the vad score and average volume in the appropriate buffers.
11912
- *
11913
- * @param {number} vadScore
11914
- * @param {number} avgAudioLvl - average audio level of the PCM sample associated with the VAD score.s
12048
+ * Setups event listeners related to conference.statistics
11915
12049
  */
11916
- private _recordValues;
12050
+ setupStatisticsListeners(): void;
11917
12051
  /**
11918
- * Change the state according to the muted status of the tracked device.
11919
- *
11920
- * @param {boolean} isMuted - Is the device muted or not.
12052
+ * Setups event listeners related to conference.xmpp
11921
12053
  */
11922
- changeMuteState(isMuted: boolean): void;
12054
+ setupXMPPListeners(): void;
11923
12055
  /**
11924
- * Check whether or not the service is active or not.
11925
- *
11926
- * @returns {boolean}
12056
+ * Removes event listeners related to conference.xmpp
11927
12057
  */
11928
- isActive(): boolean;
12058
+ removeXMPPListeners(): void;
12059
+ }
12060
+ }
12061
+ declare module "service/connectivity/ConnectionQualityEvents" {
12062
+ export enum ConnectionQualityEvents {
11929
12063
  /**
11930
- * Listens for {@link TrackVADEmitter} events and processes them.
11931
- *
11932
- * @param {Object} vadScore -VAD score emitted by {@link TrackVADEmitter}
11933
- * @param {number} vadScore.timestamp - Exact time at which processed PCM sample was generated.
11934
- * @param {number} vadScore.score - VAD score on a scale from 0 to 1 (i.e. 0.7)
11935
- * @param {Float32Array} vadScore.pcmData - Raw PCM Data associated with the VAD score.
11936
- * @param {string} vadScore.deviceId - Device id of the associated track.
11937
- * @listens VAD_SCORE_PUBLISHED
12064
+ * Indicates that the local connection statistics were updated.
11938
12065
  */
11939
- processVADScore(vadScore: IVADScore): void;
12066
+ LOCAL_STATS_UPDATED = "cq.local_stats_updated",
11940
12067
  /**
11941
- * Reset the processing context, clear buffers, cancel the timeout trigger.
11942
- *
11943
- * @returns {void}
12068
+ * Indicates that the connection statistics for a particular remote participant
12069
+ * were updated.
11944
12070
  */
11945
- reset(): void;
12071
+ REMOTE_STATS_UPDATED = "cq.remote_stats_updated"
11946
12072
  }
11947
12073
  }
11948
- declare module "modules/detection/VADTalkMutedDetection" {
12074
+ declare module "modules/connectivity/ConnectionQuality" {
12075
+ import JitsiConference, { IConferenceOptions } from "JitsiConference";
11949
12076
  import EventEmitter from "modules/util/EventEmitter";
11950
- export interface IVADScore {
11951
- deviceId: string;
11952
- score: number;
11953
- timestamp: number;
12077
+ export interface ILocalStats {
12078
+ bandwidth?: {
12079
+ download?: number;
12080
+ upload?: number;
12081
+ };
12082
+ bitrate?: {
12083
+ upload: number;
12084
+ };
12085
+ bridgeCount?: number;
12086
+ connectionQuality: number;
12087
+ jvbRTT?: number;
12088
+ maxEnabledResolution?: {
12089
+ height: number;
12090
+ width: number;
12091
+ };
12092
+ packetLoss?: {
12093
+ upload?: number;
12094
+ };
12095
+ serverRegion?: string;
11954
12096
  }
12097
+ export type IRemoteStats = Pick<ILocalStats, 'bitrate' | 'connectionQuality' | 'jvbRTT' | 'maxEnabledResolution' | 'packetLoss' | 'serverRegion'>;
11955
12098
  /**
11956
- * Detect if provided VAD score which is generated on a muted device is voice and fires an event.
12099
+ * A class which monitors the local statistics coming from the RTC modules, and
12100
+ * calculates a "connection quality" value, in percent, for the media
12101
+ * connection. A value of 100% indicates a very good network connection, and a
12102
+ * value of 0% indicates a poor connection.
11957
12103
  */
11958
- export default class VADTalkMutedDetection extends EventEmitter {
11959
- private _processing;
11960
- private _scoreArray;
11961
- private _active;
11962
- private _processTimeout?;
12104
+ export default class ConnectionQuality {
12105
+ private eventEmitter;
12106
+ private _conference;
12107
+ private _localStats;
12108
+ private _lastConnectionQualityUpdate;
12109
+ private _options;
12110
+ private _remoteStats;
12111
+ private _timeIceConnected;
12112
+ private _timeVideoUnmuted;
11963
12113
  /**
11964
- * Creates <tt>VADTalkMutedDetection</tt>
11965
- * @constructor
12114
+ *
12115
+ * @param conference
12116
+ * @param eventEmitter
12117
+ * @param options
11966
12118
  */
11967
- constructor();
12119
+ constructor(conference: JitsiConference, eventEmitter: EventEmitter, options: IConferenceOptions);
11968
12120
  /**
11969
- * Compute cumulative VAD score function called once the PROCESS_TIME_FRAME_SPAN_MS timeout has elapsed.
11970
- * @returns {void}
11971
- * @fires VAD_TALK_WHILE_MUTED
12121
+ * Broadcasts the local statistics to all other participants in the
12122
+ * conference.
12123
+ */
12124
+ private _broadcastLocalStats;
12125
+ /**
12126
+ * Calculates a new "connection quality" value.
12127
+ * @param videoType {VideoType} the type of the video source (camera or a screen capture).
12128
+ * @param isMuted {boolean} whether the local video is muted.
12129
+ * @param resolutionName {Resolution} the input resolution used by the camera.
12130
+ * @returns {*} the newly calculated connection quality.
11972
12131
  */
11973
- private _calculateVADScore;
12132
+ private _calculateConnectionQuality;
11974
12133
  /**
11975
- * Set the active state of the detection service and notify any listeners.
11976
- *
11977
- * @param {boolean} active
11978
- * @fires DETECTOR_STATE_CHANGE
12134
+ * Sets _timeVideoUnmuted if it was previously unset. If it was already set,
12135
+ * doesn't change it.
11979
12136
  */
11980
- private _setActiveState;
12137
+ private _maybeUpdateUnmuteTime;
11981
12138
  /**
11982
- * Change the state according to the muted status of the tracked device.
12139
+ * Resets the time video was unmuted and triggers a new ramp-up.
11983
12140
  *
11984
- * @param {boolean} isMuted - Is the device muted or not.
12141
+ * @private
12142
+ * @returns {void}
11985
12143
  */
11986
- changeMuteState(isMuted: boolean): void;
12144
+ private _resetVideoUnmuteTime;
11987
12145
  /**
11988
- * Check whether or not the service is active or not.
11989
- *
11990
- * @returns {boolean}
12146
+ * Updates the localConnectionQuality value
12147
+ * @param values {number} the new value. Should be in [0, 100].
11991
12148
  */
11992
- isActive(): boolean;
12149
+ private _updateLocalConnectionQuality;
11993
12150
  /**
11994
- * Listens for {@link TrackVADEmitter} events and processes them.
11995
- *
11996
- * @param {Object} vadScore -VAD score emitted by {@link TrackVADEmitter}
11997
- * @param {number} vadScore.timestamp - Exact time at which processed PCM sample was generated.
11998
- * @param {number} vadScore.score - VAD score on a scale from 0 to 1 (i.e. 0.7)
11999
- * @param {string} vadScore.deviceId - Device id of the associated track.
12000
- * @listens VAD_SCORE_PUBLISHED
12151
+ * Updates the local statistics
12152
+ * @param {TraceablePeerConnection} tpc the peerconnection which emitted
12153
+ * the stats
12154
+ * @param data new statistics
12001
12155
  */
12002
- processVADScore(vadScore: IVADScore): void;
12156
+ private _updateLocalStats;
12003
12157
  /**
12004
- * Reset the processing context, clear buffer, cancel the timeout trigger.
12005
- *
12006
- * @returns {void}
12158
+ * Updates remote statistics
12159
+ * @param id the id of the remote participant
12160
+ * @param data the statistics received
12007
12161
  */
12008
- reset(): void;
12009
- }
12010
- }
12011
- declare module "service/e2eping/E2ePingEvents" {
12012
- export enum E2ePingEvents {
12162
+ private _updateRemoteStats;
12013
12163
  /**
12014
- * Indicates that the end-to-end round-trip-time for a participant has changed.
12164
+ * Returns the local statistics.
12165
+ * Exported only for use in jitsi-meet-torture.
12015
12166
  */
12016
- E2E_RTT_CHANGED = "e2eping.e2e_rtt_changed"
12167
+ getStats(): ILocalStats;
12017
12168
  }
12018
12169
  }
12019
- declare module "modules/e2eping/e2eping" {
12170
+ declare module "modules/connectivity/IceFailedHandling" {
12020
12171
  import JitsiConference from "JitsiConference";
12021
- import JitsiParticipant from "JitsiParticipant";
12022
- export interface IPingMessage {
12023
- id: number;
12024
- type: string;
12025
- }
12026
- export interface IE2ePingOptions {
12027
- e2eping?: {
12028
- enabled?: boolean;
12029
- maxConferenceSize?: number;
12030
- maxMessagesPerSecond?: number;
12031
- numRequests?: number;
12032
- };
12033
- }
12034
- export interface IRequest {
12035
- id: number;
12036
- rtt?: number;
12037
- timeSent: number;
12038
- }
12039
12172
  /**
12040
- * Saves e2e ping related state for a single JitsiParticipant.
12173
+ * This class deals with shenanigans around JVB media session's ICE failed status handling.
12174
+ *
12175
+ * If ICE connection is not re-established within 2 secs after the internet comes back online, the client will initiate
12176
+ * a session restart via 'session-terminate'. This results in Jicofo re-inviting the participant into the conference by
12177
+ * recreating the jvb media session so that there is minimla disruption to the user by default.
12041
12178
  */
12042
- class ParticipantWrapper {
12043
- participant: JitsiParticipant;
12044
- e2eping: E2ePing;
12045
- id: string;
12046
- requests: {
12047
- [key: number]: IRequest;
12048
- };
12049
- lastRequestId: number;
12050
- timeout: Nullable<number>;
12051
- /**
12052
- * Creates a ParticipantWrapper
12053
- * @param {JitsiParticipant} participant - The remote participant that this
12054
- * object wraps.
12055
- * @param {E2ePing} e2eping
12056
- */
12057
- constructor(participant: JitsiParticipant, e2eping: E2ePing);
12058
- /**
12059
- * Schedule the next ping to be sent.
12060
- */
12061
- scheduleNext(): number;
12062
- /**
12063
- * Stop pinging this participant, canceling a scheduled ping, if any.
12064
- */
12065
- stop(): void;
12179
+ export default class IceFailedHandling {
12180
+ private _conference;
12181
+ private _canceled;
12182
+ private _iceFailedTimeout?;
12066
12183
  /**
12067
- * Get the delay until the next ping in milliseconds.
12184
+ * Creates new {@code DelayedIceFailed} task.
12185
+ * @param {JitsiConference} conference
12068
12186
  */
12069
- getDelay(): number;
12187
+ constructor(conference: JitsiConference);
12070
12188
  /**
12071
- * Sends the next ping request.
12072
- * @type {*}
12189
+ * After making sure there's no way for the ICE connection to recover this method either sends ICE failed
12190
+ * notification to Jicofo or emits the ice failed conference event.
12191
+ * @private
12192
+ * @returns {void}
12073
12193
  */
12074
- sendRequest(): void;
12194
+ _actOnIceFailed(): void;
12075
12195
  /**
12076
- * Handles a response from this participant.
12077
- * @type {*}
12196
+ * Starts the task.
12197
+ * @returns {void}
12078
12198
  */
12079
- handleResponse(response: any): void;
12199
+ start(): void;
12080
12200
  /**
12081
- * Check if we've received the pre-configured number of responses, and if
12082
- * so log the measured RTT and stop sending requests.
12083
- * @type {*}
12201
+ * Cancels the task.
12202
+ * @returns {void}
12084
12203
  */
12085
- maybeLogRttAndStop(): void;
12204
+ cancel(): void;
12086
12205
  }
12206
+ }
12207
+ declare module "modules/detection/NoAudioSignalDetection" {
12208
+ import type JitsiConference from "JitsiConference";
12209
+ import EventEmitter from "modules/util/EventEmitter";
12087
12210
  /**
12088
- * Implements end-to-end ping (from one conference participant to another) via
12089
- * the jitsi-videobridge channel (either WebRTC data channel or web socket).
12090
- *
12091
- * TODO: use a broadcast message instead of individual pings to each remote
12092
- * participant.
12093
- *
12094
- * This class:
12095
- * 1. Sends periodic ping requests to all other participants in the
12096
- * conference.
12097
- * 2. Responds to ping requests from other participants.
12098
- * 3. Fires events with the end-to-end RTT to each participant whenever a
12099
- * response is received.
12100
- * 4. Fires analytics events with the end-to-end RTT periodically.
12211
+ * Detect if there is no audio input on the current TraceAblePeerConnection selected track. The no audio
12212
+ * state must be constant for a configured amount of time in order for the event to be triggered.
12213
+ * @fires DetectionEvents.AUDIO_INPUT_STATE_CHANGE
12214
+ * @fires DetectionEvents.NO_AUDIO_INPUT
12101
12215
  */
12102
- export default class E2ePing {
12103
- conference: JitsiConference;
12104
- eventEmitter: any;
12105
- sendMessage: (message: IPingMessage, participantId: string) => void;
12106
- participants: {
12107
- [key: string]: ParticipantWrapper;
12108
- };
12109
- numRequests: number;
12110
- maxConferenceSize: number;
12111
- maxMessagesPerSecond: number;
12216
+ export default class NoAudioSignalDetection extends EventEmitter {
12217
+ private _conference;
12218
+ private _timeoutTrigger;
12219
+ private _hasAudioInput;
12220
+ private _audioTrack;
12221
+ private _eventFired;
12112
12222
  /**
12113
- * @param {JitsiConference} conference - The conference.
12114
- * @param {Function} sendMessage - The function to use to send a message.
12115
- * @param {Object} options
12223
+ * Creates new NoAudioSignalDetection.
12224
+ *
12225
+ * @param conference the JitsiConference instance that created us.
12226
+ * @constructor
12116
12227
  */
12117
- constructor(conference: JitsiConference, options: IE2ePingOptions, sendMessage: (message: IPingMessage, participantId: string) => void);
12228
+ constructor(conference: JitsiConference);
12118
12229
  /**
12119
- * Delay processing USER_JOINED events until the MUC is fully joined,
12120
- * otherwise the apparent conference size will be wrong.
12230
+ * Clear the timeout state.
12121
12231
  */
12122
- conferenceJoined(): void;
12232
+ private _clearTriggerTimeout;
12123
12233
  /**
12124
- * Handles a message that was received.
12234
+ * Generated event triggered by a change in the current conference audio input state.
12125
12235
  *
12126
- * @param participant - The message sender.
12127
- * @param payload - The payload of the message.
12236
+ * @param {number} audioLevel - The audio level of the ssrc.
12237
+ * @fires DetectionEvents.AUDIO_INPUT_STATE_CHANGE
12128
12238
  */
12129
- messageReceived(participant: JitsiParticipant, payload: IPingMessage): void;
12239
+ private _handleAudioInputStateChange;
12130
12240
  /**
12131
- * Handles a participant joining the conference. Starts to send ping
12132
- * requests to the participant.
12241
+ * Generate event triggered by a prolonged period of no audio input.
12133
12242
  *
12134
- * @param {String} id - The ID of the participant.
12135
- * @param {JitsiParticipant} participant - The participant that joined.
12136
- */
12137
- participantJoined(id: string, participant: JitsiParticipant): void;
12138
- /**
12139
- * Remove a participant without calling "stop".
12243
+ * @param {number} audioLevel - The audio level of the ssrc.
12244
+ * @fires DetectionEvents.NO_AUDIO_INPUT
12140
12245
  */
12141
- removeParticipant(id: string): void;
12246
+ private _handleNoAudioInputDetection;
12142
12247
  /**
12143
- * Handles a participant leaving the conference. Stops sending requests.
12248
+ * Receives audio level events for all send and receive streams on the current TraceablePeerConnection.
12144
12249
  *
12145
- * @param {String} id - The ID of the participant.
12250
+ * @param {TraceablePeerConnection} tpc - TraceablePeerConnection of the owning conference.
12251
+ * @param {number} ssrc - The synchronization source identifier (SSRC) of the endpoint/participant/stream
12252
+ * being reported.
12253
+ * @param {number} audioLevel - The audio level of the ssrc.
12254
+ * @param {boolean} isLocal - true for local/send streams or false for remote/receive streams.
12146
12255
  */
12147
- participantLeft(id: string): void;
12256
+ private _audioLevel;
12148
12257
  /**
12149
- * Handles a ping request coming from another participant.
12258
+ * Notifies NoAudioSignalDetection that a JitsiTrack was added to the associated JitsiConference.
12259
+ * Only take into account local audio tracks.
12150
12260
  *
12151
- * @param {string} participantId - The ID of the participant who sent the
12152
- * request.
12153
- * @param {Object} request - The request.
12154
- */
12155
- handleRequest(participantId: string, request: {
12156
- id: number;
12157
- }): void;
12158
- /**
12159
- * Handles a ping response coming from another participant
12160
- * @param {string} participantId - The ID of the participant who sent the
12161
- * response.
12162
- * @param {Object} response - The response.
12163
- */
12164
- handleResponse(participantId: string, response: {
12165
- id: number;
12166
- }): void;
12167
- /**
12168
- * Stops this E2ePing (i.e. stop sending requests).
12261
+ * @param {JitsiTrack} track - The added JitsiTrack.
12169
12262
  */
12170
- stop(): void;
12263
+ private _trackAdded;
12171
12264
  }
12172
12265
  }
12173
- declare module "modules/litemode/LiteModeContext" {
12266
+ declare module "modules/detection/P2PDominantSpeakerDetection" {
12174
12267
  import JitsiConference from "JitsiConference";
12175
12268
  /**
12176
- * This module implements a discard-all insertable stream. Use to reduce decoder CPU load for testing.
12269
+ * The <tt>P2PDominantSpeakerDetection</tt> is activated only when p2p is
12270
+ * currently used.
12271
+ * Listens for changes in the audio level changes of the local p2p audio track
12272
+ * or remote p2p one and fires dominant speaker events to be able to use
12273
+ * features depending on those events (speaker stats), to make them work without
12274
+ * the video bridge.
12177
12275
  */
12178
- export class LiteModeContext {
12179
- private enabled;
12276
+ export default class P2PDominantSpeakerDetection {
12277
+ private conference;
12278
+ private myUserID;
12180
12279
  /**
12181
- * A constructor.
12182
- * @param {JitsiConference} conference - The conference instance for which lite mode is to be enabled.
12280
+ * Creates P2PDominantSpeakerDetection
12281
+ * @param conference the JitsiConference instance that created us.
12282
+ * @constructor
12183
12283
  */
12184
12284
  constructor(conference: JitsiConference);
12185
12285
  /**
12186
- * Setup Lite Mode for a track.
12286
+ * Receives audio level events for all streams in the conference.
12187
12287
  *
12188
- * @private
12288
+ * @param {String} id - The participant id
12289
+ * @param {number} audioLevel - The audio level.
12189
12290
  */
12190
- private _setupLiteModeForTrack;
12291
+ private _audioLevel;
12191
12292
  }
12192
12293
  }
12193
- declare module "modules/qualitycontrol/CodecSelection" {
12194
- import JitsiConference from "JitsiConference";
12195
- import JitsiLocalTrack from "modules/RTC/JitsiLocalTrack";
12196
- import JingleSessionPC from "modules/xmpp/JingleSessionPC";
12197
- export interface ICodecSelectionOptions {
12198
- [connectionType: string]: {
12199
- disabledCodec?: string;
12200
- enableAV1ForFF?: boolean;
12201
- preferenceOrder?: string[];
12202
- preferredCodec?: string;
12203
- screenshareCodec?: string;
12204
- };
12205
- }
12206
- export type CodecPreferenceOrder = {
12207
- [connectionType: string]: string[];
12208
- };
12209
- export type ScreenshareCodec = {
12210
- [connectionType: string]: string;
12211
- };
12294
+ declare module "modules/detection/VADNoiseDetection" {
12295
+ import EventEmitter from "modules/util/EventEmitter";
12296
+ import { IVADScore } from "modules/detection/VADAudioAnalyser";
12212
12297
  /**
12213
- * This class handles the codec selection mechanism for the conference based on the config.js settings.
12214
- * The preferred codec is selected based on the settings and the list of codecs supported by the browser.
12215
- * The preferred codec is published in presence which is then used by the other endpoints in the
12216
- * conference to pick a supported codec at join time and when the call transitions between p2p and jvb
12217
- * connections.
12298
+ * Detect if provided VAD score and PCM data is considered noise.
12218
12299
  */
12219
- export class CodecSelection {
12220
- private codecPreferenceOrder;
12221
- private conference;
12222
- private encodeTimeStats;
12223
- private options;
12224
- private screenshareCodec;
12225
- private visitorCodecs;
12300
+ export default class VADNoiseDetection extends EventEmitter {
12226
12301
  /**
12227
- * Creates a new instance for a given conference.
12302
+ * Flag which denotes the current state of the detection service i.e.if there is already a processing operation
12303
+ * ongoing.
12304
+ */
12305
+ private _processing;
12306
+ /**
12307
+ * Buffer that keeps the VAD scores for a period of time.
12308
+ */
12309
+ private _scoreArray;
12310
+ /**
12311
+ * Buffer that keeps audio level samples for a period of time.
12312
+ */
12313
+ private _audioLvlArray;
12314
+ /**
12315
+ * Current state of the service, if it's not active no processing will occur.
12316
+ */
12317
+ private _active;
12318
+ /**
12319
+ * Timeout reference for processing VAD scores.
12320
+ */
12321
+ private _processTimeout?;
12322
+ /**
12323
+ * Creates <tt>VADNoiseDetection</tt>
12228
12324
  *
12229
- * @param {JitsiConference} conference the conference instance
12230
- * @param {*} options
12231
- * @param {string} options.jvb settings (codec list, preferred and disabled) for the jvb connection.
12232
- * @param {string} options.p2p settings (codec list, preferred and disabled) for the p2p connection.
12325
+ * @constructor
12233
12326
  */
12234
- constructor(conference: JitsiConference, options: ICodecSelectionOptions);
12327
+ constructor();
12235
12328
  /**
12236
- * Returns a list of video codecs that are supported by the browser.
12329
+ * Compute cumulative VAD score and PCM audio levels once the PROCESS_TIME_FRAME_SPAN_MS timeout has elapsed.
12330
+ * If the score is above the set threshold fire the event.
12331
+ * @returns {void}
12332
+ * @fires VAD_NOISY_DEVICE
12333
+ */
12334
+ private _calculateNoisyScore;
12335
+ /**
12336
+ * Set the active state of the detection service and notify any listeners.
12237
12337
  *
12238
- * @param {string} connectionType - media connection type, p2p or jvb.
12239
- * @returns {Array}
12338
+ * @param {boolean} active
12339
+ * @fires DETECTOR_STATE_CHANGE
12240
12340
  */
12241
- _getSupportedVideoCodecs(connectionType: string): string[];
12341
+ private _setActiveState;
12242
12342
  /**
12243
- * Returns the current codec preference order for the given connection type.
12343
+ * Record the vad score and average volume in the appropriate buffers.
12244
12344
  *
12245
- * @param {String} connectionType The media connection type, 'p2p' or 'jvb'.
12246
- * @returns {Array<string>}
12345
+ * @param {number} vadScore
12346
+ * @param {number} avgAudioLvl - average audio level of the PCM sample associated with the VAD score.s
12247
12347
  */
12248
- getCodecPreferenceList(connectionType: string): string[];
12348
+ private _recordValues;
12249
12349
  /**
12250
- * Returns the preferred screenshare codec for the given connection type.
12350
+ * Change the state according to the muted status of the tracked device.
12251
12351
  *
12252
- * @param {Optional} connectionType The media connection type, 'p2p' or 'jvb'.
12253
- * @returns CodecMimeType
12352
+ * @param {boolean} isMuted - Is the device muted or not.
12254
12353
  */
12255
- getScreenshareCodec(connectionType: string): Optional<string>;
12354
+ changeMuteState(isMuted: boolean): void;
12256
12355
  /**
12257
- * Sets the codec on the media session based on the codec preference order configured in config.js and the supported
12258
- * codecs published by the remote participants in their presence.
12356
+ * Check whether or not the service is active or not.
12259
12357
  *
12260
- * @param {JingleSessionPC} mediaSession session for which the codec selection has to be made.
12358
+ * @returns {boolean}
12261
12359
  */
12262
- selectPreferredCodec(mediaSession?: JingleSessionPC): void;
12360
+ isActive(): boolean;
12263
12361
  /**
12264
- * Changes the codec preference order.
12362
+ * Listens for {@link TrackVADEmitter} events and processes them.
12265
12363
  *
12266
- * @param {JitsiLocalTrack} localTrack - The local video track.
12267
- * @param {CodecMimeType} codec - The codec used for encoding the given local video track.
12268
- * @returns boolean - Returns true if the codec order has been updated, false otherwise.
12364
+ * @param {Object} vadScore -VAD score emitted by {@link TrackVADEmitter}
12365
+ * @param {number} vadScore.timestamp - Exact time at which processed PCM sample was generated.
12366
+ * @param {number} vadScore.score - VAD score on a scale from 0 to 1 (i.e. 0.7)
12367
+ * @param {Float32Array} vadScore.pcmData - Raw PCM Data associated with the VAD score.
12368
+ * @param {string} vadScore.deviceId - Device id of the associated track.
12369
+ * @listens VAD_SCORE_PUBLISHED
12269
12370
  */
12270
- changeCodecPreferenceOrder(localTrack: JitsiLocalTrack, codec: string): boolean;
12371
+ processVADScore(vadScore: IVADScore): void;
12271
12372
  /**
12272
- * Updates the aggregate list of the codecs supported by all the visitors in the call and calculates the
12273
- * selected codec if needed.
12274
- * @param {Array} codecList - visitor codecs.
12373
+ * Reset the processing context, clear buffers, cancel the timeout trigger.
12374
+ *
12275
12375
  * @returns {void}
12276
12376
  */
12277
- updateVisitorCodecs(codecList: string[]): void;
12377
+ reset(): void;
12278
12378
  }
12279
12379
  }
12280
- declare module "modules/qualitycontrol/ReceiveAudioController" {
12281
- import JitsiConference from "JitsiConference";
12282
- import { IReceiverAudioSubscriptionMessage, ReceiverAudioSubscription } from "service/RTC/ReceiverAudioSubscription";
12380
+ declare module "modules/detection/VADTalkMutedDetection" {
12381
+ import EventEmitter from "modules/util/EventEmitter";
12382
+ export interface IVADScore {
12383
+ deviceId: string;
12384
+ score: number;
12385
+ timestamp: number;
12386
+ }
12283
12387
  /**
12284
- * Controller for managing audio subscriptions in a Jitsi conference. It allows subscribing to remote audio streams
12285
- * based on different modes such as ALL, EXCLUDE, INCLUDE, and NONE.
12388
+ * Detect if provided VAD score which is generated on a muted device is voice and fires an event.
12286
12389
  */
12287
- export class ReceiverAudioController {
12288
- private _rtc;
12390
+ export default class VADTalkMutedDetection extends EventEmitter {
12391
+ private _processing;
12392
+ private _scoreArray;
12393
+ private _active;
12394
+ private _processTimeout?;
12289
12395
  /**
12290
- * The list of remote audio sources that the local endpoint is subscribed/unsubscribed to.
12291
- * This is used when the subscription mode is set to INCLUDE or EXCLUDE.
12396
+ * Creates <tt>VADTalkMutedDetection</tt>
12397
+ * @constructor
12292
12398
  */
12293
- private _sourceList;
12399
+ constructor();
12294
12400
  /**
12295
- * The audio subscription options for remote audio streams.
12401
+ * Compute cumulative VAD score function called once the PROCESS_TIME_FRAME_SPAN_MS timeout has elapsed.
12402
+ * @returns {void}
12403
+ * @fires VAD_TALK_WHILE_MUTED
12296
12404
  */
12297
- private _subscriptionMode;
12405
+ private _calculateVADScore;
12298
12406
  /**
12299
- * Creates a new instance of the ReceiverAudioController.
12407
+ * Set the active state of the detection service and notify any listeners.
12408
+ *
12409
+ * @param {boolean} active
12410
+ * @fires DETECTOR_STATE_CHANGE
12300
12411
  */
12301
- constructor(conference: JitsiConference);
12412
+ private _setActiveState;
12302
12413
  /**
12303
- * Gets the current audio subscription option.
12414
+ * Change the state according to the muted status of the tracked device.
12304
12415
  *
12305
- * @returns {ReceiverAudioSubscription} The current audio subscription option.
12416
+ * @param {boolean} isMuted - Is the device muted or not.
12306
12417
  */
12307
- get audioSubscription(): ReceiverAudioSubscription;
12418
+ changeMuteState(isMuted: boolean): void;
12308
12419
  /**
12309
- * Mutes or unmutes the remote audio streams based on the provided parameter.
12420
+ * Check whether or not the service is active or not.
12310
12421
  *
12311
- * @param {boolean} muted - Indicates whether the remote audio should be muted or not.
12312
- * @returns {void}
12422
+ * @returns {boolean}
12313
12423
  */
12314
- muteRemoteAudio(muted: boolean): void;
12424
+ isActive(): boolean;
12315
12425
  /**
12316
- * Sets the audio subscription options.
12426
+ * Listens for {@link TrackVADEmitter} events and processes them.
12427
+ *
12428
+ * @param {Object} vadScore -VAD score emitted by {@link TrackVADEmitter}
12429
+ * @param {number} vadScore.timestamp - Exact time at which processed PCM sample was generated.
12430
+ * @param {number} vadScore.score - VAD score on a scale from 0 to 1 (i.e. 0.7)
12431
+ * @param {string} vadScore.deviceId - Device id of the associated track.
12432
+ * @listens VAD_SCORE_PUBLISHED
12433
+ */
12434
+ processVADScore(vadScore: IVADScore): void;
12435
+ /**
12436
+ * Reset the processing context, clear buffer, cancel the timeout trigger.
12317
12437
  *
12318
- * @param message The audio subscription message containing the mode and optional source list.
12319
12438
  * @returns {void}
12320
12439
  */
12321
- setAudioSubscriptionMode(message: IReceiverAudioSubscriptionMessage): void;
12440
+ reset(): void;
12322
12441
  }
12323
12442
  }
12324
- declare module "modules/qualitycontrol/SendVideoController" {
12443
+ declare module "service/e2eping/E2ePingEvents" {
12444
+ export enum E2ePingEvents {
12445
+ /**
12446
+ * Indicates that the end-to-end round-trip-time for a participant has changed.
12447
+ */
12448
+ E2E_RTT_CHANGED = "e2eping.e2e_rtt_changed"
12449
+ }
12450
+ }
12451
+ declare module "modules/e2eping/e2eping" {
12325
12452
  import JitsiConference from "JitsiConference";
12326
- import JingleSessionPC from "modules/xmpp/JingleSessionPC";
12327
- export interface IVideoConstraint {
12328
- maxHeight: number;
12329
- sourceName: string;
12453
+ import JitsiParticipant from "JitsiParticipant";
12454
+ export interface IPingMessage {
12455
+ id: number;
12456
+ type: string;
12457
+ }
12458
+ export interface IE2ePingOptions {
12459
+ e2eping?: {
12460
+ enabled?: boolean;
12461
+ maxConferenceSize?: number;
12462
+ maxMessagesPerSecond?: number;
12463
+ numRequests?: number;
12464
+ };
12465
+ }
12466
+ export interface IRequest {
12467
+ id: number;
12468
+ rtt?: number;
12469
+ timeSent: number;
12330
12470
  }
12331
12471
  /**
12332
- * The class manages send video constraints across media sessions({@link JingleSessionPC}) which belong to
12333
- * {@link JitsiConference}. It finds the lowest common value, between the local user's send preference and
12334
- * the remote party's receive preference. Also this module will consider only the active session's receive value,
12335
- * because local tracks are shared and while JVB may have no preference, the remote p2p may have and they may be totally
12336
- * different.
12472
+ * Saves e2e ping related state for a single JitsiParticipant.
12337
12473
  */
12338
- export default class SendVideoController {
12339
- private _conference;
12340
- private _preferredSendMaxFrameHeight;
12341
- /**
12342
- * Source name based sender constraints.
12343
- * @type {Map<string, number>};
12344
- */
12345
- private _sourceSenderConstraints;
12474
+ class ParticipantWrapper {
12475
+ participant: JitsiParticipant;
12476
+ e2eping: E2ePing;
12477
+ id: string;
12478
+ requests: {
12479
+ [key: number]: IRequest;
12480
+ };
12481
+ lastRequestId: number;
12482
+ timeout: Nullable<number>;
12346
12483
  /**
12347
- * Creates new instance for a given conference.
12348
- *
12349
- * @param {JitsiConference} conference - the conference instance for which the new instance will be managing
12350
- * the send video quality constraints.
12484
+ * Creates a ParticipantWrapper
12485
+ * @param {JitsiParticipant} participant - The remote participant that this
12486
+ * object wraps.
12487
+ * @param {E2ePing} e2eping
12351
12488
  */
12352
- constructor(conference: JitsiConference);
12489
+ constructor(participant: JitsiParticipant, e2eping: E2ePing);
12353
12490
  /**
12354
- * Figures out the send video constraint as specified by {@link _selectSendMaxFrameHeight} and sets it on all media
12355
- * sessions for the reasons mentioned in this class description.
12356
- *
12357
- * @param {string} sourceName - The source for which sender constraints have changed.
12358
- * @returns {Promise<void>}
12359
- * @private
12491
+ * Schedule the next ping to be sent.
12360
12492
  */
12361
- _propagateSendMaxFrameHeight(sourceName: string): Promise<void>;
12493
+ scheduleNext(): number;
12362
12494
  /**
12363
- * Selects the lowest common value for the local video send constraint by looking at local user's preference and
12364
- * the active media session's receive preference set by the remote party.
12365
- *
12366
- * @param {string} sourceName - The source for which sender constraints have changed.
12367
- * @returns {Optional<number>}
12368
- * @private
12495
+ * Stop pinging this participant, canceling a scheduled ping, if any.
12369
12496
  */
12370
- _selectSendMaxFrameHeight(sourceName: string): Optional<number>;
12497
+ stop(): void;
12371
12498
  /**
12372
- * Configures the video encodings on the local sources when a media connection is established or becomes active.
12373
- *
12374
- * @returns {void}
12499
+ * Get the delay until the next ping in milliseconds.
12375
12500
  */
12376
- configureConstraintsForLocalSources(): void;
12501
+ getDelay(): number;
12377
12502
  /**
12378
- * Handles the {@link JitsiConferenceEvents.MEDIA_SESSION_STARTED}, that is when the conference creates new media
12379
- * session. It doesn't mean it's already active though. For example the JVB connection may be created after
12380
- * the conference has entered the p2p mode already.
12381
- *
12382
- * @param {JingleSessionPC} mediaSession - the started media session.
12503
+ * Sends the next ping request.
12504
+ * @type {*}
12383
12505
  */
12384
- onMediaSessionStarted(mediaSession: JingleSessionPC): void;
12506
+ sendRequest(): void;
12385
12507
  /**
12386
- * Propagates the video constraints if they have changed.
12387
- *
12388
- * @param {IVideoConstraint} videoConstraints - The sender video constraints received from the bridge.
12389
- * @returns {Promise<void>}
12508
+ * Handles a response from this participant.
12509
+ * @type {*}
12390
12510
  */
12391
- onSenderConstraintsReceived(videoConstraints: IVideoConstraint): Promise<void>;
12511
+ handleResponse(response: any): void;
12392
12512
  /**
12393
- * Sets local preference for max send video frame height.
12394
- *
12395
- * @param {number} maxFrameHeight - the new value to set.
12396
- * @returns {Promise<void>} - resolved when the operation is complete.
12513
+ * Check if we've received the pre-configured number of responses, and if
12514
+ * so log the measured RTT and stop sending requests.
12515
+ * @type {*}
12397
12516
  */
12398
- setPreferredSendMaxFrameHeight(maxFrameHeight: number): Promise<void>;
12399
- }
12400
- }
12401
- declare module "modules/qualitycontrol/QualityController" {
12402
- import JitsiConference from "JitsiConference";
12403
- import { CodecMimeType } from "service/RTC/CodecMimeType";
12404
- import JitsiLocalTrack from "modules/RTC/JitsiLocalTrack";
12405
- import TraceablePeerConnection from "modules/RTC/TraceablePeerConnection";
12406
- import { CodecSelection } from "modules/qualitycontrol/CodecSelection";
12407
- import { ReceiverAudioController } from "modules/qualitycontrol/ReceiveAudioController";
12408
- import ReceiveVideoController from "modules/qualitycontrol/ReceiveVideoController";
12409
- import SendVideoController from "modules/qualitycontrol/SendVideoController";
12410
- enum QualityLimitationReason {
12411
- BANDWIDTH = "bandwidth",
12412
- CPU = "cpu",
12413
- NONE = "none"
12414
- }
12415
- interface IResolution {
12416
- height: number;
12417
- width: number;
12418
- }
12419
- interface IOutboundRtpStats {
12420
- codec: CodecMimeType;
12421
- encodeTime: number;
12422
- qualityLimitationReason: QualityLimitationReason;
12423
- resolution: IResolution;
12424
- timestamp: number;
12425
- }
12426
- export interface ISourceStats {
12427
- avgEncodeTime: number;
12428
- codec: CodecMimeType;
12429
- encodeResolution: number;
12430
- localTrack: JitsiLocalTrack;
12431
- qualityLimitationReason: QualityLimitationReason;
12432
- timestamp: number;
12433
- tpc: TraceablePeerConnection;
12434
- }
12435
- export class FixedSizeArray {
12436
- private _data;
12437
- private _maxSize;
12438
- constructor(size: number);
12439
- add(item: ISourceStats): void;
12440
- get(index: number): Optional<ISourceStats>;
12441
- size(): number;
12517
+ maybeLogRttAndStop(): void;
12442
12518
  }
12443
12519
  /**
12444
- * QualityController class that is responsible for maintaining optimal video quality experience on the local endpoint
12445
- * by controlling the codec, encode resolution and receive resolution of the remote video streams. It also makes
12446
- * adjustments based on the outbound and inbound rtp stream stats reported by the underlying peer connection.
12520
+ * Implements end-to-end ping (from one conference participant to another) via
12521
+ * the jitsi-videobridge channel (either WebRTC data channel or web socket).
12522
+ *
12523
+ * TODO: use a broadcast message instead of individual pings to each remote
12524
+ * participant.
12525
+ *
12526
+ * This class:
12527
+ * 1. Sends periodic ping requests to all other participants in the
12528
+ * conference.
12529
+ * 2. Responds to ping requests from other participants.
12530
+ * 3. Fires events with the end-to-end RTT to each participant whenever a
12531
+ * response is received.
12532
+ * 4. Fires analytics events with the end-to-end RTT periodically.
12447
12533
  */
12448
- export class QualityController {
12449
- private _audioController;
12450
- private _codecController;
12451
- private _conference;
12452
- private _enableAdaptiveMode;
12453
- private _encodeTimeStats;
12454
- private _isLastNRampupBlocked;
12455
- private _lastNRampupTime;
12456
- private _lastNRampupTimeout;
12457
- private _limitedByCpuTimeout;
12458
- private _receiveVideoController;
12459
- private _sendVideoController;
12460
- private _timer;
12534
+ export default class E2ePing {
12535
+ conference: JitsiConference;
12536
+ eventEmitter: any;
12537
+ sendMessage: (message: IPingMessage, participantId: string) => void;
12538
+ participants: {
12539
+ [key: string]: ParticipantWrapper;
12540
+ };
12541
+ numRequests: number;
12542
+ maxConferenceSize: number;
12543
+ maxMessagesPerSecond: number;
12461
12544
  /**
12462
- *
12463
- * @param {JitsiConference} conference - The JitsiConference instance.
12464
- * @param {Object} options - video quality settings passed through config.js.
12545
+ * @param {JitsiConference} conference - The conference.
12546
+ * @param {Function} sendMessage - The function to use to send a message.
12547
+ * @param {Object} options
12465
12548
  */
12466
- constructor(conference: JitsiConference, options: {
12467
- enableAdaptiveMode: boolean;
12468
- jvb: object;
12469
- lastNRampupTime: number;
12470
- p2p: object;
12471
- });
12549
+ constructor(conference: JitsiConference, options: IE2ePingOptions, sendMessage: (message: IPingMessage, participantId: string) => void);
12472
12550
  /**
12473
- * Creates a debounced function that delays the execution of the provided function until after the specified delay
12474
- * has elapsed. Unlike typical debounce implementations, the timer does not reset when the function is called again
12475
- * within the delay period.
12476
- *
12477
- * @param {Function} func - The function to be debounced.
12478
- * @param {number} delay - The delay in milliseconds.
12479
- * @returns {Function} - The debounced function.
12551
+ * Delay processing USER_JOINED events until the MUC is fully joined,
12552
+ * otherwise the apparent conference size will be wrong.
12480
12553
  */
12481
- _debounce(func: Function, delay: number): (...args: any) => void;
12554
+ conferenceJoined(): void;
12482
12555
  /**
12483
- * Adjusts the lastN value so that fewer remote video sources are received from the bridge in an attempt to improve
12484
- * encode resolution of the outbound video streams based on cpuLimited parameter passed. If cpuLimited is false,
12485
- * the lastN value will slowly be ramped back up to the channelLastN value set in config.js.
12556
+ * Handles a message that was received.
12486
12557
  *
12487
- * @param {boolean} cpuLimited - whether the endpoint is cpu limited or not.
12488
- * @returns boolean - Returns true if an action was taken, false otherwise.
12489
- */
12490
- _lowerOrRaiseLastN(cpuLimited: boolean): boolean;
12491
- /**
12492
- * Adjusts the requested resolution for remote video sources by updating the receiver constraints in an attempt to
12493
- * improve the encode resolution of the outbound video streams.
12494
- * @return {void}
12558
+ * @param participant - The message sender.
12559
+ * @param payload - The payload of the message.
12495
12560
  */
12496
- _maybeLowerReceiveResolution(): void;
12561
+ messageReceived(participant: JitsiParticipant, payload: IPingMessage): void;
12497
12562
  /**
12498
- * Updates the codec preference order for the local endpoint on the active media session and switches the video
12499
- * codec if needed.
12563
+ * Handles a participant joining the conference. Starts to send ping
12564
+ * requests to the participant.
12500
12565
  *
12501
- * @param {number} trackId - The track ID of the local video track for which stats have been captured.
12502
- * @returns {boolean} - Returns true if video codec was changed.
12566
+ * @param {String} id - The ID of the participant.
12567
+ * @param {JitsiParticipant} participant - The participant that joined.
12503
12568
  */
12504
- _maybeSwitchVideoCodec(trackId: number): boolean;
12569
+ participantJoined(id: string, participant: JitsiParticipant): void;
12505
12570
  /**
12506
- * Adjusts codec, lastN or receive resolution based on the send resolution (of the outbound streams) and limitation
12507
- * reported by the browser in the WebRTC stats. Recovery is also attempted if the limitation goes away. No action
12508
- * is taken if the adaptive mode has been disabled through config.js.
12509
- *
12510
- * @param {ISourceStats} sourceStats - The outbound-rtp stats for a local video track.
12511
- * @returns {void}
12571
+ * Remove a participant without calling "stop".
12512
12572
  */
12513
- _performQualityOptimizations(sourceStats: ISourceStats): void;
12573
+ removeParticipant(id: string): void;
12514
12574
  /**
12515
- * Processes the outbound RTP stream stats as reported by the WebRTC peerconnection and makes runtime adjustments
12516
- * to the client for better quality experience if the adaptive mode is enabled.
12575
+ * Handles a participant leaving the conference. Stops sending requests.
12517
12576
  *
12518
- * @param {TraceablePeerConnection} tpc - The underlying WebRTC peerconnection where stats have been captured.
12519
- * @param {Map<number, IOutboundRtpStats>} stats - Outbound-rtp stream stats per SSRC.
12520
- * @returns void
12577
+ * @param {String} id - The ID of the participant.
12521
12578
  */
12522
- _processOutboundRtpStats(tpc: TraceablePeerConnection, stats: Map<number, IOutboundRtpStats>): void;
12579
+ participantLeft(id: string): void;
12523
12580
  /**
12524
- * Gets the audio controller instance.
12581
+ * Handles a ping request coming from another participant.
12582
+ *
12583
+ * @param {string} participantId - The ID of the participant who sent the
12584
+ * request.
12585
+ * @param {Object} request - The request.
12525
12586
  */
12526
- get audioController(): ReceiverAudioController;
12587
+ handleRequest(participantId: string, request: {
12588
+ id: number;
12589
+ }): void;
12527
12590
  /**
12528
- * Gets the codec controller instance.
12591
+ * Handles a ping response coming from another participant
12592
+ * @param {string} participantId - The ID of the participant who sent the
12593
+ * response.
12594
+ * @param {Object} response - The response.
12529
12595
  */
12530
- get codecController(): CodecSelection;
12596
+ handleResponse(participantId: string, response: {
12597
+ id: number;
12598
+ }): void;
12531
12599
  /**
12532
- * Gets the receive video controller instance.
12600
+ * Stops this E2ePing (i.e. stop sending requests).
12533
12601
  */
12534
- get receiveVideoController(): ReceiveVideoController;
12602
+ stop(): void;
12603
+ }
12604
+ }
12605
+ declare module "modules/litemode/LiteModeContext" {
12606
+ import JitsiConference from "JitsiConference";
12607
+ /**
12608
+ * This module implements a discard-all insertable stream. Use to reduce decoder CPU load for testing.
12609
+ */
12610
+ export class LiteModeContext {
12611
+ private enabled;
12535
12612
  /**
12536
- * Gets the send video controller instance.
12613
+ * A constructor.
12614
+ * @param {JitsiConference} conference - The conference instance for which lite mode is to be enabled.
12537
12615
  */
12538
- get sendVideoController(): SendVideoController;
12616
+ constructor(conference: JitsiConference);
12539
12617
  /**
12540
- * Cleans up the QualityController by clearing all active timeouts and disposing of controllers.
12541
- * This prevents memory leaks and ensures proper cleanup when the controller is no longer needed.
12618
+ * Setup Lite Mode for a track.
12619
+ *
12620
+ * @private
12542
12621
  */
12543
- dispose(): void;
12622
+ private _setupLiteModeForTrack;
12544
12623
  }
12545
12624
  }
12546
12625
  declare module "modules/recording/RecordingManager" {
@@ -15206,7 +15285,7 @@ declare module "modules/webaudio/AudioMixer" {
15206
15285
  }
15207
15286
  }
15208
15287
  declare module "version" {
15209
- export const COMMIT_HASH = "6912eed8";
15288
+ export const COMMIT_HASH = "1a3c35c0";
15210
15289
  }
15211
15290
  declare module "JitsiMeetJS" {
15212
15291
  import JitsiConference, { IConferenceOptions } from "JitsiConference";