vani-meeting-server 1.4.3 → 1.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -106,14 +106,24 @@ class SFUEachRoomHandler extends BaseSFUWebsocket_1.BaseSFUWebsocket {
106
106
  this.addAudioObserver();
107
107
  }
108
108
  }
109
- const totalNumerOfRecieveRouterCanBeCreated = (workers.length - 1) < 1 ? 1 : (workers.length - 1);
110
- while (this.recvRouter.length < totalNumerOfRecieveRouterCanBeCreated) { // Dont create on send worker
111
- const worker = workers[currentWorkerIndexForRouter];
112
- currentWorkerIndexForRouter = this.getWorkerIndexForCreatingRouter(currentWorkerIndexForRouter, workers.length);
113
- if (worker.pid === sendWorkerPID) {
114
- continue;
109
+ if (this.sendRouter) {
110
+ if (workers.length === 1) {
111
+ this.recvRouter.push(this.sendRouter);
112
+ }
113
+ else {
114
+ while (this.recvRouter.length < (workers.length - 1)) { // Dont create on send worker
115
+ const worker = workers[currentWorkerIndexForRouter];
116
+ currentWorkerIndexForRouter = this.getWorkerIndexForCreatingRouter(currentWorkerIndexForRouter, workers.length);
117
+ if (worker.pid === sendWorkerPID) {
118
+ continue;
119
+ }
120
+ this.recvRouter.push(await worker.createRouter({ mediaCodecs: Constant_1.mediaCodecs }));
121
+ console.log("rec router crearted");
122
+ }
115
123
  }
116
- this.recvRouter.push(await worker.createRouter({ mediaCodecs: Constant_1.mediaCodecs }));
124
+ }
125
+ else {
126
+ console.error("no send router found while creating recv router");
117
127
  }
118
128
  this.workers = undefined;
119
129
  this.sendWorkerIndex = -1;
@@ -174,8 +184,13 @@ class SFUEachRoomHandler extends BaseSFUWebsocket_1.BaseSFUWebsocket {
174
184
  return this.sendRouter;
175
185
  }
176
186
  async pipeToRoute(producer) {
177
- if (!this.sendRouter) {
178
- console.error("pipeToRoute - no send router found");
187
+ if (!this.sendRouter || this.recvRouter.length < 1) {
188
+ console.error("pipeToRoute - no send or recv router found");
189
+ return;
190
+ }
191
+ if (this.recvRouter.length === 1 && this.sendRouter === this.recvRouter[0]) {
192
+ console.log("pipeToRoute - recvRouter and send router are same");
193
+ return;
179
194
  }
180
195
  for (const eachRecvRouter of this.recvRouter) {
181
196
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vani-meeting-server",
3
- "version": "1.4.3",
3
+ "version": "1.4.5",
4
4
  "description": "Vani Meeting Server SDK",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",