[vlc-devel] commit: RTP out: improve soft-error handling ( Rémi Denis-Courmont )
git version control
git at videolan.org
Tue Mar 10 18:00:28 CET 2009
vlc | branch: 0.9-bugfix | Rémi Denis-Courmont <remi at remlab.net> | Tue Mar 10 18:54:03 2009 +0200| [0625bc137df861f7fb46c979916545a0c88439d5] | committer: Rémi Denis-Courmont
RTP out: improve soft-error handling
When the socket is congested, we should simply skip sending.
When there is a soft-error, we should resend and simply ignore.
Instead, we were dropping the socket if the failure remained on the
second try, which was always the case in the congestion scenario.
This should fix the socket dropping problem described at:
http://forum.videolan.org/viewtopic.php?f=4&t=56493
(cherry picked from commit 9fdc8915682d3d3beae69f6956616b660ec9963b)
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0625bc137df861f7fb46c979916545a0c88439d5
---
modules/stream_out/rtp.c | 33 ++++++++++++++++++++++++++++++---
1 files changed, 30 insertions(+), 3 deletions(-)
diff --git a/modules/stream_out/rtp.c b/modules/stream_out/rtp.c
index 7586ebf..b8d5cd1 100644
--- a/modules/stream_out/rtp.c
+++ b/modules/stream_out/rtp.c
@@ -1433,6 +1433,17 @@ static int HttpCallback( httpd_file_sys_t *p_args,
****************************************************************************/
static void* ThreadSend( vlc_object_t *p_this )
{
+#ifdef WIN32
+# define ECONNREFUSED WSAECONNREFUSED
+# define ENOPROTOOPT WSAENOPROTOOPT
+# define EPROTO WSAEPROTO
+# define EHOSTUNREACH WSAEHOSTUNREACH
+# define ENETUNREACH WSAEHOSTUNREACH
+# define ENETDOWN WSAENETDOWN
+# define ENOBUFS WSAENOBUFS
+# define EAGAIN WSAEGAIN
+# define EWOULDBLOCK WSAEWOULDBLOCK
+#endif
sout_stream_id_t *id = (sout_stream_id_t *)p_this;
unsigned i_caching = id->i_caching;
@@ -1475,9 +1486,25 @@ static void* ThreadSend( vlc_object_t *p_this )
if( send( id->sinkv[i].rtp_fd, out->p_buffer, len, 0 ) >= 0 )
continue;
- /* Retry sending to root out soft-errors */
- if( send( id->sinkv[i].rtp_fd, out->p_buffer, len, 0 ) >= 0 )
- continue;
+ switch( net_errno )
+ {
+ /* Soft errors (e.g. ICMP): */
+ case ECONNREFUSED: /* Port unreachable */
+ case ENOPROTOOPT:
+ case EPROTO: /* Protocol unreachable */
+ case EHOSTUNREACH: /* Host unreachable */
+ case ENETUNREACH: /* Network unreachable */
+ case ENETDOWN: /* Entire network down */
+ send( id->sinkv[i].rtp_fd, out->p_buffer, len, 0 );
+ /* Transient congestion: */
+ case ENOMEM: /* out of socket buffers */
+ case ENOBUFS:
+ case EAGAIN:
+#if (EAGAIN != EWOULDBLOCK)
+ case EWOULDBLOCK:
+#endif
+ continue;
+ }
deadv[deadc++] = id->sinkv[i].rtp_fd;
}
More information about the vlc-devel
mailing list