[vlc-commits] vod: set up RTSP stack of new media in an asynchronous way

Pierre Ynard git at videolan.org
Tue Jan 25 18:47:21 CET 2011


vlc | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Tue Jan 25 18:35:49 2011 +0100| [31b8ffbf04d9ebea6869d5301450c2b1575d015b] | committer: Pierre Ynard

vod: set up RTSP stack of new media in an asynchronous way

This way, we don't take the httpd lock when holding the vlm lock.
This will allow passing synchronous calls from the RTSP stack to the
VLM (as long as you don't use the old vod module at the same time,
which you can't anyway).

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

 modules/stream_out/vod.c |   32 +++++++++++++++++---------------
 1 files changed, 17 insertions(+), 15 deletions(-)

diff --git a/modules/stream_out/vod.c b/modules/stream_out/vod.c
index 28eb6fd..547ffd4 100644
--- a/modules/stream_out/vod.c
+++ b/modules/stream_out/vod.c
@@ -209,8 +209,6 @@ void CloseVoD( vlc_object_t * p_this )
 static vod_media_t *MediaNew( vod_t *p_vod, const char *psz_name,
                               input_item_t *p_item )
 {
-    vod_sys_t *p_sys = p_vod->p_sys;
-
     vod_media_t *p_media = calloc( 1, sizeof(vod_media_t) );
     if( !p_media )
         return NULL;
@@ -265,10 +263,24 @@ static vod_media_t *MediaNew( vod_t *p_vod, const char *psz_name,
         goto error;
     }
 
+    msg_Dbg(p_vod, "adding media '%s'", psz_name);
+
+    CommandPush( p_vod, RTSP_CMD_TYPE_ADD, p_media, NULL, 0, psz_name );
+    return p_media;
+
+error:
+    MediaDel(p_vod, p_media);
+    return NULL;
+}
+
+static void MediaSetup( vod_t *p_vod, vod_media_t *p_media,
+                        const char *psz_name )
+{
+    vod_sys_t *p_sys = p_vod->p_sys;
     char *psz_url;
 
     if( asprintf( &psz_url, "%s%s", p_sys->psz_rtsp_url, psz_name ) < 0 )
-        goto error;
+        return;
 
     vlc_url_t url;
     vlc_UrlParse( &url, psz_url, 0 );
@@ -279,25 +291,14 @@ static vod_media_t *MediaNew( vod_t *p_vod, const char *psz_name,
     vlc_UrlClean( &url );
 
     if (p_media->rtsp == NULL)
-        goto error;
+        return;
 
     for (int i = 0; i < p_media->i_es; i++)
     {
         media_es_t *p_es = p_media->es[i];
         p_es->rtsp_id = RtspAddId(p_media->rtsp, NULL, 0,
                                   p_es->rtp_fmt.clock_rate, -1);
-        if (p_es->rtsp_id == NULL)
-            goto error;
     }
-
-    msg_Dbg(p_vod, "adding media '%s'", psz_name);
-
-    CommandPush( p_vod, RTSP_CMD_TYPE_ADD, p_media, NULL, 0, NULL );
-    return p_media;
-
-error:
-    MediaDel(p_vod, p_media);
-    return NULL;
 }
 
 static void MediaAskDel ( vod_t *p_vod, vod_media_t *p_media )
@@ -377,6 +378,7 @@ static void* CommandThread( vlc_object_t *p_this )
 
         if ( cmd.i_type == RTSP_CMD_TYPE_ADD )
         {
+            MediaSetup(p_vod, cmd.p_media, cmd.psz_arg);
             goto next;
         }
 



More information about the vlc-commits mailing list