Skip to content

Commit

Permalink
Add loop_index configuration for janus (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
hjopel authored and vincentfretin committed Jun 21, 2023
1 parent 88f66e6 commit 07616e3
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 2 deletions.
48 changes: 48 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,10 @@ class JanusAdapter {
this.onReconnectionError = reconnectionErrorListener;
}

setEventLoops(loops) {
this.loops = loops;
}

connect() {
debug(`connecting to ${this.serverUrl}`);

Expand Down Expand Up @@ -440,7 +444,7 @@ class JanusAdapter {
var conn = new RTCPeerConnection(this.peerConnectionConfig || DEFAULT_PEER_CONNECTION_CONFIG);

debug("pub waiting for sfu");
await handle.attach("janus.plugin.sfu");
await handle.attach("janus.plugin.sfu", this.loops && this.clientId ? parseInt(this.clientId) % this.loops : undefined);

this.associate(conn, handle);

Expand Down Expand Up @@ -580,7 +584,7 @@ class JanusAdapter {
var conn = new RTCPeerConnection(this.peerConnectionConfig || DEFAULT_PEER_CONNECTION_CONFIG);

debug(occupantId + ": sub waiting for sfu");
await handle.attach("janus.plugin.sfu");
await handle.attach("janus.plugin.sfu", this.loops ? parseInt(occupantId) % this.loops : undefined);

this.associate(conn, handle);

Expand Down

0 comments on commit 07616e3

Please sign in to comment.