]> git.sesse.net Git - vlc/commitdiff
- Loosen dependency of RTSP code on stream ID
authorRémi Denis-Courmont <rem@videolan.org>
Thu, 23 Aug 2007 17:44:50 +0000 (17:44 +0000)
committerRémi Denis-Courmont <rem@videolan.org>
Thu, 23 Aug 2007 17:44:50 +0000 (17:44 +0000)
- Do not refer to bogus TTL values

modules/stream_out/rtp.c
modules/stream_out/rtp.h
modules/stream_out/rtsp.c

index e058e4020abbd12dd814c871f327a59db0c56943..297c019164bccc69da74b2fc19374f32e61d4eaf 100644 (file)
@@ -399,7 +399,7 @@ static int Open( vlc_object_t *p_this )
            o= - should be local username (no spaces allowed)
            o= time should be hashed with some other value to garantee uniqueness
            o= don't use the localhost address. use fully qualified domain name or IP4 address
-          a= source-filter: we need our source address
+           a= source-filter: we need our source address
            a= x-plgroup: (missing)
            RTP packets need to get the correct src IP address  */
         if( ipv == '4'
@@ -849,7 +849,7 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt )
         char url[NI_MAXHOST + 8];
 
         /* first try to create the access out */
-        if( p_sys->i_ttl )
+        if( p_sys->i_ttl > 0 )
         {
             snprintf( access, sizeof( access ), "udp{raw,rtcp,ttl=%d}",
                       p_sys->i_ttl );
@@ -1461,6 +1461,20 @@ static void rtp_packetize_send( sout_stream_id_t *id, block_t *out )
     }
 }
 
+int rtp_add_sink( sout_stream_id_t *id, sout_access_out_t *access )
+{
+    vlc_mutex_lock( &id->lock_rtsp );
+    TAB_APPEND( id->i_rtsp_access, id->rtsp_access, access );
+    vlc_mutex_unlock( &id->lock_rtsp );
+}
+
+void rtp_del_sink( sout_stream_id_t *id, sout_access_out_t *access )
+{
+    vlc_mutex_lock( &id->lock_rtsp );
+    TAB_REMOVE( id->i_rtsp_access, id->rtsp_access, access );
+    vlc_mutex_unlock( &id->lock_rtsp );
+}
+
 static int rtp_packetize_mpa( sout_stream_t *p_stream, sout_stream_id_t *id,
                               block_t *in )
 {
index e59d3fc4c4657f5998862d7a674b263388ba1da4..f136838f0020dc76d98362527d1b076e623d5644 100644 (file)
@@ -34,6 +34,9 @@ void RtspClientDel( sout_stream_t *, rtsp_client_t * );
 char *SDPGenerate( const sout_stream_t *p_stream,
                    const char *psz_destination, vlc_bool_t b_rtsp );
 
+int rtp_add_sink( sout_stream_id_t *id, sout_access_out_t *access );
+void rtp_del_sink( sout_stream_id_t *id, sout_access_out_t *access );
+
 typedef int (*pf_rtp_packetizer_t)( sout_stream_t *, sout_stream_id_t *,
                                     block_t * );
 
index 6427f8dae8570a581a45938b3c349cb277cbd5e5..9e3b87616dd9963d0c5a39ecf4cf6e95030008d0 100644 (file)
@@ -213,9 +213,7 @@ static int  RtspCallback( httpd_callback_sys_t *p_args,
                     }
                     if( i >= p_sys->i_es ) continue;
 
-                    vlc_mutex_lock( &id->lock_rtsp );
-                    TAB_APPEND( id->i_rtsp_access, id->rtsp_access, rtsp->access[i_id] );
-                    vlc_mutex_unlock( &id->lock_rtsp );
+                    rtp_add_sink( id, rtsp->access[i_id] );
                 }
                 vlc_mutex_unlock( &p_sys->lock_es );
             }
@@ -253,9 +251,7 @@ static int  RtspCallback( httpd_callback_sys_t *p_args,
                     }
                     if( i >= p_sys->i_es ) continue;
 
-                    vlc_mutex_lock( &id->lock_rtsp );
-                    TAB_REMOVE( id->i_rtsp_access, id->rtsp_access, rtsp->access[i_id] );
-                    vlc_mutex_unlock( &id->lock_rtsp );
+                    rtp_del_sink( id, rtsp->access[i_id] );
                 }
                 vlc_mutex_unlock( &p_sys->lock_es );
 
@@ -309,11 +305,11 @@ static inline const char *parameter_next( const char *str )
 
 /** Non-aggregate RTSP callback */
 /*static*/ int RtspCallbackId( httpd_callback_sys_t *p_args,
-                           httpd_client_t *cl,
-                           httpd_message_t *answer, httpd_message_t *query )
+                               httpd_client_t *cl,
+                               httpd_message_t *answer, httpd_message_t *query )
 {
     sout_stream_id_t *id = (sout_stream_id_t*)p_args;
-    sout_stream_t    *p_stream = id->p_stream;
+    sout_stream_t    *p_stream = idd->p_stream;
     sout_stream_sys_t *p_sys = p_stream->p_sys;
     char psz_session_init[21];
     const char *psz_session;
@@ -418,7 +414,7 @@ static inline const char *parameter_next( const char *str )
 
                 if( b_multicast )
                 {
-                    if( id->psz_destination == NULL )
+                    if( p_sys->psz_destination == NULL )
                         continue;
 
                     answer->i_status = 200;
@@ -426,7 +422,7 @@ static inline const char *parameter_next( const char *str )
                     httpd_MsgAdd( answer, "Transport",
                                   "RTP/AVP/UDP;destination=%s;port=%d-%d;"
                                   "ttl=%d;mode=play",
-                                  id->psz_destination, id->i_port, id->i_port+1,
+                                  p_sys->psz_destination, idd->i_port, idd->i_port+1,
                                   ( p_sys->i_ttl > 0 ) ? p_sys->i_ttl : 1 );
                 }
                 else
@@ -462,7 +458,7 @@ static inline const char *parameter_next( const char *str )
                         continue;
                     }
 
-                    if( p_sys->i_ttl )
+                    if( p_sys->i_ttl > 0 )
                         snprintf( psz_access, sizeof( psz_access ),
                                   "udp{raw,rtcp,ttl=%d}", p_sys->i_ttl );
                     else