[vlc-devel] [PATCH 1/7] input: also copy input slaves in input_item_Copy

Alexandre Janniaux ajanni at videolabs.io
Tue Oct 22 00:51:41 CEST 2019


Hi,

This is meaningful as the slaves are owned by the input
item, but maybe the documentation of the input_item_Copy
should be updated to signal this?

The case of failure is a bit weird. If we cannot allocate
memory it would only remove the slave silently from the
copy. Maybe bailing out and return NULL would be a better
error management candidate?

Regards,
--
Alexandre Janniaux
Videolabs

On Mon, Oct 21, 2019 at 06:08:53PM +0200, Pierre Lamot wrote:
> ---
>  src/input/item.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
>
> diff --git a/src/input/item.c b/src/input/item.c
> index e8db39ca28..a01d4bb3e4 100644
> --- a/src/input/item.c
> +++ b/src/input/item.c
> @@ -1119,6 +1119,22 @@ input_item_t *input_item_Copy( input_item_t *p_input )
>          vlc_meta_Merge( meta, p_input->p_meta );
>      }
>      b_net = p_input->b_net;
> +
> +    if( likely(item != NULL) && p_input->i_slaves > 0 )
> +    {
> +        for( int i = 0; i < p_input->i_slaves; i++ )
> +        {
> +            input_item_slave_t* slave = input_item_slave_New(
> +                        p_input->pp_slaves[i]->psz_uri,
> +                        p_input->pp_slaves[i]->i_type,
> +                        p_input->pp_slaves[i]->i_priority);
> +            if( unlikely(slave != NULL) )
> +            {
> +                TAB_APPEND(item->i_slaves, item->pp_slaves, slave);
> +            }
> +        }
> +    }
> +
>      vlc_mutex_unlock( &p_input->lock );
>
>      if( likely(item != NULL) )
> --
> 2.17.1
>
> _______________________________________________
> 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