Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
Exposes methods for obtaining stream SSRCs and audio levels.
paweldomas0a7cea26b3be
diff --git a/modules/statistics/statistics.js b/modules/statistics/statistics.jsindex 9f63b07867..00bf4c0ca4 100644--- a/modules/statistics/statistics.js+++ b/modules/statistics/statistics.js@@ -137,6 +137,22 @@ var statistics = {CallStats.sendAddIceCandidateFailed(e, pc);});+ },+ /**+ * Obtains audio level reported in the stats for specified peer.+ * @param peerJid full MUC jid of the user for whom we want to obtain last+ * audio level.+ * @param ssrc the SSRC of audio stream for which we want to obtain audio+ * level.+ * @returns {*} a float form 0 to 1 that represents current audio level or+ * <tt>null</tt> if for any reason the value is not available+ * at this time.+ */+ getPeerSSRCAudioLevel: function (peerJid, ssrc) {++ var peerStats = rtpStats.jid2stats[peerJid];++ return peerStats ? peerStats.ssrc2AudioLevel[ssrc] : null;}};diff --git a/modules/xmpp/JingleSessionPC.js b/modules/xmpp/JingleSessionPC.jsindex e7772a9d40..dc53b6e015 100644--- a/modules/xmpp/JingleSessionPC.js+++ b/modules/xmpp/JingleSessionPC.js@@ -40,6 +40,11 @@ function JingleSessionPC(me, sid, connection, service, eventEmitter) {this.switchstreams = false;this.wait = true;+ /**+ * A map that stores SSRCs of local streams+ * @type {{}} maps media type('audio' or 'video') to SSRC number+ */+ this.localStreamsSSRC = {};this.ssrcOwners = {};this.ssrcVideoTypes = {};this.eventEmitter = eventEmitter;@@ -552,6 +557,15 @@ JingleSessionPC.prototype.getSsrcOwner = function (ssrc) {return this.ssrcOwners[ssrc];};+/**+ * Returns the SSRC of local audio stream.+ * @param mediaType 'audio' or 'video' media type+ * @returns {*} the SSRC number of local audio or video stream.+ */+JingleSessionPC.prototype.getLocalSSRC = function (mediaType) {+ return this.localStreamsSSRC[mediaType];+};+JingleSessionPC.prototype.setRemoteDescription = function (elem, desctype) {this.remoteSDP = new SDP('');if (config.webrtcIceTcpDisable) {@@ -1424,6 +1438,8 @@ JingleSessionPC.prototype.setLocalDescription = function () {'ssrc': ssrc.id,'type': media.type});+ // FIXME allows for only one SSRC per media type+ self.localStreamsSSRC[media.type] = ssrc.id;});}diff --git a/modules/xmpp/xmpp.js b/modules/xmpp/xmpp.jsindex 3a980a5a4f..0e90713d2a 100644--- a/modules/xmpp/xmpp.js+++ b/modules/xmpp/xmpp.js@@ -596,6 +596,19 @@ var XMPP = {return null;return connection.jingle.activecall.getSsrcOwner(ssrc);},+ /**+ * Gets the SSRC of local media stream.+ * @param mediaType the media type that tells whether we want to get+ * the SSRC of local audio or video stream.+ * @returns {*} the SSRC number for local media stream or <tt>null</tt> if+ * not available.+ */+ getLocalSSRC: function (mediaType) {+ if (!this.isConferenceInProgress()) {+ return null;+ }+ return connection.jingle.activecall.getLocalSSRC(mediaType);+ },// Returns true iff we have joined the MUC.isMUCJoined: function () {return connection === null ? false : connection.emuc.joined;