Exposes methods for obtaining stream SSRCs and audio levels.
This commit is contained in:
parent
286225e81e
commit
0a7cea26b3
|
@ -137,6 +137,22 @@ var statistics = {
|
||||||
CallStats.sendAddIceCandidateFailed(e, pc);
|
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;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,11 @@ function JingleSessionPC(me, sid, connection, service, eventEmitter) {
|
||||||
this.switchstreams = false;
|
this.switchstreams = false;
|
||||||
|
|
||||||
this.wait = true;
|
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.ssrcOwners = {};
|
||||||
this.ssrcVideoTypes = {};
|
this.ssrcVideoTypes = {};
|
||||||
this.eventEmitter = eventEmitter;
|
this.eventEmitter = eventEmitter;
|
||||||
|
@ -552,6 +557,15 @@ JingleSessionPC.prototype.getSsrcOwner = function (ssrc) {
|
||||||
return this.ssrcOwners[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) {
|
JingleSessionPC.prototype.setRemoteDescription = function (elem, desctype) {
|
||||||
this.remoteSDP = new SDP('');
|
this.remoteSDP = new SDP('');
|
||||||
if (config.webrtcIceTcpDisable) {
|
if (config.webrtcIceTcpDisable) {
|
||||||
|
@ -1424,6 +1438,8 @@ JingleSessionPC.prototype.setLocalDescription = function () {
|
||||||
'ssrc': ssrc.id,
|
'ssrc': ssrc.id,
|
||||||
'type': media.type
|
'type': media.type
|
||||||
});
|
});
|
||||||
|
// FIXME allows for only one SSRC per media type
|
||||||
|
self.localStreamsSSRC[media.type] = ssrc.id;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -596,6 +596,19 @@ var XMPP = {
|
||||||
return null;
|
return null;
|
||||||
return connection.jingle.activecall.getSsrcOwner(ssrc);
|
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.
|
// Returns true iff we have joined the MUC.
|
||||||
isMUCJoined: function () {
|
isMUCJoined: function () {
|
||||||
return connection === null ? false : connection.emuc.joined;
|
return connection === null ? false : connection.emuc.joined;
|
||||||
|
|
Loading…
Reference in New Issue