[vlc-devel] [PATCH] vout: spu: fix data-race

Thomas Guillem thomas at gllm.fr
Tue May 7 17:20:41 CEST 2019



On Tue, May 7, 2019, at 17:10, Rémi Denis-Courmont wrote:
> 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?

This case can't happen when there is only one SPU ES track (but it will soon, cf. Roland patches). Indeed, subpictures are flushed when the SPU decoder is destroyed.

To fix this issue,  a clock should be linked to its subpicture channel and set with the vout_RegisterSubpictureChannel call.

So, we can drop this patch and add a new trac issue.

> 
> > ---
> >  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/
> 
> 
> 
> _______________________________________________
> 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