[vlc-devel] [RFC PATCH 1/2] vod: fix rtsp_path

Zhao Zhili quinkblack at foxmail.com
Sat Sep 29 19:02:26 CEST 2018


Hi Filip,

> On Sep 29, 2018, at 11:06 PM, Filip Roséen <filip at atch.se> wrote:
> 
> Hi Zhao,
> 
> On 2018-09-29 21:25, Zhao Zhili wrote:
> 
>  1. The document says rtsp-host is address/path
>  2. stream_out/vod treats it as url, which is incorrect
>  3. httpd treats it as address or hostname
> 
>  It simple to fix it by taking the rtsp-host as only hostname.
> 
> We will want the option to add an additional path associated with the sout, not only because it’s user-friendly, but also because the alternative would mean that it would be impossible to set up two stream_outputs that share the same media-names, even though the two might refer to completely different set of data (as both would end up listening on the same path).
> 
> For me, I do not see what the benefit of this patch is in the long run. If you want to “fix” things, allow the same mechanism but through some other behavior, removing the functionality all together is, in my opinion, not the way to go.

I'm not clear how it's different to http and how http handle the base path issue. If we need to support this feature, rtsp and httpd need some fix, which can be a little hard and not clean. Or we can add another option to configure the path. What do you think?

> 
>  ---
>   modules/stream_out/vod.c | 51 +++++-------------------------------------------
>   1 file changed, 5 insertions(+), 46 deletions(-)
> 
>  diff --git a/modules/stream_out/vod.c b/modules/stream_out/vod.c
>  index e1b6cbd..6b358ca 100644
>  --- a/modules/stream_out/vod.c
>  +++ b/modules/stream_out/vod.c
>  @@ -78,8 +78,6 @@ struct vod_media_t
> 
>   typedef struct
>   {
>  -    char *psz_rtsp_path;
>  -
>       /* */
>       vlc_thread_t thread;
>       block_fifo_t *p_fifo_cmd;
>  @@ -116,39 +114,10 @@ int OpenVoD( vlc_object_t *p_this )
>   {
>       vod_t *p_vod = (vod_t *)p_this;
>       vod_sys_t *p_sys = NULL;
>  -    char *psz_url;
> 
>       p_vod->p_sys = p_sys = malloc( sizeof( vod_sys_t ) );
>  -    if( !p_sys ) goto error;
>  -
>  -    psz_url = var_InheritString( p_vod, "rtsp-host" );
>  -
>  -    if( psz_url == NULL )
>  -        p_sys->psz_rtsp_path = strdup( "/" );
>  -    else
>  -    {
>  -        vlc_url_t url;
>  -        vlc_UrlParse( &url, psz_url );
>  -        free( psz_url );
>  -
>  -        if( url.psz_path == NULL )
>  -            p_sys->psz_rtsp_path = strdup( "/" );
>  -        else
>  -        if( !( strlen( url.psz_path ) > 0
>  -               && url.psz_path[strlen( url.psz_path ) - 1] == '/' ) )
>  -        {
>  -            if( asprintf( &p_sys->psz_rtsp_path, "%s/", url.psz_path ) == -1 )
>  -            {
>  -                p_sys->psz_rtsp_path = NULL;
>  -                vlc_UrlClean( &url );
>  -                goto error;
>  -            }
>  -        }
>  -        else
>  -            p_sys->psz_rtsp_path = strdup( url.psz_path );
>  -
>  -        vlc_UrlClean( &url );
>  -    }
>  +    if( !p_sys )
>  +        return VLC_EGENERIC;
> 
>       p_vod->pf_media_new = MediaNew;
>       p_vod->pf_media_del = MediaAskDel;
>  @@ -158,19 +127,11 @@ int OpenVoD( vlc_object_t *p_this )
>       {
>           msg_Err( p_vod, "cannot spawn rtsp vod thread" );
>           block_FifoRelease( p_sys->p_fifo_cmd );
>  -        goto error;
>  -    }
>  -
>  -    return VLC_SUCCESS;
>  -
>  -error:
>  -    if( p_sys )
>  -    {
>  -        free( p_sys->psz_rtsp_path );
>           free( p_sys );
>  +        return VLC_EGENERIC;
>       }
> 
>  -    return VLC_EGENERIC;
>  +    return VLC_SUCCESS;
>   }
> 
>   /*****************************************************************************
>  @@ -197,7 +158,6 @@ void CloseVoD( vlc_object_t * p_this )
>       }
>       block_FifoRelease( p_sys->p_fifo_cmd );
> 
>  -    free( p_sys->psz_rtsp_path );
>       free( p_sys );
>   }
> 
>  @@ -274,10 +234,9 @@ error:
>   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_path;
> 
>  -    if( asprintf( &psz_path, "%s%s", p_sys->psz_rtsp_path, psz_name ) < 0 )
>  +    if( asprintf( &psz_path, "/%s", psz_name ) < 0 )
>           return;
> 
>       p_media->rtsp = RtspSetup(VLC_OBJECT(p_vod), p_media, psz_path);
>  -- 
>  2.9.5
> 
> 
>  _______________________________________________
>  vlc-devel mailing list
>  To unsubscribe or modify your subscription options:
>  
> https://mailman.videolan.org/listinfo/vlc-devel
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel





More information about the vlc-devel mailing list