Browse Source

fix(JitsiTrack) Add setSourceName/getSourceName methods to JitsiTrack class.

tags/v0.0.2
Jaya Allamsetty 2 years ago
parent
commit
0fc0a3ff31
3 changed files with 29 additions and 4 deletions
  1. 10
    3
      modules/RTC/JitsiRemoteTrack.js
  2. 17
    0
      modules/RTC/JitsiTrack.js
  3. 2
    1
      modules/xmpp/JingleSessionPC.js

+ 10
- 3
modules/RTC/JitsiRemoteTrack.js View File

265
      * Update the properties when the track is remapped to another source.
265
      * Update the properties when the track is remapped to another source.
266
      *
266
      *
267
      * @param {string} owner The endpoint ID of the new owner.
267
      * @param {string} owner The endpoint ID of the new owner.
268
-     * @param {string} name The new source name.
269
      */
268
      */
270
-    setNewSource(owner, name) {
269
+    setOwner(owner) {
271
         this.ownerEndpointId = owner;
270
         this.ownerEndpointId = owner;
272
-        this._sourceName = name;
273
         this.emit(JitsiTrackEvents.TRACK_OWNER_CHANGED, owner);
271
         this.emit(JitsiTrackEvents.TRACK_OWNER_CHANGED, owner);
274
     }
272
     }
275
 
273
 
274
+    /**
275
+     * Sets the name of the source associated with the remtoe track.
276
+     *
277
+     * @param {string} name - The source name to be associated with the track.
278
+     */
279
+    setSourceName(name) {
280
+        this._sourceName = name;
281
+    }
282
+
276
     /**
283
     /**
277
      * Changes the video type of the track.
284
      * Changes the video type of the track.
278
      *
285
      *

+ 17
- 0
modules/RTC/JitsiTrack.js View File

303
         return this.stream;
303
         return this.stream;
304
     }
304
     }
305
 
305
 
306
+    /**
307
+     * Returns the source name of the track.
308
+     * @returns {String|undefined}
309
+     */
310
+    getSourceName() { // eslint-disable-line no-unused-vars
311
+        // Should be defined by the classes that are extending JitsiTrack
312
+    }
313
+
306
     /**
314
     /**
307
      * Returns the ID of the underlying WebRTC Media Stream(if any)
315
      * Returns the ID of the underlying WebRTC Media Stream(if any)
308
      * @returns {String|null}
316
      * @returns {String|null}
497
                         audioOutputDeviceId);
505
                         audioOutputDeviceId);
498
                 }));
506
                 }));
499
     }
507
     }
508
+
509
+    /**
510
+     * Assigns the source name to a track.
511
+     * @param {String} name - The name to be assigned to the track.
512
+     * @returns {void}
513
+     */
514
+    setSourceName(name) { // eslint-disable-line no-unused-vars
515
+        // Should be defined by the classes that are extending JitsiTrack
516
+    }
500
 }
517
 }

+ 2
- 1
modules/xmpp/JingleSessionPC.js View File

1856
                         track._setVideoType('desktop');
1856
                         track._setVideoType('desktop');
1857
                     }
1857
                     }
1858
 
1858
 
1859
-                    track.setNewSource(s.owner, s.source);
1859
+                    track.setSourceName(s.source);
1860
+                    track.setOwner(s.owner);
1860
                 } else {
1861
                 } else {
1861
                     logger.error(`Remapped SSRC ${s.ssrc} not found`);
1862
                     logger.error(`Remapped SSRC ${s.ssrc} not found`);
1862
                 }
1863
                 }

Loading…
Cancel
Save