[vlc-devel] [PATCH] access: vnc: use thread specific var to redirect logging

Rémi Denis-Courmont remi at remlab.net
Sat Mar 23 18:57:12 CET 2013


Le samedi 23 mars 2013 16:19:25, Francois Cartegnie a écrit :
> ---
>  modules/access/vnc.c |   44 +++++++++++++++++++++++++++++++++++++++++---
>  1 files changed, 41 insertions(+), 3 deletions(-)
> 
> diff --git a/modules/access/vnc.c b/modules/access/vnc.c
> index 30f3e17..24a5942 100644
> --- a/modules/access/vnc.c
> +++ b/modules/access/vnc.c
> @@ -330,6 +361,9 @@ static void *DemuxThread( void *p_data )
>      mtime_t i_next_frame_date = mdate() + p_sys->i_frame_interval;
>      int i_status;
> 
> +    if ( rfbEnableClientLogging )
> +        vlc_threadvar_set( log_object_var, p_demux );
> +
>      for(;;)
>      {
>          p_sys->i_cancel_state = vlc_savecancel();
> @@ -403,9 +437,7 @@ static int Open( vlc_object_t *p_this )
>          return VLC_EGENERIC;
>      }
> 
> -#ifdef NDEBUG
> -    rfbEnableClientLogging = FALSE;
> -#endif
> +    rfbEnableClientLogging = !vlc_threadvar_create( &log_object_var, NULL

log_object_var seems to be leaked.

This also does not seem to fit in the memory model.

> );
> 
>      p_sys->p_client = rfbGetClient( p_chroma_desc->pixel_bits / 3, //
> bitsPerSample 3, // samplesPerPixel
> @@ -465,6 +497,12 @@ static int Open( vlc_object_t *p_this )
> 
>      p_sys->i_starttime = mdate();
> 
> +    if ( rfbEnableClientLogging )
> +    {
> +        rfbClientLog = logHandler;
> +        rfbClientErr = errLogHandler;
> +    }

This also does not seem to comply with the memory model.

> +
>      if ( vlc_clone( &p_sys->thread, DemuxThread, p_demux,
> VLC_THREAD_PRIORITY_INPUT ) != VLC_SUCCESS ) {
>          msg_Err( p_demux, "can't spawn thread" );

-- 
Rémi Denis-Courmont
http://www.remlab.net/



More information about the vlc-devel mailing list