Skip to content

Commit

Permalink
srt-live-transmit: add option to cancel timeout
Browse files Browse the repository at this point in the history
Add an option (-taoc, -timeout-abort-on-connect) to cancel the timeout
(as set with -t) after a client is accepted. This allows for
srt-live-transmit to run in listener mode and wait for a limited
amount of time (timeout) for a client to connect.
  • Loading branch information
zmousm committed Feb 13, 2019
1 parent c431177 commit 48af522
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions apps/srt-live-transmit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ int main( int argc, char** argv )
{
cerr << "Usage: " << argv[0] << " [options] <input-uri> <output-uri>\n";
cerr << "\t-t:<timeout=0> - exit timer in seconds\n";
cerr << "\t-taoc - abort timeout on connect (default no)\n";
cerr << "\t-c:<chunk=1316> - max size of data read in one step\n";
cerr << "\t-b:<bandwidth> - set SRT bandwidth\n";
cerr << "\t-r:<report-frequency=0> - bandwidth report frequency\n";
Expand All @@ -190,6 +191,7 @@ int main( int argc, char** argv )
}

int timeout = stoi(Option("0", "t", "to", "timeout"), 0, 0);
bool timeout_abrt_conn = Option("no", "taoc", "timeout-abort-on-connect") != "no";
unsigned long chunk = stoul(Option("0", "c", "chunk"), 0, 0);
if ( chunk == 0 )
{
Expand Down Expand Up @@ -469,6 +471,14 @@ int main( int argc, char** argv )
<< " connection"
<< endl;
}
#ifndef _WIN32
if (timeout_abrt_conn && timeout > 0)
{
if (!quiet)
cerr << "TIMEOUT: cancel\n";
alarm(0);
}
#endif
if (issource)
srcConnected = true;
else
Expand Down

0 comments on commit 48af522

Please sign in to comment.