Skip to content

Commit

Permalink
Channel: move some ids from internal object to data object (#847)
Browse files Browse the repository at this point in the history
  • Loading branch information
ibc authored Jun 29, 2022
1 parent a63de49 commit f23ecea
Show file tree
Hide file tree
Showing 19 changed files with 114 additions and 59 deletions.
2 changes: 1 addition & 1 deletion node/lib/Consumer.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class Consumer extends EnhancedEventEmitter_1.EnhancedEventEmitter {
* Associated Producer id.
*/
get producerId() {
return this.#internal.producerId;
return this.#data.producerId;
}
/**
* Whether the Consumer is closed.
Expand Down
2 changes: 1 addition & 1 deletion node/lib/DataConsumer.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class DataConsumer extends EnhancedEventEmitter_1.EnhancedEventEmitter {
* Associated DataProducer id.
*/
get dataProducerId() {
return this.#internal.dataProducerId;
return this.#data.dataProducerId;
}
/**
* Whether the DataConsumer is closed.
Expand Down
2 changes: 1 addition & 1 deletion node/lib/PipeTransport.d.ts.map

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

10 changes: 8 additions & 2 deletions node/lib/PipeTransport.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,21 @@ class PipeTransport extends Transport_1.Transport {
throw Error(`Producer with id "${producerId}" not found`);
// This may throw.
const rtpParameters = ortc.getPipeConsumerRtpParameters(producer.consumableRtpParameters, this.#data.rtx);
const internal = { ...this.internal, consumerId: (0, uuid_1.v4)(), producerId };
const internal = { ...this.internal, consumerId: (0, uuid_1.v4)() };
const reqData = {
producerId,
kind: producer.kind,
rtpParameters,
type: 'pipe',
consumableRtpEncodings: producer.consumableRtpParameters.encodings
};
const status = await this.channel.request('transport.consume', internal, reqData);
const data = { kind: producer.kind, rtpParameters, type: 'pipe' };
const data = {
producerId,
kind: producer.kind,
rtpParameters,
type: 'pipe'
};
const consumer = new Consumer_1.Consumer({
internal,
data,
Expand Down
2 changes: 1 addition & 1 deletion node/lib/Router.d.ts.map

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

4 changes: 2 additions & 2 deletions node/lib/Router.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,10 @@ class Router extends EnhancedEventEmitter_1.EnhancedEventEmitter {
}
const internal = {
...this.#internal,
transportId: (0, uuid_1.v4)(),
webRtcServerId: webRtcServer ? webRtcServer.id : undefined
transportId: (0, uuid_1.v4)()
};
const reqData = {
webRtcServerId: webRtcServer ? webRtcServer.id : undefined,
listenIps,
port,
enableUdp,
Expand Down
Loading

0 comments on commit f23ecea

Please sign in to comment.