[vlc-commits] commit: rtsp: small simplification (Pierre Ynard )

git at videolan.org git at videolan.org
Fri Dec 17 10:39:03 CET 2010


vlc | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Fri Dec 17 10:38:36 2010 +0100| [38d2de2c17f568f5543b5affdee8f25ade2aeb7e] | committer: Pierre Ynard 

rtsp: small simplification

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=38d2de2c17f568f5543b5affdee8f25ade2aeb7e
---

 modules/stream_out/rtsp.c |   27 ++++++++++-----------------
 1 files changed, 10 insertions(+), 17 deletions(-)

diff --git a/modules/stream_out/rtsp.c b/modules/stream_out/rtsp.c
index 85a4a11..ae8d3f2 100644
--- a/modules/stream_out/rtsp.c
+++ b/modules/stream_out/rtsp.c
@@ -905,29 +905,22 @@ static int RtspHandler( rtsp_stream_t *rtsp, rtsp_stream_id_t *id,
 
                     httpd_ServerIP( cl, ip );
 
+                    /* Specify source IP only if it is different from the
+                     * RTSP control connection server address */
                     if( strcmp( src, ip ) )
                     {
-                        /* Specify source IP if it is different from the RTSP
-                         * control connection server address */
                         char *ptr = strchr( src, '%' );
                         if( ptr != NULL ) *ptr = '\0'; /* remove scope ID */
-
-                        httpd_MsgAdd( answer, "Transport",
-                                      "RTP/AVP/UDP;unicast;source=%s;"
-                                      "client_port=%u-%u;server_port=%u-%u;"
-                                      "ssrc=%08X;mode=play",
-                                      src, loport, loport + 1, sport,
-                                      sport + 1, ssrc );
                     }
                     else
-                    {
-                        httpd_MsgAdd( answer, "Transport",
-                                      "RTP/AVP/UDP;unicast;"
-                                      "client_port=%u-%u;server_port=%u-%u;"
-                                      "ssrc=%08X;mode=play",
-                                      loport, loport + 1, sport, sport + 1,
-                                      ssrc );
-                    }
+                        src[0] = '\0';
+
+                    httpd_MsgAdd( answer, "Transport",
+                                  "RTP/AVP/UDP;unicast%s%s;"
+                                  "client_port=%u-%u;server_port=%u-%u;"
+                                  "ssrc=%08X;mode=play",
+                                  src[0] ? ";source=" : "", src,
+                                  loport, loport + 1, sport, sport + 1, ssrc );
 
                     answer->i_status = 200;
                 }



More information about the vlc-commits mailing list