Commit 0678c388 authored by Michael Niedermayer's avatar Michael Niedermayer

rtsp: add option to set the socket timeout of the lower protocol.

Fixes Ticket2294
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent c6ae7f64
...@@ -538,6 +538,11 @@ To receive a stream in realtime: ...@@ -538,6 +538,11 @@ To receive a stream in realtime:
ffmpeg -rtsp_flags listen -i rtsp://ownaddress/live.sdp @var{output} ffmpeg -rtsp_flags listen -i rtsp://ownaddress/live.sdp @var{output}
@end example @end example
@table @option
@item stimeout
Socket IO timeout in micro seconds.
@end table
@section sap @section sap
Session Announcement Protocol (RFC 2974). This is not technically a Session Announcement Protocol (RFC 2974). This is not technically a
......
...@@ -91,6 +91,7 @@ const AVOption ff_rtsp_options[] = { ...@@ -91,6 +91,7 @@ const AVOption ff_rtsp_options[] = {
{ "min_port", "Minimum local UDP port", OFFSET(rtp_port_min), AV_OPT_TYPE_INT, {.i64 = RTSP_RTP_PORT_MIN}, 0, 65535, DEC|ENC }, { "min_port", "Minimum local UDP port", OFFSET(rtp_port_min), AV_OPT_TYPE_INT, {.i64 = RTSP_RTP_PORT_MIN}, 0, 65535, DEC|ENC },
{ "max_port", "Maximum local UDP port", OFFSET(rtp_port_max), AV_OPT_TYPE_INT, {.i64 = RTSP_RTP_PORT_MAX}, 0, 65535, DEC|ENC }, { "max_port", "Maximum local UDP port", OFFSET(rtp_port_max), AV_OPT_TYPE_INT, {.i64 = RTSP_RTP_PORT_MAX}, 0, 65535, DEC|ENC },
{ "timeout", "Maximum timeout (in seconds) to wait for incoming connections. -1 is infinite. Implies flag listen", OFFSET(initial_timeout), AV_OPT_TYPE_INT, {.i64 = -1}, INT_MIN, INT_MAX, DEC }, { "timeout", "Maximum timeout (in seconds) to wait for incoming connections. -1 is infinite. Implies flag listen", OFFSET(initial_timeout), AV_OPT_TYPE_INT, {.i64 = -1}, INT_MIN, INT_MAX, DEC },
{ "stimeout", "timeout (in micro seconds) of socket i/o operations.", OFFSET(stimeout), AV_OPT_TYPE_INT, {.i64 = 0}, INT_MIN, INT_MAX, DEC },
RTSP_REORDERING_OPTS(), RTSP_REORDERING_OPTS(),
{ NULL }, { NULL },
}; };
...@@ -1618,7 +1619,8 @@ redirect: ...@@ -1618,7 +1619,8 @@ redirect:
} }
} else { } else {
/* open the tcp connection */ /* open the tcp connection */
ff_url_join(tcpname, sizeof(tcpname), "tcp", NULL, host, port, NULL); ff_url_join(tcpname, sizeof(tcpname), "tcp", NULL, host, port,
"?timeout=%d", rt->stimeout);
if (ffurl_open(&rt->rtsp_hd, tcpname, AVIO_FLAG_READ_WRITE, if (ffurl_open(&rt->rtsp_hd, tcpname, AVIO_FLAG_READ_WRITE,
&s->interrupt_callback, NULL) < 0) { &s->interrupt_callback, NULL) < 0) {
err = AVERROR(EIO); err = AVERROR(EIO);
......
...@@ -390,6 +390,11 @@ typedef struct RTSPState { ...@@ -390,6 +390,11 @@ typedef struct RTSPState {
*/ */
int initial_timeout; int initial_timeout;
/**
* timeout of socket i/o operations.
*/
int stimeout;
/** /**
* Size of RTP packet reordering queue. * Size of RTP packet reordering queue.
*/ */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment