[vlc-devel] [PATCH 08/13] player: add the timer API

Romain Vimont rom1v at videolabs.io
Thu Aug 22 17:25:11 CEST 2019


On Thu, Aug 22, 2019 at 06:12:10PM +0300, Rémi Denis-Courmont wrote:
> Le torstaina 22. elokuuta 2019, 12.06.00 EEST Thomas Guillem a écrit :
> > On Wed, Aug 21, 2019, at 19:28, Rémi Denis-Courmont wrote:
> > > Le keskiviikkona 21. elokuuta 2019, 17.13.59 EEST Thomas Guillem a écrit :
> > > > Any interface or control modules could request a timer from the player.
> > > > This> > 
> > > > player timer is like the player event listener except that:
> > > >  - It is only used to receive time update
> > > >  
> > > >  - The timer is not locked by the player lock. Indeed the player lock
> > > >  can be
> > > > 
> > > > too "slow" (it can be recursive, it is used by the playlist, and is it
> > > > held
> > > > when sending all events). So it's not a good idea to hold this lock for
> > > > every frame/sample updates.
> > > > 
> > > >  - The minimum delay between each updates can be configured: it avoids
> > > >  to
> > > > 
> > > > flood the UI when playing a media file with very high fps or very low
> > > > audio
> > > > sample size.
> > > 
> > > I don't think that works.
> > 
> > cf. Qt implementation.
> 
> I don't think any existing implementation around the clumsy existing API is a 
> good reference.
> 
> > > A UI would typically want to know when the clock crosses a certain
> > > threshold, e.g. everytime the value of lround(play_time / CLOCK_FREQ)
> > > changes. In other words, it wants to know when to replace 00:00 with
> > > 00:01.
> > 
> > It can't work, some inputs have audio samples size that are bigger than one
> > seconds,
> 
> I did write "e.g. (...) CLOCK_FREQ". The threshold could be whole second, 
> whole frame interval, whole slider pixel, or whatever. Point is that typically 
> GUI wants to know when a play time interval starts, rather than the play time 
> poll at a regular interval.
> 
> If user seeks to 00:12:42.931, the UI wants to update the display at 
> 00:12:43.000, not at 00:12:43.931.

In that case, it should probably use the SOURCE timer, and use a local
thread to do stuff at the exact time it wants. (REGULAR is just an
helper for regular updates).


More information about the vlc-devel mailing list