Skip to content

Commit

Permalink
srt-live-transmit: add option to cancel timeout (#570)
Browse files Browse the repository at this point in the history
* [apps] Added --timeout-mode option
* [apps] Fixed help
  • Loading branch information
zmousm authored and rndi committed Mar 11, 2019
1 parent a0391c3 commit 08e7a36
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions apps/srt-live-transmit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,10 @@ int main( int argc, char** argv )
if ( params.size() != 2 )
{
cerr << "Usage: " << argv[0] << " [options] <input-uri> <output-uri>\n";
#ifndef _WIN32
cerr << "\t-t:<timeout=0> - exit timer in seconds\n";
cerr << "\t-tm:<mode=0> - timeout mode (0 - since app start; 1 - like 0, but cancel on connect)\n";
#endif
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 +193,7 @@ int main( int argc, char** argv )
}

int timeout = stoi(Option("0", "t", "to", "timeout"), 0, 0);
int timeout_mode = stoi(Option("0", "tm", "timeout-mode"), 0, 0);
unsigned long chunk = stoul(Option("0", "c", "chunk"), 0, 0);
if ( chunk == 0 )
{
Expand Down Expand Up @@ -474,6 +478,14 @@ int main( int argc, char** argv )
<< " connection"
<< endl;
}
#ifndef _WIN32
if (timeout_mode == 1 && timeout > 0)
{
if (!quiet)
cerr << "TIMEOUT: cancel\n";
alarm(0);
}
#endif
if (issource)
srcConnected = true;
else
Expand Down

0 comments on commit 08e7a36

Please sign in to comment.