Skip to content
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

Merged
merged 13 commits into from Feb 28, 2017
Merged

Move TraceablePeerConnection to RTC #373

merged 13 commits into from Feb 28, 2017

Conversation

paweldomas
Copy link
Member

@paweldomas paweldomas commented Feb 27, 2017

The purpose of this PR is to move TraceablePeerConnection to the RTC module where it belongs.

conference.getLocalTracks().forEach(function (track) {
var ssrc = track.getSSRC();
if(!track.isAudioTrack() || !ssrc || !stats.hasOwnProperty(ssrc))
conference.getLocalTracks(MediaType.AUDIO).forEach(function (track) {
Copy link
Member

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?

Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gotcha

* @constructor
*/
function JitsiRemoteTrack(rtc, conference, ownerJid, stream, track, mediaType, videoType,
function JitsiRemoteTrack(rtc, conference, owner, stream, track, mediaType, videoType,
Copy link
Member

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed!

Copy link
Member Author

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no prob :)

// No presence available
return null;
}
let data = {
Copy link
Member

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?


/**
* The RTC service instance
* @type {RTC|null}
Copy link
Member

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?)

Copy link
Member Author

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).

@@ -0,0 +1,40 @@

Copy link
Member

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.

Copy link
Member Author

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...

Copy link
Member Author

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"

@@ -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");
Copy link
Member

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? 🙏

* @return {JitsiLocalTrack|undefined}
*/
JitsiConference.prototype.getLocalAudioTrack = function () {
return this.rtc ? this.rtc.getLocalAudioTrack() : undefined;
Copy link
Member

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!

Copy link
Member

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().

Copy link
Member Author

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.

this.transcriber.addTrack(localTrack);
}
}.bind(this));
this.getLocalTracks(MediaType.AUDIO).forEach(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for..of

* @return {JitsiLocalTrack|undefined}
*/
JitsiConference.prototype.getLocalVideoTrack = function () {
return this.rtc ? this.rtc.getLocalVideoTrack() : undefined;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

this.rtc.remoteTracks.forEach(function (remoteTrack){
if (remoteTrack.isAudioTrack()){
this.rtc.getRemoteTracks(MediaType.AUDIO).forEach(
function (remoteTrack){
Copy link
Member

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;
Copy link
Member

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;
Copy link
Member

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
Copy link
Member

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'
Copy link
Member

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.

let msid = null;
// FIXME what is this ? global APP.RTC in SDP ?
const localTrack = APP.RTC.getLocalTracks(mline.media);
if(localTrack) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: space after if

Copy link
Member

@bbaldino bbaldino left a 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.

@paweldomas
Copy link
Member Author

Yes, lip-sync and start muted. I'm looking into that

@paweldomas
Copy link
Member Author

Audio levels were broken. Should be ok now - I'll let you know if the tests pass.

@bbaldino bbaldino merged commit 12a91dc into master Feb 28, 2017
@paweldomas paweldomas deleted the move_TPC branch March 2, 2017 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants