[vlc-devel] [PATCH] chromaprint: add fingerprinter module

Rafaël Carré funman at videolan.org
Thu Dec 20 16:21:22 CET 2012


Hello,

Le 22/11/2012 21:47, Francois Cartegnie a écrit :


> +        struct { vlc_mutex_t lock; vlc_cond_t cond; } wait;
> +        vlc_mutex_init( &wait.lock );
> +        vlc_cond_init( &wait.cond );
> +
> +        input_Start( p_input );
> +
> +        /* Wait first for item to be preparsed */
> +        while( !b_preparsed )
> +        {
> +            mtime_t timeout = mdate() + 50000;
> +            vlc_mutex_lock( &wait.lock );
> +            vlc_cond_timedwait( &wait.cond, &wait.lock, timeout );

Basically you're implementing sleep() in a more confusing way.
condition variable would be useful if another thread signals this one
that it doesn't need to wait any more.

> +            vlc_mutex_unlock( &wait.lock );
> +
> +            b_preparsed |= input_item_IsPreparsed( p_item );
> +        }
> +

> +    for (;;)
> +    {
... no break; here
> +    }
> +    vlc_restorecancel( p_sys->i_cancel_state );

so this line is never reached.

> +}




More information about the vlc-devel mailing list