Strategy to handle slowlink

2,355 views
Skip to first unread message

Anil Wadghule

unread,
Jan 16, 2017, 2:54:08 PM1/16/17
to meetech...@googlegroups.com
Hi,

In my application which uses videoroom, I am currently sending a Janus message to configure bitrate to 1000 whenever I receive slowlink events (both types, videoroom one and a generic one).

Here is how it looks in code?

 Janus.Plugin.message(plugin_pid, %{request: "configure", bitrate: 1000})

Do I have to worry about uplink true / false etc while sending above message?

Also I am sending above configure request, each time I receive a slowlink event. So there are so many slow link messages getting sent. Is that Ok?

Can someone define possible strategies to handle slowlink with currently supported Janus rest APIs?

--
Thanks,
Anil

Lorenzo Miniero

unread,
Jan 17, 2017, 3:10:17 AM1/17/17
to meetecho-janus
If you're using videoroom, uplink true/false don't matter as publishers and subscribers use different handles. Of course, you should only reduce the publisher if the publisher's handle is giving you the slow_link: unless you're getting slowlink from many viewers, in that case reducing their publisher's rate is a good idea too.

That said, 1000 is not valid. The minimum value Chrome and Firefox allow is 64000 I think.

L.

Anil Wadghule

unread,
Jan 17, 2017, 4:30:17 AM1/17/17
to meetecho-janus, Lorenzo Miniero
Thanks a lot Lorenzo!

So here is what I understand,

I should only handle videoroom specific slow link event.

So on every {videoroom: “slow_link”} event, I am sending a fresh configure request for the sender to set bitrate to 64000 (this happens for each sender/publisher who receives slow_link event from video_room). This should be fine right? Though I fear, I am unnecessarily sending configure request again and again. I also don’t send any configure request when connection becomes better. Bitrate for publisher remains 64000

I am ignoring generic Janus event i.e. janus: "slowlink", uplink: uplink, nacks: nacks.  

So here is what I missed to understand is how to set bitrate back to lets say 128000? How to know that connection has become stable for publisher? I could not find more info about this?

--
Thanks,
Anil
--
You received this message because you are subscribed to the Google Groups "meetecho-janus" group.
To unsubscribe from this group and stop receiving emails from it, send an email to meetecho-janu...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Lorenzo Miniero

unread,
Jan 17, 2017, 4:56:02 AM1/17/17
to meetecho-janus, lmin...@gmail.com
The videoroom event contains the current bitrate, so no need to resend configure if it's the same value. There's no event for when things are fine: if you don't get slowlink events after a while, try sending a new configure that increases the bitrate again, a bit like TCP slow start works.

L.
To unsubscribe from this group and stop receiving emails from it, send an email to meetecho-janus+unsubscribe@googlegroups.com.

Mirko Brankovic

unread,
Jan 17, 2017, 6:30:50 AM1/17/17
to meetecho-janus
indeed, Janus can't be aware if your link gets healthy again, you can only try to increase the bitrate after some time.

Maybe peerconnection.getStats() on client side can give you some usefull info about uplink details

--
Regards,
Mirko

Anil Wadghule

unread,
Jan 17, 2017, 6:41:40 AM1/17/17
to meetecho-janus, Lorenzo Miniero, lmin...@gmail.com
Thanks a lot Lorenzo! While doing this, I noticed in recordplaytest.js I saw following code.


} else if(event === 'slow_link') {
  var uplink = result["uplink"];
  if(uplink !== 0) {
    // Janus detected issues when receiving our media, let's slow down
    bandwidth = parseInt(bandwidth / 1.5);
    recordplay.send({
      'message': {
        'request': 'configure',
        'video-bitrate-max': bandwidth, // Reduce the bitrate
        'video-keyframe-interval': 15000 // Keep the 15 seconds key frame interval
      }
    });
  }


But wondering when event is ‘slow_link’ (videoroom), we don’t have anything like uplink,
This is how videoroom event looks
{janus: "event", plugindata: %{data: %{"current-bitrate": 1000, videoroom: "slow_link"}, plugin: "janus.plugin.videoroom"}, sender: 6469512177298645, session_id: 4877037153862911}

And below is how non videoroom event looks.
%{janus: "slowlink", nacks: 8, sender: 4151366976648644, session_id: 1664504210610023, uplink: true}

So definitely some issue with recordplaytest.js code.

Also do you know when to set below parameters vs bitrate parameter in configurations?

video-bitrate-max
video-keyframe-interval

Or just setting up bitrate parameter is just fine?


--
Thanks,
Anil
To unsubscribe from this group and stop receiving emails from it, send an email to meetecho-janu...@googlegroups.com.

Lorenzo Miniero

unread,
Jan 17, 2017, 12:21:34 PM1/17/17
to meetecho-janus, lmin...@gmail.com
You don't need uplink info in videoroom. As I said, publishers only send, subscribers only receive, so if you get a slow_link event on a handle you immediately know if it's because of problems sending or receiving.

L.

Anil Wadghule

unread,
Jan 17, 2017, 1:59:29 PM1/17/17
to meetecho-janus, Lorenzo Miniero, lmin...@gmail.com
Thanks! 

So here is what I am doing!

  case event do
      {:event, pid, plugin_pid, data, nil} ->

        case data do
          %{videoroom: "slow_link"} ->
            if (data[:"current-bitrate"] && (data[:"current-bitrate"] != 64000)) do
              IO.puts "Sending reduced bitrate"
              :timer.apply_after(30_000, Janus.Plugin, :message, [plugin_pid, %{request: "configure", bitrate: 128000}])
              Janus.Plugin.message(plugin_pid, %{request: "configure", bitrate: 64000})
            end


After 30 seconds of slow_link, I am trying to set it back to default (hoping connection is now stable). Hope this doesn't cause any major issue.

--
Thanks,
Anil
To unsubscribe from this group and stop receiving emails from it, send an email to meetecho-janu...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages