[vlc-devel] demux: adaptive: fix a zero-divid bug.

Zhao Zhili quinkblack at foxmail.com
Thu Nov 22 04:00:29 CET 2018


Hi Xie,
What's the version of VLC has this bug?
If NearOptimalAdaptationLogic has this problem, then other 
AdaptationLogics have this problem too, so this patch is not complete.
On the other hand, modules/demux/adaptive/http/Chunk.cpp doesn't call 
updateDownloadRate if time is zero. I don't know how this can happen.

On 2018/11/15 下午6:49, Xie Zhigang wrote:
> fixes crashs on some cases with zero update download rates.
> ---
>   modules/demux/adaptive/logic/NearOptimalAdaptationLogic.cpp | 3 +++
>   1 file changed, 3 insertions(+)
>
> diff --git a/modules/demux/adaptive/logic/NearOptimalAdaptationLogic.cpp b/modules/demux/adaptive/logic/NearOptimalAdaptationLogic.cpp
> index 1c99538..32bb863 100644
> --- a/modules/demux/adaptive/logic/NearOptimalAdaptationLogic.cpp
> +++ b/modules/demux/adaptive/logic/NearOptimalAdaptationLogic.cpp
> @@ -179,6 +179,9 @@ unsigned NearOptimalAdaptationLogic::getMaxCurrentBw() const
>   
>   void NearOptimalAdaptationLogic::updateDownloadRate(const ID &id, size_t dlsize, vlc_tick_t time)
>   {
> +    if (time <= 0)
> +        return;
> +
>       vlc_mutex_lock(&lock);
>       std::map<ID, NearOptimalContext>::iterator it = streams.find(id);
>       if(it != streams.end())





More information about the vlc-devel mailing list