Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataChannel termination via the new DirectTransport #409

Merged
merged 24 commits into from
May 29, 2020
Merged

Conversation

ibc
Copy link
Member

@ibc ibc commented May 28, 2020

Related to #400

Feature overview

  • Allow the Node application to directly send text/binary messages to mediasoup-worker C++ process so others can consume them using DataConsumer.

  • And vice-versa: allow the Node application to directly consume in Node messages send by DataProducers.

Implementation

  • New DirectTransport (created via router.createDirectTransport) that uses the new PayloadChannel (UnixSocket pair between Node and C++) to send payload messages in both directions.

  • Extend DataProducer and DataConsumer classes to not just work with SCTP capable transports (WebRtcTransport, PlainTransport, PipeTransport) but also with the new DirectTransport.

    • In the latter, there are no "SCTP stream parameters" involved at all.
  • sctpStreamParameters are now optional in DataProducerOptions (just valid for directTransport.produceData()).

    • So dataProducer/Consumer.sctpStreamParameters getter can now return undefined.
  • Added dataProducer/Consumer.type getter, that can be 'sctp' or 'direct'.

  • transport.consumeData() (when in an SCTP capable transport) now accepts optional SCTP related parameters in DataConsumerOptions to tell mediasoup how to deliver messages to the remote SCTP endpoint:

ordered?: boolean;
maxPacketLifeTime?: number;
maxRetransmits?: number;
  • Worker: Added a new message log tag.

Copy link
Member

@jmillan jmillan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

masterpiece 👍

src/Worker.ts Outdated Show resolved Hide resolved
src/Worker.ts Outdated Show resolved Hide resolved
src/DirectTransport.ts Outdated Show resolved Hide resolved
worker/include/RTC/Transport.hpp Outdated Show resolved Hide resolved
worker/src/PayloadChannel/Notification.cpp Outdated Show resolved Hide resolved
worker/src/RTC/Transport.cpp Show resolved Hide resolved
ibc and others added 9 commits May 29, 2020 11:30
Co-authored-by: José Luis Millán <jmillan@aliax.net>
Co-authored-by: José Luis Millán <jmillan@aliax.net>
Co-authored-by: José Luis Millán <jmillan@aliax.net>
Co-authored-by: José Luis Millán <jmillan@aliax.net>
Co-authored-by: José Luis Millán <jmillan@aliax.net>
@ibc ibc merged commit b7a3971 into v3 May 29, 2020
@ibc ibc deleted the datachannel-termination branch May 29, 2020 12:23
@ibc
Copy link
Member Author

ibc commented May 29, 2020

Codacy Here is an overview of what got changed by this pull request:

Clones added
============
- worker/src/RTC/DataConsumer.cpp  1
- test/test-PlainTransport.js  6
- worker/src/RTC/DataProducer.cpp  1
- worker/include/Channel/UnixStreamSocket.hpp  2
- lib/PayloadChannel.js  5
- worker/include/RTC/DataConsumer.hpp  1
- worker/src/Channel/UnixStreamSocket.cpp  4
- lib/Router.js  1
- worker/include/RTC/WebRtcTransport.hpp  3
- lib/DirectTransport.js  1
- worker/src/PayloadChannel/UnixStreamSocket.cpp  4
- test/test-node-sctp.js  1
- worker/include/RTC/DirectTransport.hpp  3
- test/test-DataConsumer.js  1
- worker/include/RTC/PlainTransport.hpp  2
- test/test-DirectTransport.js  15
- worker/include/RTC/DataProducer.hpp  1
- worker/include/RTC/PipeTransport.hpp  2
- worker/include/PayloadChannel/UnixStreamSocket.hpp  2
- lib/Channel.js  4
- test/test-WebRtcTransport.js  3
         

Clones removed
==============
+ test/test-PipeTransport.js  -1
         

See the complete overview on Codacy

@ibc ibc changed the title Datachannel termination via the new DirectTransport DataChannel termination via the new DirectTransport May 29, 2020
@ibc
Copy link
Member Author

ibc commented May 29, 2020

Here the announcement:

https://mediasoup.discourse.group/t/mediasoup-3-6-0-is-out-with-datachannel-termination-in-node-js/1118

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants