[vlc-devel] [PATCH] vout: spu: fix data-race
Rémi Denis-Courmont
remi at remlab.net
Tue May 7 17:09:55 CEST 2019
Le tiistaina 7. toukokuuta 2019, 15.17.44 EEST Thomas Guillem a écrit :
> The clock pointer, used by the vout thread was already protected by this
> lock.
Adding the lock like that still leaves the possibility that a timestamp is
computed with one clock, and then used after the clock is changed. How does it
work then?
> ---
> src/video_output/vout_subpictures.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/src/video_output/vout_subpictures.c
> b/src/video_output/vout_subpictures.c index 6b106534d3..ae242dda11 100644
> --- a/src/video_output/vout_subpictures.c
> +++ b/src/video_output/vout_subpictures.c
> @@ -1489,19 +1489,25 @@ void spu_Detach(spu_t *spu)
>
> void spu_clock_Set(spu_t *spu, vlc_clock_t *clock)
> {
> + vlc_mutex_lock(&spu->p->lock);
> spu->p->clock = clock;
> + vlc_mutex_unlock(&spu->p->lock);
> }
>
> void spu_clock_Reset(spu_t *spu)
> {
> + vlc_mutex_lock(&spu->p->lock);
> if (spu->p->clock)
> vlc_clock_Reset(spu->p->clock);
> + vlc_mutex_unlock(&spu->p->lock);
> }
>
> void spu_clock_SetDelay(spu_t *spu, vlc_tick_t delay)
> {
> + vlc_mutex_lock(&spu->p->lock);
> if (spu->p->clock)
> vlc_clock_SetDelay(spu->p->clock, delay);
> + vlc_mutex_unlock(&spu->p->lock);
> }
>
> /**
--
Rémi Denis-Courmont
http://www.remlab.net/
More information about the vlc-devel
mailing list