|
@@ -95,38 +95,37 @@ RTC.prototype.onIncommingCall = function(event) {
|
95
|
95
|
if(this.options.config.openSctp)
|
96
|
96
|
this.dataChannels = new DataChannels(event.peerconnection,
|
97
|
97
|
this.eventEmitter);
|
98
|
|
- for(var i = 0; i < this.localTracks.length; i++)
|
99
|
|
- if(this.localTracks[i])
|
100
|
|
- {
|
101
|
|
- var ssrcInfo = null;
|
102
|
|
- if(this.localTracks[i].isMuted() &&
|
103
|
|
- this.localTracks[i].getType() === MediaType.VIDEO) {
|
104
|
|
- /**
|
105
|
|
- * Handles issues when the stream is added before the peerconnection is created.
|
106
|
|
- * The peerconnection is created when second participant enters the call. In
|
107
|
|
- * that use case the track doesn't have information about it's ssrcs and no
|
108
|
|
- * jingle packets are sent. That can cause inconsistant behavior later.
|
109
|
|
- *
|
110
|
|
- * For example:
|
111
|
|
- * If we mute the stream and than second participant enter it's remote SDP won't
|
112
|
|
- * include that track. On unmute we are not sending any jingle packets which
|
113
|
|
- * will brake the unmute.
|
114
|
|
- *
|
115
|
|
- * In order to solve issues like the above one here we have to generate the ssrc
|
116
|
|
- * information for the track .
|
117
|
|
- */
|
118
|
|
- this.localTracks[i]._setSSRC(
|
119
|
|
- this.room.generateNewStreamSSRCInfo());
|
120
|
|
- ssrcInfo = {
|
121
|
|
- mtype: this.localTracks[i].getType(),
|
122
|
|
- type: "addMuted",
|
123
|
|
- ssrc: this.localTracks[i].ssrc,
|
124
|
|
- msid: this.localTracks[i].initialMSID
|
125
|
|
- }
|
126
|
|
- }
|
127
|
|
- this.room.addStream(this.localTracks[i].getOriginalStream(),
|
128
|
|
- function () {}, ssrcInfo, true);
|
|
98
|
+ // Add local Tracks to the ChatRoom
|
|
99
|
+ this.localTracks.forEach(function(localTrack) {
|
|
100
|
+ var ssrcInfo = null;
|
|
101
|
+ if(localTrack.isVideoTrack() && localTrack.isMuted()) {
|
|
102
|
+ /**
|
|
103
|
+ * Handles issues when the stream is added before the peerconnection
|
|
104
|
+ * is created. The peerconnection is created when second participant
|
|
105
|
+ * enters the call. In that use case the track doesn't have
|
|
106
|
+ * information about it's ssrcs and no jingle packets are sent. That
|
|
107
|
+ * can cause inconsistent behavior later.
|
|
108
|
+ *
|
|
109
|
+ * For example:
|
|
110
|
+ * If we mute the stream and than second participant enter it's
|
|
111
|
+ * remote SDP won't include that track. On unmute we are not sending
|
|
112
|
+ * any jingle packets which will brake the unmute.
|
|
113
|
+ *
|
|
114
|
+ * In order to solve issues like the above one here we have to
|
|
115
|
+ * generate the ssrc information for the track .
|
|
116
|
+ */
|
|
117
|
+ localTrack._setSSRC(
|
|
118
|
+ this.room.generateNewStreamSSRCInfo());
|
|
119
|
+ ssrcInfo = {
|
|
120
|
+ mtype: localTrack.getType(),
|
|
121
|
+ type: "addMuted",
|
|
122
|
+ ssrc: localTrack.ssrc,
|
|
123
|
+ msid: localTrack.initialMSID
|
|
124
|
+ };
|
129
|
125
|
}
|
|
126
|
+ this.room.addStream(
|
|
127
|
+ localTrack.getOriginalStream(), function () {}, ssrcInfo, true);
|
|
128
|
+ }.bind(this));
|
130
|
129
|
};
|
131
|
130
|
|
132
|
131
|
RTC.prototype.selectedEndpoint = function (id) {
|
|
@@ -169,6 +168,9 @@ RTC.getDeviceAvailability = function () {
|
169
|
168
|
};
|
170
|
169
|
|
171
|
170
|
RTC.prototype.addLocalTrack = function (track) {
|
|
171
|
+ if (!track)
|
|
172
|
+ throw new Error('track must not be null nor undefined');
|
|
173
|
+
|
172
|
174
|
this.localTracks.push(track);
|
173
|
175
|
track._setRTC(this);
|
174
|
176
|
|