[vlc-devel] [vlc-commits] vout: fix use-after-free, wait on correct date

Thomas Guillem thomas at gllm.fr
Tue Nov 17 20:01:31 CET 2015


I don't say that this patch is bad, but a git bisect pointed me here
when I tried to debug an a seeking issue.

The issue is that frames can be 1-4 seconds late after a seek:
"core video output warning: picture is too late to be displayed (missing
1350 ms)"

I found out that it was only happening when using the vdpau_chroma
filter.
It's quite easy to reproduce on Desktop: seek from 1 sec to 0 sec
repeatedly (with the Ctrl+arrow shortcut).

After a quick look at this module, I saw that it was re-ordering frame
dates, see history struct.
I stopped my research here, I don't really know how to fix this as I'm
not familiar with vdpau.


On Wed, Oct 21, 2015, at 19:22, Rémi Denis-Courmont wrote:
> vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Oct 21
> 21:14:16 2015 +0300| [dfefe47ff25ace43f1ac1fad7fa652c8b99eb1f6] |
> committer: Rémi Denis-Courmont
> 
> vout: fix use-after-free, wait on correct date
> 
> The mwait() call dereferenced a potentially no longer referenced picture
> (if the display was filtered).
> 
> > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=dfefe47ff25ace43f1ac1fad7fa652c8b99eb1f6
> ---
> 
>  src/video_output/video_output.c |    7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/src/video_output/video_output.c
> b/src/video_output/video_output.c
> index 937b305..ae9edfe 100644
> --- a/src/video_output/video_output.c
> +++ b/src/video_output/video_output.c
> @@ -981,6 +981,8 @@ static int ThreadDisplayRenderPicture(vout_thread_t
> *vout, bool is_forced)
>                  subpicture_Delete(subpic);
>              return VLC_EGENERIC;
>          }
> +
> +        todisplay = sys->display.filtered;
>      }
>  
>      vout_chrono_Stop(&vout->p->render);
> @@ -1004,10 +1006,7 @@ static int
> ThreadDisplayRenderPicture(vout_thread_t *vout, bool is_forced)
>  
>      /* Display the direct buffer returned by vout_RenderPicture */
>      vout->p->displayed.date = mdate();
> -    vout_display_Display(vd,
> -                         sys->display.filtered ? sys->display.filtered
> -                                                : todisplay,
> -                         subpic);
> +    vout_display_Display(vd, todisplay, subpic);
>      sys->display.filtered = NULL;
>  
>      vout_statistic_AddDisplayed(&vout->p->statistic, 1);
> 
> _______________________________________________
> vlc-commits mailing list
> vlc-commits at videolan.org
> https://mailman.videolan.org/listinfo/vlc-commits


More information about the vlc-devel mailing list