[vlc-devel] [PATCH] demux: adaptive: fix setPosition

Jean-Baptiste Kempf jb at videolan.org
Sat Nov 11 17:58:39 CET 2017


Then why not just change the initial ret to false?

On Sat, 11 Nov 2017, at 13:11, Zhao Zhili wrote:
> If there is no valid streams, setPosition should not return
> true/success. This can happen when DEMUX_SET_TIME failed which lead to
> all streams disabled, and then try DEMUX_SET_POSITION.
> ---
>   modules/demux/adaptive/PlaylistManager.cpp | 9 +++++++++
>   1 file changed, 9 insertions(+)
> 
> diff --git a/modules/demux/adaptive/PlaylistManager.cpp 
> b/modules/demux/adaptive/PlaylistManager.cpp
> index 95c8177..700fa3a 100644
> --- a/modules/demux/adaptive/PlaylistManager.cpp
> +++ b/modules/demux/adaptive/PlaylistManager.cpp
> @@ -346,6 +346,7 @@ mtime_t PlaylistManager::getDuration() const
>   bool PlaylistManager::setPosition(mtime_t time)
>   {
>       bool ret = true;
> +    bool hasValidStream = false;
>       for(int real = 0; real < 2; real++)
>       {
>           /* Always probe if we can seek first */
> @@ -354,11 +355,19 @@ bool PlaylistManager::setPosition(mtime_t time)
>           {
>               AbstractStream *st = *it;
>               if(!st->isDisabled())
> +            {
> +                hasValidStream = true;
>                   ret &= st->setPosition(time, !real);
> +            }
>           }
>           if(!ret)
>               break;
>       }
> +    if(!hasValidStream)
> +    {
> +        msg_Warn(p_demux, "there is no valid streams");
> +        ret = false;
> +    }
>       return ret;
>   }
> 
> -- 
> 2.7.4
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
> Email had 1 attachment:
> + 0001-demux-adaptive-fix-setPosition.patch
>   2k (text/x-patch)


-- 
Jean-Baptiste Kempf -  President
+33 672 704 734


More information about the vlc-devel mailing list