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

Rémi Denis-Courmont remi at remlab.net
Wed Aug 21 19:28:20 CEST 2019


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.

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.

And then the flood argument does not add up to high playback rates.

> The time updated is the output time, unlike the on_position_changed event
> that use the input time. It can fixes a very big delay between the UI time
> widgets and the outputted content (depending on the audio output module,
> this delay could be close to 2seconds).
> 
> The vlc_player_timer_value struct is used by timer update callbacks. This
> public struct hold all the informations to interpolate a time at a given
> date. It could be done with the vlc_player_timer_value_Interpolate()
> helper. In this way, it is now possible to get the last player time without
> holding any locks.
> 
> There are two timer types:
> 
>  - Source: update are sent only when a frame or a sample is outputted. Users
> of this timer should take into account that the delay between each updates
> is not regular and can be up to 1seconds (depending of the input). In that
> case, they should use their own timer (from their mainloop) and use
> vlc_player_timer_value_Interpolate() to get the last time.

>  - Regular: The player will spawn a vlc timer (likely an other thread) that
>    will send regular time updates. It can be used by control/interfaces that
> don't have any mainloop.

That's sure to cause long term drift, and will obviously fail at non-nominal 
playback rates. Does not make much sense to me.

-- 
雷米‧德尼-库尔蒙
http://www.remlab.net/





More information about the vlc-devel mailing list