Connection between two Janus gateway Servers

1,944 views
Skip to first unread message

ChihYen Chen

unread,
May 25, 2015, 10:23:36 AM5/25/15
to meetech...@googlegroups.com
Hello everyone,

I have use the videoroom plugin and screensharingtest demo to implement a one to many video broadcast system.

Now I want to implement the function as follow: 

When Janus Server 1 is over loading,
A controller server will let : 
(1) server 2 connect server 1 
(2) server 2 get the stream 1 from server 1
(3) server 2 use the stream 1 as the publisher's stream
(4) Rest listener connect to server 2 and get stream

I know I can tell the origin publisher to create many plugins and publish to many servers,
But I want the publisher only send one stream to one Janus gateway server and let server do the scaling job.

Has anyone done this function?
Or can anyone give me some suggestion about how to modify the videoroom plugin and implement the (1)(2)(3) function?

Sincerely,
ChihYen(Jam).

Lorenzo Miniero

unread,
May 27, 2015, 4:23:24 AM5/27/15
to meetech...@googlegroups.com, jam.ch...@gmail.com
It's not possible out of the box right now. You'd probably have to modify the videoroom plugin to be also able to relay incoming RTP media from a publisher to a different endpoint (e.g., to a streaming plugin mountpoint on a different Janus server, to keep it simple, or to something new crafted within the videoroom plugin itself), and properly orchestrate the communication and state from your controlling application.

L.

ChihYen Chen

unread,
Jun 10, 2015, 2:10:06 AM6/10/15
to meetech...@googlegroups.com, jam.ch...@gmail.com

Hi Lorenzo,

        Is it possible to setup a webrtc connection between Janus server using trickle ice way ?


        Currently, I can setup a webrtc connection between two Janus servers by disabling trickle ice on Janus server, like this:

        -----------------------------------------------------------------------------------------------------------------------
        //*trickle = 1;

        *trickle = strstr(jsep_sdp, "a=candidate") ? 0 : 1;


         
        -----------------------------------------------------------------------------------------------------------------------

        After setting the connection, I can use a browser connect to second server and get the video stream,

        But now I have another question:
        It takes a long time(5-15s) when browser connect to second Janus server.

        Is it because the webrtc connection between two Janus servers using the non-trickle ice way?
        If so, what is the right way to setup a webrtc connection 
between two Janus servers using trickle ice way ?

        Thanks.

Sincerely,

ChihYen(Jam).


Lorenzo Miniero於 2015年5月27日星期三 UTC+8下午4時23分24秒寫道:

Lorenzo Miniero

unread,
Jun 10, 2015, 2:13:04 AM6/10/15
to meetech...@googlegroups.com, jam.ch...@gmail.com
Trickle is used by default. The high times for setting up the session are caused by the fact you explicitly disabled it.
Check the documentation online for how to send trickle candidates to Janus, in case you're not using our JavaScript library to interact with it.

L.

ChihYen Chen

unread,
Jun 11, 2015, 11:42:45 AM6/11/15
to meetech...@googlegroups.com, jam.ch...@gmail.com
Hi Lorenzo,
I have tried to connect two Janus Server with trickle ice way by follow this document:
http://janus.conf.meetecho.com/docs/rest.html (If you're going to trickle candidates....)

I have tried method (1) and (2):
In both method, I modified the janus.js, so I can let handle use the "sendTrickleCandidate()" function.

(1)
After send SDP, the nodejs server will tell handle to send the completed message immediately.

(2)Because I don't know how to get remote candidate for two Janus server,
I split the candidates from the SDP which sent by janus server.

In these two method, the log only show :
[4027610916] Creating ICE agent (ICE Full mode, controlled)
[4027610916] ICE send thread started...
No more remote candidates for handle 4027610916!
[4027610916] Done! Ready to setup remote candidates and send connectivity checks...

"[4027610916] The DTLS handshake has been completed" message doesn't show up.

Did I missing any step in these method?
Or is there any document I missing?
Do you have any clue about why the DTLS handshake doesn't start?
Thanks.
   
Sincerely,
ChihYen(Jam).

Lorenzo Miniero於 2015年6月10日星期三 UTC+8下午2時13分04秒寫道:

Lorenzo Miniero

unread,
Jun 12, 2015, 4:47:30 AM6/12/15
to meetech...@googlegroups.com, jam.ch...@gmail.com
Trickle is only needed from clients to Janus. Janus always sends its own candidates in the SDP, as most of the times it will be publicly reachable and so only has host candidates that are available right away.

L.

ChihYen Chen

unread,
Jun 15, 2015, 8:56:21 AM6/15/15
to meetech...@googlegroups.com, jam.ch...@gmail.com
Hi Lorenzo,

But if I setup a webrtc connection between two Janus Servers by using non trickle way, like this:
 



It takes about < 1s to get the video stream when the chrome browser (listener 1) connecting to Janus 1.

By contrast,
 
it takes long time (2 min) to get the stream when the chrome browser (listener 2) connecting to Janus 2,  

And I found when listener 2 connect to Janus 2,
 
remoteFeed.getBitrate() is able to get value immediately,
 
But it has to take long time to trigger "$("#remotevideo").bind("playing", function () { ... }); " 

Do you know what cause this problem? How do I fix this?

p.s. the code of listener 1 and listener 2 are the same. 
 
Sincerely,
ChihYen(Jam).

Lorenzo Miniero於 2015年6月12日星期五 UTC+8下午4時47分30秒寫道:

Lorenzo Miniero

unread,
Jun 15, 2015, 2:32:19 PM6/15/15
to meetech...@googlegroups.com, jam.ch...@gmail.com
I'm not sure what you're trying to do. Some cascaded conferencing, where a viewer of a publisher on Janus1 becomes a publisher on Janus2? Not sure that can be done as I never tried it, but I guess that with some manipulation of the Janus API it may be feasible.

If you're trying to bridge two Janus PeerConnections this way, you won't need the trickle there because we don't do trickling for Janus' candidates. The fact that you see media 2 minutes later may be related to key frame issues: when FIR is disabled, the browsers generate a key frame each 3000 frames, which for 30fps is about 100 seconds (1m40s). Try setting a recurrent FIR in the videoroom settings, if you disabled it.

L.

ChihYen Chen

unread,
Jun 16, 2015, 12:15:10 AM6/16/15
to meetech...@googlegroups.com, jam.ch...@gmail.com
Hi Lorenzo,

Thank you for your kindly help!  I set the "fir_freq" value to 5, and I am able to get media in 5 seconds! 
 
Can you give me some advice about the influence of "fir_freq" value?

For example, when I set the "fir_freq" value to 1, will it cost more resources or delay?

I have tested it by changing the value from 5 to 1, it doesn't show obvious change on cpu, bandwidth and stream delay.
 
But I am not sure that changing "fir_freq" value will have some influence on other resources or not?

Sincerely,
ChihYen(Jam).

Lorenzo Miniero於 2015年6月16日星期二 UTC+8上午2時32分19秒寫道:

Lorenzo Miniero

unread,
Jun 16, 2015, 4:45:43 AM6/16/15
to meetech...@googlegroups.com, jam.ch...@gmail.com
FIR/PLI request generate key frames, which are expensive in terms of bandwidth. Better not ask for them too often.

L. 

Noam Cohen

unread,
Nov 22, 2016, 11:12:37 AM11/22/16
to meetecho-janus, jam.ch...@gmail.com
Hi Chen, Could you please explain to me how you bridged two Janus servers?
Could you show me the configurations?

Neil Kinnish

unread,
Jan 12, 2019, 4:56:47 AM1/12/19
to meetecho-janus
Hi ChihYen & Lorenzo

Do you have any information on connecting janus servers together (using the videoroom plugin), I'm researching how cascading can work within Janus and if you have already tried/have info you could share that would be fantastic.

Thanks

Neil

lmin...@gmail.com

unread,
Jan 12, 2019, 7:44:37 AM1/12/19
to meetecho-janus
You may want to refer to this presentation I made a few months ago: 
https://groups.google.com/forum/#!topic/meetecho-janus/lclkA1qE0LU

L.
Reply all
Reply to author
Forward
0 new messages