[vlc-devel] [PATCH] clock: don't return invalid ts when paused
Thomas Guillem
thomas at gllm.fr
Thu Sep 5 10:24:28 CEST 2019
On Thu, Sep 5, 2019, at 10:02, Thomas Guillem wrote:
> This commit is wrong. When unpaused, the vout can request a time to the
> clock while the clock is still paused (but will soon be unpaused,
> threading...). In that case, the converted time will be delayed by the
> pause delay.
Naup, there is a problem but not this one ^^ since the clock will always be resumed before all outputs, cf. es_out.c
It's related to seek/flush while paused.
>
> On Wed, Sep 4, 2019, at 14:35, Thomas Guillem wrote:
> > vlc_clock_ConvertToSystem() could return INT64_MAX when paused, this was not
> > documented and not handled at all by the aout and the vout.
> >
> > To fix this issue, I first tried the obvious choice: handling this INT64_T
> > value from both outputs. The problem is that I don't really know how to handle
> > it. Indeed, the main clock and every outputs are requested to pause at the same
> > time, but they all run on different thread and will process this request on
> > their own timeline. Therefore, the output might be still running when the clock
> > is paused. Handling 2 different pause state from the output is not a good idea.
> >
> > So I decided a simpler fix: the clock will act as it's not paused and will
> > always return valid values. Indeed, both outputs are very likely to be in the
> > pause state anyway and will stop requesting/updating time to the clock.
> >
> > PS: The pause state from the clock is now only used to apply the pause delay on
> > the reference point.
> > ---
> > src/clock/clock.c | 7 +------
> > 1 file changed, 1 insertion(+), 6 deletions(-)
> >
> > diff --git a/src/clock/clock.c b/src/clock/clock.c
> > index 15a6cf68e4..cfaef7b151 100644
> > --- a/src/clock/clock.c
> > +++ b/src/clock/clock.c
> > @@ -227,8 +227,6 @@ static vlc_tick_t
> > vlc_clock_slave_to_system_locked(vlc_clock_t *clock,
> > vlc_tick_t ts,
> > double rate)
> > {
> > vlc_clock_main_t *main_clock = clock->owner;
> > - if (main_clock->pause_date != VLC_TICK_INVALID)
> > - return INT64_MAX;
> >
> > vlc_tick_t system = main_stream_to_system(main_clock, ts);
> > if (system == VLC_TICK_INVALID)
> > @@ -300,10 +298,7 @@ int vlc_clock_Wait(vlc_clock_t *clock, vlc_tick_t
> > system_now, vlc_tick_t ts,
> > while (!main_clock->abort)
> > {
> > vlc_tick_t deadline;
> > - if (main_clock->pause_date != VLC_TICK_INVALID)
> > - deadline = INT64_MAX;
> > - else
> > - deadline = clock->to_system_locked(clock, system_now, ts,
> > rate);
> > + deadline = clock->to_system_locked(clock, system_now, ts,
> > rate);
> > deadline = __MIN(deadline, max_deadline);
> >
> > if (vlc_cond_timedwait(&main_clock->cond, &main_clock->lock, deadline))
> > --
> > 2.20.1
> >
> > _______________________________________________
> > vlc-devel mailing list
> > To unsubscribe or modify your subscription options:
> > https://mailman.videolan.org/listinfo/vlc-devel
> _______________________________________________
> 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