]> git.sesse.net Git - vlc/blobdiff - modules/stream_out/rtp.c
Also try to send twice without splice().
[vlc] / modules / stream_out / rtp.c
index 6434f5ade2a8ef9efce4bcc133aaff97735ee8eb..fb93f2346a27c3d069d9f5e18291d4fd1ed6eb95 100644 (file)
@@ -277,7 +277,6 @@ struct sout_stream_id_t
 
     sout_stream_t *p_stream;
     /* rtp field */
-    uint32_t    i_timestamp_start;
     uint16_t    i_sequence;
     uint8_t     i_payload_type;
     uint8_t     ssrc[4];
@@ -845,7 +844,6 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt )
 
     id->p_stream   = p_stream;
 
-    id->i_timestamp_start = rand()&0xffffffff;
     id->i_sequence = rand()&0xffff;
     id->i_payload_type = p_sys->i_payload_type;
     id->ssrc[0] = rand()&0xff;
@@ -1380,10 +1378,8 @@ static void ThreadSend( vlc_object_t *p_this )
         mwait( i_date );
 
         vlc_mutex_lock( &id->lock_sink );
-#if 0
         unsigned deadc = 0; /* How many dead sockets? */
         int deadv[id->sinkc]; /* Dead sockets list */
-#endif
 
         for( int i = 0; i < id->sinkc; i++ )
         {
@@ -1394,12 +1390,20 @@ static void ThreadSend( vlc_object_t *p_this )
             if( splice( fd[2], NULL, id->sinkv[i].rtp_fd, NULL, len,
                         SPLICE_F_NONBLOCK ) >= 0 )
                 continue;
+            if( errno == EAGAIN )
+                continue;
 
             /* splice failed */
             splice( fd[2], NULL, fd[4], NULL, len, 0 );
+#else
+            if( send( id->sinkv[i].rtp_fd, out->p_buffer, len, 0 ) >= 0 )
+                continue;
 #endif
-            if( send( id->sinkv[i].rtp_fd, out->p_buffer, len, 0 ) < 0 )
-                /*deadv[deadc++] = id->sinkv[i].rtp_fd*/;
+            /* Retry sending to root out soft-errors */
+            if( send( id->sinkv[i].rtp_fd, out->p_buffer, len, 0 ) >= 0 )
+                continue;
+
+            deadv[deadc++] = id->sinkv[i].rtp_fd;
         }
         vlc_mutex_unlock( &id->lock_sink );
 
@@ -1408,13 +1412,11 @@ static void ThreadSend( vlc_object_t *p_this )
         splice( fd[0], NULL, fd[4], NULL, len, 0 );
 #endif
 
-#if 0
         for( unsigned i = 0; i < deadc; i++ )
         {
             msg_Dbg( id, "removing socket %d", deadv[i] );
             rtp_del_sink( id, deadv[i] );
         }
-#endif
 
         /* Hopefully we won't overflow the SO_MAXCONN accept queue */
         while( id->listen_fd != NULL )