[vlc-devel] [RFC 02/38] access/live555: replaced usage of abort

Filip Roséen filip at videolabs.io
Mon Jun 27 13:43:13 CEST 2016


also took the opportunity to mak the code a little bit more readable by
declaring the format string prior to the asprintf.
---
 modules/access/live555.cpp | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/modules/access/live555.cpp b/modules/access/live555.cpp
index 700c4c5..6a6fa9b 100644
--- a/modules/access/live555.cpp
+++ b/modules/access/live555.cpp
@@ -339,14 +339,20 @@ static int  Open ( vlc_object_t *p_this )
 
     if( strcasecmp( p_demux->psz_access, "satip" ) == 0 )
     {
-        if( asprintf(&p_sys->p_sdp, "v=0\r\n"
-                     "o=- 0 %s\r\n"
-                     "s=SATIP:stream\r\n"
-                     "i=SATIP RTP Stream\r\n"
-                     "m=video 0 RTP/AVP 33\r\n"
-                     "a=control:rtsp://%s\r\n\r\n",
-                     p_sys->url.psz_host, p_sys->psz_path) < 0 )
-            abort();
+        char const * req_fmt = ""
+            "v=0"                  "\r\n"
+            "o=- 0 %s"             "\r\n"
+            "s=SATIP:stream"       "\r\n"
+            "i=SATIP RTP Stream"   "\r\n"
+            "m=video 0 RTP/AVP 33" "\r\n"
+            "a=control:rtsp://%s"  "\r\n"
+            "\r\n";
+
+        if( asprintf( &p_sys->p_sdp, req_fmt, p_sys->url.psz_host, p_sys->psz_path ) < 0 )
+        {
+            free( p_demux->p_sys );
+            return VLC_ENOMEM;
+        }
     }
 
     if( p_demux->s != NULL )
-- 
2.9.0



More information about the vlc-devel mailing list