Skip to content
This repository was archived by the owner on Oct 23, 2024. It is now read-only.

Commit 6e973c9

Browse files
committed
Add data source for linkup.
1 parent 8232d85 commit 6e973c9

File tree

10 files changed

+19
-17
lines changed

10 files changed

+19
-17
lines changed

source/agent/analytics/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,9 @@ module.exports = function (rpcClient, rpcId, agentId, clusterIp) {
132132
.then(rpcSuccess(callback))
133133
.catch(rpcError(callback));
134134
},
135-
linkup: function (connectionId, audioFrom, videoFrom, callback) {
135+
linkup: function (connectionId, audioFrom, videoFrom, dataFrom, callback) {
136136
log.debug('linkup,','connectionId:',connectionId,'videoFrom:',videoFrom,'callback:',callback);
137-
agent.linkup(connectionId, audioFrom, videoFrom)
137+
agent.linkup(connectionId, audioFrom, videoFrom, dataFrom)
138138
.then(rpcSuccess(callback))
139139
.catch(rpcError(callback));
140140
},

source/agent/audio/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ module.exports = function (rpcClient, selfRpcId, parentRpcId, clusterWorkerIP) {
252252
}
253253
};
254254

255-
that.linkup = function (connectionId, audio_stream_id, video_stream_id, callback) {
255+
that.linkup = function (connectionId, audio_stream_id, video_stream_id, data_stream_id, callback) {
256256
log.debug('linkup, connectionId:', connectionId, 'audio_stream_id:', audio_stream_id);
257257
if (connections[connectionId] === undefined) {
258258
return callback('callback', 'error', 'connection does not exist');

source/agent/base-agent.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,11 @@ class BaseAgent {
132132
*@param {string} connectionId
133133
*@param {string} audioFrom
134134
*@param {string} videoFrom
135+
*@param {string} dataFrom
135136
*/
136-
linkup(connectionId, audioFrom, videoFrom) {
137+
linkup(connectionId, audioFrom, videoFrom, dataFrom) {
137138
log.debug('linkup, connectionId:', connectionId);
138-
return this.connections.linkupConnection(connectionId, audioFrom, videoFrom);
139+
return this.connections.linkupConnection(connectionId, audioFrom, videoFrom, dataFrom);
139140
}
140141

141142
/**

source/agent/conference/roomController.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ module.exports.create = function (spec, on_init_ok, on_init_failed) {
400400
audio = ((streams[stream_id].audio && target_node_type !== 'vmixer' && target_node_type !== 'vxcoder') ? true : false),
401401
video = ((streams[stream_id].video && target_node_type !== 'amixer' && target_node_type !== 'axcoder') ? true : false),
402402
spread_id = stream_id + '@' + target_node;
403-
const data = streams[stream_id].data;
403+
const data = !!streams[stream_id].data;
404404

405405
if (!audio && !video && !data) {
406406
return on_error('Cannot spread stream without audio, video or data.');
@@ -491,6 +491,7 @@ module.exports.create = function (spec, on_init_ok, on_init_failed) {
491491
publisher: publisher,
492492
audio: (audio ? {codec: streams[stream_id].audio.format} : false),
493493
video: (video ? {codec: streams[stream_id].video.format} : false),
494+
data: data,
494495
ip: from.ip,
495496
port: from.port,
496497
}
@@ -520,15 +521,15 @@ module.exports.create = function (spec, on_init_ok, on_init_failed) {
520521
log.debug('internally publish/subscribe ok');
521522

522523
// Linkup after publish/subscribe ready
523-
return new Promise(function (resolve, reject) {
524+
return new Promise(function(resolve, reject) {
524525
makeRPC(
525526
rpcClient,
526527
original_node,
527528
'linkup',
528-
[spread_id, audio ? stream_id : undefined, video ? stream_id : undefined],
529+
[ spread_id, audio ? stream_id : undefined, video ? stream_id : undefined, data ? stream_id : undefined ],
529530
resolve,
530531
reject);
531-
});
532+
});
532533
}).then(function () {
533534
if (streams[stream_id]) {
534535
log.debug('internally linkup ok');

source/agent/quic/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// or |undefined|, which means QuicStream is not ready at this moment. It also
1313
// allows updating its associated QuicStream to a new one.
1414
// publish, unpublish, subscribe, unsubscribe, linkup, cutoff are required by
15-
// all agents. AFAIK, there is no documentation about these interfaces.
15+
// all agents. They are defined in base-agent.js.
1616

1717
'use strict';
1818
const Connections = require('./connections');

source/agent/recording/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ module.exports = function (rpcClient, selfRpcId, parentRpcId, clusterWorkerIP) {
184184
}, onError(callback));
185185
};
186186

187-
that.linkup = function (connectionId, audioFrom, videoFrom, callback) {
187+
that.linkup = function (connectionId, audioFrom, videoFrom, dataFrom, callback) {
188188
connections.linkupConnection(connectionId, audioFrom, videoFrom).then(onSuccess(callback), onError(callback));
189189
};
190190

source/agent/sip/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,7 @@ module.exports = function (rpcC, selfRpcId, parentRpcId, clusterWorkerIP) {
818818
}
819819
};
820820

821-
that.linkup = function (connectionId, audioFrom, videoFrom, callback) {
821+
that.linkup = function (connectionId, audioFrom, videoFrom, dataFrom, callback) {
822822
log.debug('linkup, connectionId:', connectionId, ', audioFrom:', audioFrom, ', videoFrom:', videoFrom);
823823

824824
if (audioFrom && streams[audioFrom] === undefined) {

source/agent/streaming/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ module.exports = function (rpcClient, selfRpcId, parentRpcId, clusterWorkerIP) {
195195
}, onError(callback));
196196
};
197197

198-
that.linkup = function (connectionId, audioFrom, videoFrom, callback) {
198+
that.linkup = function (connectionId, audioFrom, videoFrom, dataFrom, callback) {
199199
connections.linkupConnection(connectionId, audioFrom, videoFrom).then(onSuccess(callback), onError(callback));
200200
};
201201

source/agent/video/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ function VMixer(rpcClient, clusterIP) {
569569
}
570570
};
571571

572-
that.linkup = function (connectionId, audio_stream_id, video_stream_id, callback) {
572+
that.linkup = function (connectionId, audio_stream_id, video_stream_id, data_stream_id, callback) {
573573
log.debug('linkup, connectionId:', connectionId, 'video_stream_id:', video_stream_id);
574574
if (connections[connectionId] === undefined) {
575575
return callback('callback', 'error', 'connection does not exist');
@@ -1028,7 +1028,7 @@ function VTranscoder(rpcClient, clusterIP) {
10281028
}
10291029
};
10301030

1031-
that.linkup = function (connectionId, audio_stream_id, video_stream_id, callback) {
1031+
that.linkup = function (connectionId, audio_stream_id, video_stream_id, data_stream_id, callback) {
10321032
log.debug('linkup, connectionId:', connectionId, 'video_stream_id:', video_stream_id);
10331033
if (connections[connectionId] === undefined) {
10341034
return callback('callback', 'error', 'connection does not exist');

source/agent/webrtc/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,8 +312,8 @@ module.exports = function (rpcClient, selfRpcId, parentRpcId, clusterWorkerIP) {
312312
}
313313
};
314314

315-
that.linkup = function (connectionId, audioFrom, videoFrom, callback) {
316-
log.debug('linkup, connectionId:', connectionId, 'audioFrom:', audioFrom, 'videoFrom:', videoFrom);
315+
that.linkup = function (connectionId, audioFrom, videoFrom, dataFrom, callback) {
316+
log.debug('linkup, connectionId:', connectionId, 'audioFrom:', audioFrom, 'videoFrom:', videoFrom, 'callback:', callback);
317317
connections.linkupConnection(connectionId, audioFrom, videoFrom).then(onSuccess(callback), onError(callback));
318318
};
319319

0 commit comments

Comments
 (0)