How do I go from WebRTC -> RTP with Node Client?

896 views
Skip to first unread message

David Stein

unread,
Mar 1, 2018, 11:38:32 AM3/1/18
to kurento
I have this tutorial working: https://github.com/Kurento/kurento-tutorial-node/tree/master/kurento-one2many-call. It works fine, with a viewer seeing the WebRTC stream. In reality, I want a vendor to have access to an RTP stream so they can consume it and handle the scaling for viewership. I essentially expect to send them an `rtp://` URL. The closest example I can seem to find is https://groups.google.com/forum/#!topic/kurento/E6WWjOrRc8c, which shows Java. 

I am unsure how to get the URL. To the example they have I had to add `var filters = require('kurento-client-filters');` and then look to see the very big syntax difference between the Java and Node clients.

It basically amounts to:

    var rtpEndpoint;
   
var filter1;
    presenter
.pipeline.create('RtpEndpoint', function(error, rtpEnd) {
      filter1
= new filters.GStreamerFilter("videorate max-rate=30", presenter.pipeline);
     rtpEndpoint
= rtpEnd;
   
});



Later on, the demo has this:

 
   presenter.webRtcEndpoint.connect(webRtcEndpoint, function(error) {
     
if (error) {
        stop
(sessionId);
       
return callback(error);
     
}
     
if (presenter === null) {
        stop
(sessionId);
       
return callback(noPresenterMessage);
     
}
   
      callback
(null, sdpAnswer);
          webRtcEndpoint
.gatherCandidates(function(error) {
             
if (error) {
                stop
(sessionId);
               
return callback(error);
             
}
         
});
     
});
   
});


Based on the java example in that linked thread, I imagine it should be:

    presenter.webRtcEndpoint.connect(filter1, function(outerError) {
      filter1
.connect(rtpEndpoint, function(error) {
       
if (error) {
          stop
(sessionId);
         
return callback(error);
       
}
       
if (presenter === null) {
          stop
(sessionId);
         
return callback(noPresenterMessage);
       
}
   
        callback
(null, sdpAnswer);
            webRtcEndpoint
.gatherCandidates(function(error) {
               
if (error) {
                  stop
(sessionId);
                 
return callback(error);
               
}
           
});
       
});
     
});
   
});


Nothing explodes when I start my stream. Nothing shows when I try to view the stream, which I'd expect cause I changed to RTP. I just have no idea how to access the RTP stream or if this thing is gracefully failing.

jonathan...@productionstmv.com

unread,
Mar 4, 2018, 1:34:48 PM3/4/18
to kurento
I don't have experience using a filter, and haven't used the JS api since early prototyping, so I can't speak to that, but there are a couple of things you can check:

- check the logging in the kurento server instance and make sure you're seeing something like "pair selected" to indicate the gathering part really connected.  You may need to up the logging level to do so.  'tail -f /var/log/kurent*/media*20*' to watch, edit /etc/defaults/kurento-media-server to change, higher numbers is more logging.  The log in general is useful.
- kurento-monitor - https://github.com/mariogasparoni/kurento-monitor -  will let you monitor the basic pipeline state and get the dot graph file. the graph file can be visualized with a web dot visualize like http://www.webgraphviz.com/
- the rtpendpoint should connect right away IIRC so you can use either tcpdump or netstat to see if the connection is made.  In my case it was audio and video on 6990 and 6992 so RTCP connects on 6991 and 6993 right away, even before the webrtc flow starts  (something like 'sudo tcpdump -n udp ' or 'netstat -na --udp | grep 699')

You should probably show your rtp SDP offer.

IF you're trying to connect to something like AWS mediaLive it won't work - mediaLive is expecting a m2ts stream, both audio and video on one port, and kurento does not output that.  Maybe with a gstreamer plugin but I haven't had a chance to look at this yet.  I've successfully connected to wowza via RTP, or to ffmpeg and then to mediaLive.

(Just reading I think you're right that the example is flawed, and your version is more correct.  Connecting webrtcendpoint to itself doesn't make sense).

Re, the filter, we've used webrtc constraints to set an ideal framerate and have seen vastly varying rates from 1-3fps (some configurations, fixed by switching to Firefox) to a reported 48fps (looked like a decoder bug actually) but maybe remove the filter until you've got the basic pipeline working.

later, j

Mario Gasparoni Junior

unread,
Mar 5, 2018, 2:54:49 PM3/5/18
to kur...@googlegroups.com
Take a look at this example:


--
You received this message because you are subscribed to the Google Groups "kurento" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kurento+unsubscribe@googlegroups.com.
To post to this group, send email to kur...@googlegroups.com.
Visit this group at https://groups.google.com/group/kurento.
To view this discussion on the web visit https://groups.google.com/d/msgid/kurento/840789ff-cca4-4108-9e89-3db21dca9c65%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Att. Mário Gasparoni.

Mario Gasparoni Junior

unread,
Mar 5, 2018, 2:56:05 PM3/5/18
to kur...@googlegroups.com

2018-03-05 16:54 GMT-03:00 Mario Gasparoni Junior <marioga...@gmail.com>:
Take a look at this example:

Reply all
Reply to author
Forward
0 new messages