srt icon indicating copy to clipboard operation
srt copied to clipboard

[Question] Possible to timeout/disconnect srt if no flow?

Open barhom opened this issue 2 years ago • 2 comments

I have this one customer who uses an unknown SRT program on their end in listener mode. It has become more frequent that the SRT connection stays established but the flow of audio/video goes to zero.

Attached is a pcap capture of traffic happening when there are no flow of audio/video srt.pcap.txt

Now to my question, if I am testing with srt-live-transmit on the receiver side, is it possible to make the connection time-out and re-connect if there is no flow?

barhom avatar Apr 07 '22 08:04 barhom

The srt-live-transmit application uses timeout only as a forced exit after given time (whether there is a transmission or not), or to give up a failing connection. The srt-test-live application (you need to configure with --enable-testing) has a timeout option that breaks after a given time of no transmission, but it's not exactly user-friendly (it doesn't reconnect by itself, it just exits).

OTOH I'm wondering what a reconnection could help in case when you have no transmission. Whether there's anything to transmit or not, it's up to the sender application; I guess it at least should start transmission again as long as there is any signal, or if it doesn't want to bother with connected clients during the time of no signal, it should break the connection itself. What is the application on the sender side?

ethouris avatar Apr 11 '22 13:04 ethouris

Attached is a pcap capture of traffic happening when there are no flow of audio/video srt.pcap.txt

There is no traffic in the capture, and no reconnection. Only exchange of the SRT KEEPALIVE packets. It means the connection is alive, but no data is being sent, likely, by the application.

Now to my question, if I am testing with srt-live-transmit on the receiver side, is it possible to make the connection time-out and re-connect if there is no flow?

The -timeout, -t, -to command-line option of the srt-live-transmit should do the trick. See the documentation for more info.

Update: No, sorry, this is a general timeout to break the app. But the mode you describe can be added extending the -tm command-line option.

maxsharabayko avatar Apr 11 '22 14:04 maxsharabayko

+1

I'm looking foward to this functionality, and can explain here my use case. srt-live-transmit is a simple-enough tool for retransmit streams between datacenters. Now, I could have multiple input streams (think primary and backup) which I need to switch in case of trouble. That's easily done with simple scripts like this one:

#!/bin/bash

while true ; do
  echo "[$(date)] - Starting main input stream" ; 
  srt-live-transmit -v "protocol://ip-address:port?parameters" "srt://ip-address:port?parameters" ; 

  echo "[$(date)] - Starting secondary input stream" ; 
  srt-live-transmit -v "protocol://ip-address:port?parameters" "srt://ip-address:port?parameters" ; 
done

However, without timeout detection for input streams, in case a input stream falls down, srt-live-transmit will keep waiting for a reconnection. A -timeout-mode 2 for this behaviour would be very useful.

Canta avatar Dec 22 '22 18:12 Canta