Skip to content

Commit

Permalink
Support for multistream PeerConnections (replaces #1459) (#2211)
Browse files Browse the repository at this point in the history
  • Loading branch information
lminiero committed Feb 11, 2022
1 parent 21a5fc9 commit 4110eea
Show file tree
Hide file tree
Showing 83 changed files with 14,626 additions and 9,089 deletions.
4 changes: 3 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,9 @@ stream_DATA += \
plugins/streams/music.mulaw \
plugins/streams/radio.alaw \
plugins/streams/test_gstreamer.sh \
plugins/streams/test_gstreamer_1.sh
plugins/streams/test_gstreamer1.sh \
plugins/streams/test_gstreamer_multistream.sh \
plugins/streams/test_gstreamer1_multistream.sh
EXTRA_DIST += \
conf/janus.plugin.streaming.jcfg.sample.in \
$(stream_DATA)
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Janus is an open source, general purpose, WebRTC server designed and developed b

For some online demos and documentations, make sure you pay the [project website](https://janus.conf.meetecho.com/) a visit!

> **Note well:** this is the main branch for the `multistream` version of Janus, which is the new version. If you want to check the legacy version of Janus instead (i.e., `0.x`, a.k.a. "master") click [here](https://github.com/meetecho/janus-gateway/tree/0.x) instead.
If you have questions on Janus, or wish to discuss Janus with us and other users, please join our [meetecho-janus](https://groups.google.com/forum/#!forum/meetecho-janus) Google Group. If you encounter bugs, please submit an issue on [GitHub](https://github.com/meetecho/janus-gateway/issues): make sure you read the [guidelines](.github/ISSUE_TEMPLATE.md) before opening an issue, though.


Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "janus-gateway",
"version": "0.11.8",
"version": "1.0.0",
"homepage": "https://github.com/meetecho/janus-gateway",
"authors": [
"Lorenzo Miniero <[email protected]>",
Expand Down
50 changes: 50 additions & 0 deletions conf/janus.plugin.streaming.jcfg.sample.in
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,56 @@ rtp-sample: {
secret = "adminpwd"
}

#
# This is a better example that uses the new settings to configure a live
# mountpoint to send multiple streams of the same type at the same time:
# that is, not simulcasting, but different streams (e.g., two audio
# streams and two video streams). To do so, you don't set the audio,
# video and data properties inline, but use an array of properties instead,
# each identifying a single stream to add, that will then translate to
# a dedicated m-line in the SDP. For each stream, you specify the type,
# a unique ID (mid), and can provide a short description (label) so that
# the client side can know what's what when rendering the streams. Notice
# how the port/pt/rtpmap/fmtp/etc. stuff is called just like that, without
# any audio/video/data prefix: in fact, each media stream can be configured
# the same way, and it's the type that allows us to differentiate them.
# As such, you can use the same approach for creating regular mountpoints
# as well (e.g., 1 audio and 1 video) in a much clearer, and cleaner, way.
#
multistream-test: {
type = "rtp"
id = 123
description = "Multistream test (1 audio, 2 video)"
metadata = "This is an example of a multistream mountpoint: you'll get an audio stream and two video feeds"
media = (
{
type = "audio"
mid = "a"
label = "Audio stream"
port = 5102
pt = 111
rtpmap = "opus/48000/2"
},
{
type = "video"
mid = "v1"
label = "Video stream #1"
port = 5104
pt = 100
rtpmap = "VP8/90000"
},
{
type = "video"
mid = "v2"
label = "Video stream #2"
port = 5106
pt = 100
rtpmap = "VP8/90000"
}
)
secret = "adminpwd"
}

#
# This is a sample of the file-based streaming support. Specifically,
# this simulates a radio broadcast by streaming (in a loop) raw a-Law
Expand Down
6 changes: 3 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AC_INIT([Janus WebRTC Server],[0.11.8],[https://github.com/meetecho/janus-gateway],[janus-gateway],[https://janus.conf.meetecho.com])
AC_INIT([Janus WebRTC Server],[1.0.0],[https://github.com/meetecho/janus-gateway],[janus-gateway],[https://janus.conf.meetecho.com])
AC_LANG(C)
AC_CONFIG_AUX_DIR([.])
AC_CONFIG_MACRO_DIR([m4])
Expand Down Expand Up @@ -75,9 +75,9 @@ cc*)
-Wunused-but-set-variable"
esac

JANUS_VERSION=118
JANUS_VERSION=1000
AC_SUBST(JANUS_VERSION)
JANUS_VERSION_STRING="0.11.8"
JANUS_VERSION_STRING="1.0.0"
AC_SUBST(JANUS_VERSION_STRING)

case "$host_os" in
Expand Down
1 change: 1 addition & 0 deletions docs/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
<li class="active"><a href="index.html">Documentation</a></li>
<li><a href="https://janus.conf.meetecho.com/citeus.html">Papers</a></li>
<li><a href="https://janus.conf.meetecho.com/support.html">Need help?</a></li>
<li><a href="https://janus-legacy.conf.meetecho.com/">Janus (0.x)</a></li>
<li><a class="januscon" target="_blank" href="https://januscon.it">JanusCon!</a></li>
</ul>
<div class="navbar-header navbar-right">
Expand Down
6 changes: 3 additions & 3 deletions docs/janus-doxygen.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,19 @@ DOXYFILE_ENCODING = UTF-8
# title of most generated pages and in a few other places.
# The default value is: My Project.

PROJECT_NAME = "Janus"
PROJECT_NAME = "Janus (multistream)"

# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = 0.11.8
PROJECT_NUMBER = 1.0.0

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
# quick idea about the purpose of the project. Keep the description short.

PROJECT_BRIEF = "Janus WebRTC Server"
PROJECT_BRIEF = "Janus WebRTC Server (multistream)"

# With the PROJECT_LOGO tag one can specify a logo or an icon that is included
# in the documentation. The maximum height of the logo should not exceed 55
Expand Down
21 changes: 8 additions & 13 deletions dtls-bio.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,17 +132,12 @@ static int janus_dtls_bio_agent_write(BIO *bio, const char *in, int inl) {
JANUS_LOG(LOG_ERR, "No DTLS-SRTP stack, no DTLS bridge...\n");
return -1;
}
janus_ice_component *component = (janus_ice_component *)dtls->component;
if(component == NULL) {
JANUS_LOG(LOG_ERR, "No component, no DTLS bridge...\n");
janus_ice_peerconnection *pc = (janus_ice_peerconnection *)dtls->pc;
if(pc == NULL) {
JANUS_LOG(LOG_ERR, "No WebRTC PeerConnection, no DTLS bridge...\n");
return -1;
}
janus_ice_stream *stream = component->stream;
if(!stream) {
JANUS_LOG(LOG_ERR, "No stream, no DTLS bridge...\n");
return -1;
}
janus_ice_handle *handle = stream->handle;
janus_ice_handle *handle = pc->handle;
if(!handle || !handle->agent || !dtls->write_bio) {
JANUS_LOG(LOG_ERR, "No handle/agent/bio, no DTLS bridge...\n");
return -1;
Expand All @@ -152,17 +147,17 @@ static int janus_dtls_bio_agent_write(BIO *bio, const char *in, int inl) {
/* FIXME Just a warning for now, this will need to be solved with proper fragmentation */
JANUS_LOG(LOG_WARN, "[%"SCNu64"] The DTLS stack is trying to send a packet of %d bytes, this may be larger than the MTU and get dropped!\n", handle->handle_id, inl);
}
int bytes = nice_agent_send(handle->agent, component->stream_id, component->component_id, inl, in);
int bytes = nice_agent_send(handle->agent, pc->stream_id, pc->component_id, inl, in);
if(bytes < inl) {
JANUS_LOG(LOG_ERR, "[%"SCNu64"] Error sending DTLS message on component %d of stream %d (%d)\n", handle->handle_id, component->component_id, stream->stream_id, bytes);
JANUS_LOG(LOG_ERR, "[%"SCNu64"] Error sending DTLS message on component %d of stream %d (%d)\n", handle->handle_id, pc->component_id, pc->stream_id, bytes);
} else {
JANUS_LOG(LOG_HUGE, "[%"SCNu64"] >> >> ... and sent %d of those bytes on the socket\n", handle->handle_id, bytes);
}
/* Update stats (TODO Do the same for the last second window as well)
* FIXME: the Data stats includes the bytes used for the handshake */
if(bytes > 0) {
component->out_stats.data.packets++;
component->out_stats.data.bytes += bytes;
pc->dtls_out_stats.info[0].packets++;
pc->dtls_out_stats.info[0].bytes += bytes;
}
return bytes;
}
Expand Down
Loading

0 comments on commit 4110eea

Please sign in to comment.