[vlc-devel] [PATCH 2/5] adaptive: PlaylistManager: fix spurious condition

Alexandre Janniaux ajanni at videolabs.io
Sun Nov 1 15:36:12 CET 2020


Hi,

On Sun, Nov 01, 2020 at 10:19:50PM +0800, Zhao Zhili wrote:
>
> > On Nov 1, 2020, at 7:34 PM, Alexandre Janniaux <ajanni at videolabs.io> wrote:
> >
> > ---
> > modules/demux/adaptive/PlaylistManager.cpp | 6 ++++--
> > 1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/modules/demux/adaptive/PlaylistManager.cpp b/modules/demux/adaptive/PlaylistManager.cpp
> > index 447f4b0365..8344de005a 100644
> > --- a/modules/demux/adaptive/PlaylistManager.cpp
> > +++ b/modules/demux/adaptive/PlaylistManager.cpp
> > @@ -445,8 +445,10 @@ int PlaylistManager::doDemux(vlc_tick_t increment)
> >            b_dead &= !(*it)->isValid();
> >            b_all_disabled &= (*it)->isDisabled();
> >        }
> > -        if(!b_dead)
> > -            vlc_cond_timedwait(&demux.cond, &demux.lock, vlc_tick_now() + VLC_TICK_FROM_MS(50));
> > +        vlc_tick_t deadline = vlc_tick_now() + VLC_TICK_FROM_MS(50);
> > +        int i_ret = 0;
> > +        while(!b_dead && i_ret == 0)
> > +            i_ret = vlc_cond_timedwait(&demux.cond, &demux.lock, deadline);
>
> Now it's just sleep. It should have a more sensible condition.

You're right, but that's probably a much bigger refactor involving
rewriting with vlc_timer instead of custom scheduling/waits based
on locking.

I wrote this a while ago but by re-reading it there were also points
where it was needing much more work related to locking sanitization.
I don't mind discarding this patch since a better one would remove it.

Thanks for feedback!

Regards,
--
Alexandre Janniaux
Videolabs

> >        vlc_mutex_unlock(&demux.lock);
> >        return (b_dead || b_all_disabled) ? AbstractStream::status_eof : AbstractStream::status_buffering;
> >    }
> > --
> > 2.29.2
> >
> > _______________________________________________
> > 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