New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move TraceablePeerConnection to RTC #373
Conversation
conference.getLocalTracks().forEach(function (track) { | ||
var ssrc = track.getSSRC(); | ||
if(!track.isAudioTrack() || !ssrc || !stats.hasOwnProperty(ssrc)) | ||
conference.getLocalTracks(MediaType.AUDIO).forEach(function (track) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this only audio now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the previous code seemed to return early if the track wasn't an audio track, AFAIS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the previous code was returning early for audio tracks just like Saul wrote.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gotcha
modules/RTC/JitsiRemoteTrack.js
Outdated
* @constructor | ||
*/ | ||
function JitsiRemoteTrack(rtc, conference, ownerJid, stream, track, mediaType, videoType, | ||
function JitsiRemoteTrack(rtc, conference, owner, stream, track, mediaType, videoType, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe a personal preference, i think it'd be clearer to rename 'owner' to 'ownerEndpointId'...that way in the code it's self-documenting so you don't have to check the jsdoc to see if it's an object or whatever
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know you've mentioned that already at least one, but I must have missed that fix and it stayed somewhere on top of the old peer-to-peer branch... sorry about that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no prob :)
modules/xmpp/ChatRoom.js
Outdated
// No presence available | ||
return null; | ||
} | ||
let data = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like this could be const?
modules/xmpp/JingleSession.js
Outdated
|
||
/** | ||
* The RTC service instance | ||
* @type {RTC|null} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think in general the convention has been to only document its intended type, and not denote it could be null (i don't think we do that anywhere else, and i don't think we have any type that can't be null, so maybe the |null
is redundant?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It depends whether or not it is expected to handle the null case. Here RTC will be initialised later (not in the constructor), but I would say that the instance should not be used prior to that, so I agree that "|null" can be removed (it is not expected to handle null).
service/RTC/SignallingLayer.js
Outdated
@@ -0,0 +1,40 @@ | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: in the states we'd spell this "SignalingLayer" (one "L" in signaling). apparently "signalling" is the UK way which probably explain why makes my brain feel weird when i read it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@saghul which one do you prefer ? I don't have strong opinion, but would leave it as is only, because I'm too lazy to change it...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nevermind I saw your comment below. Will remove "l"
JitsiConference.js
Outdated
@@ -3,7 +3,7 @@ | |||
var logger = require("jitsi-meet-logger").getLogger(__filename); | |||
import RTC from "./modules/RTC/RTC"; | |||
import * as MediaType from "./service/RTC/MediaType"; | |||
var XMPPEvents = require("./service/xmpp/XMPPEvents"); | |||
var RTCEvents = require("./service/RTC/RTCEvents"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you refactor the imports since you are here? pretty please? 🙏
JitsiConference.js
Outdated
* @return {JitsiLocalTrack|undefined} | ||
*/ | ||
JitsiConference.prototype.getLocalAudioTrack = function () { | ||
return this.rtc ? this.rtc.getLocalAudioTrack() : undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what did we say about undefined vs null on the other PR? /me doesn't remember!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in case we settle on undefined this can be simplified as return this.rtc && this.rtc.getLocalAudioTrack()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd say we did not settle at all I just changed to null that particular case. In my opinion it's fine to use whichever as long as it's stated in JSDoc. Otherwise we would have to ask the whole team and come up with a strict rule.
JitsiConference.js
Outdated
this.transcriber.addTrack(localTrack); | ||
} | ||
}.bind(this)); | ||
this.getLocalTracks(MediaType.AUDIO).forEach( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for..of
JitsiConference.js
Outdated
* @return {JitsiLocalTrack|undefined} | ||
*/ | ||
JitsiConference.prototype.getLocalVideoTrack = function () { | ||
return this.rtc ? this.rtc.getLocalVideoTrack() : undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
JitsiConference.js
Outdated
this.rtc.remoteTracks.forEach(function (remoteTrack){ | ||
if (remoteTrack.isAudioTrack()){ | ||
this.rtc.getRemoteTracks(MediaType.AUDIO).forEach( | ||
function (remoteTrack){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
return; | ||
} | ||
|
||
let muted = peerMediaInfo.muted; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const
* PeerConnection | ||
*/ | ||
TraceablePeerConnection.prototype._remoteStreamRemoved = function (stream) { | ||
const self = this; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔥
// behave unexpectedly (the "user left" event would come before "track | ||
// removed" events). | ||
logger.warn( | ||
"Removed track not found for msid: " + streamId |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use template strings
@@ -259,7 +492,8 @@ var normalizePlanB = function(desc) { | |||
}); | |||
} | |||
|
|||
if (typeof mLine.ssrcs !== 'undefined' && Array.isArray(mLine.ssrcs)) { | |||
if (typeof mLine.ssrcs !== 'undefined' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't the first part of the test be deleted? Array.isArray(undefined)
will be false anyway.
modules/xmpp/SDP.js
Outdated
let msid = null; | ||
// FIXME what is this ? global APP.RTC in SDP ? | ||
const localTrack = APP.RTC.getLocalTracks(mline.media); | ||
if(localTrack) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: space after if
There's no reason to involve the ChatRoom directly into the generation of remote stream added event. It merely provides some info carried in the presence about muted state etc.
also fixes lint errors
Moves part of the XMPP events which are clearly related to the PeerConnection to RTCEvents.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test failures are lip sync, so re-running them.
Yes, lip-sync and start muted. I'm looking into that |
Audio levels were broken. Should be ok now - I'll let you know if the tests pass. |
The purpose of this PR is to move TraceablePeerConnection to the RTC module where it belongs.