[vlc-devel] [PATCH] video_output: fix controls and events not processed
Thomas Guillem
thomas at gllm.fr
Mon Mar 30 14:40:33 CEST 2015
No opinions ?
On Wed, Mar 25, 2015, at 18:27, Thomas Guillem wrote:
> This issue is easily reproducible with VDPAU activated, with a 60fps ts
> file,
> see #14199.
>
> With this sample, The video_output Thread is looping in
> ThreadDisplayPicture
> way more often than with other videos. Consequently, vout_ManageWrapper
> and
> ThreadControl are not called enough. As a result, subtitles are processed
> too
> late, the mouse isn't able to hide/unhide, we can be stuck in fullscreen
> mode,
> or second click on video to pop up the menu doesn't work.
>
> To fix this issue: don't loop in ThreadDisplayPicture and don't wait in
> vout_control_Pop if a picture was previously displayed.
>
> Fixes #14199
> ---
> src/video_output/control.c | 9 +++------
> src/video_output/control.h | 2 +-
> src/video_output/video_output.c | 15 +++++++++++----
> 3 files changed, 15 insertions(+), 11 deletions(-)
>
> diff --git a/src/video_output/control.c b/src/video_output/control.c
> index f317196..bbdb894 100644
> --- a/src/video_output/control.c
> +++ b/src/video_output/control.c
> @@ -177,19 +177,16 @@ void vout_control_PushString(vout_control_t *ctrl,
> int type, const char *string)
> }
>
> int vout_control_Pop(vout_control_t *ctrl, vout_control_cmd_t *cmd,
> - mtime_t deadline, mtime_t timeout)
> + mtime_t deadline)
> {
> vlc_mutex_lock(&ctrl->lock);
> if (ctrl->cmd.i_size <= 0) {
> ctrl->is_processing = false;
> vlc_cond_broadcast(&ctrl->wait_acknowledge);
>
> - const mtime_t max_deadline = mdate() + timeout;
> - const mtime_t wait_deadline = deadline <= VLC_TS_INVALID ?
> max_deadline : __MIN(deadline, max_deadline);
> -
> /* Spurious wakeups are perfectly fine */
> - if (ctrl->can_sleep)
> - vlc_cond_timedwait(&ctrl->wait_request, &ctrl->lock,
> wait_deadline);
> + if (deadline > VLC_TS_INVALID && ctrl->can_sleep)
> + vlc_cond_timedwait(&ctrl->wait_request, &ctrl->lock,
> deadline);
> }
>
> bool has_cmd;
> diff --git a/src/video_output/control.h b/src/video_output/control.h
> index f52a529..159e5f8 100644
> --- a/src/video_output/control.h
> +++ b/src/video_output/control.h
> @@ -130,7 +130,7 @@ void vout_control_PushString(vout_control_t *, int
> type, const char *string);
> void vout_control_Wake(vout_control_t *);
>
> /* control inside of the vout thread */
> -int vout_control_Pop(vout_control_t *, vout_control_cmd_t *, mtime_t
> deadline, mtime_t timeout);
> +int vout_control_Pop(vout_control_t *, vout_control_cmd_t *, mtime_t
> deadline);
> void vout_control_Dead(vout_control_t *);
>
> #endif
> diff --git a/src/video_output/video_output.c
> b/src/video_output/video_output.c
> index 40701b7..43ff7ad 100644
> --- a/src/video_output/video_output.c
> +++ b/src/video_output/video_output.c
> @@ -1558,16 +1558,23 @@ static void *Thread(void *object)
> };
>
> mtime_t deadline = VLC_TS_INVALID;
> + bool wait = false;
> for (;;) {
> vout_control_cmd_t cmd;
> - /* FIXME remove thoses ugly timeouts */
> - while (!vout_control_Pop(&sys->control, &cmd, deadline, 100000))
> +
> + if (wait)
> + {
> + const mtime_t max_deadline = mdate() + 100000;
> + deadline = deadline <= VLC_TS_INVALID ? max_deadline :
> __MIN(deadline, max_deadline);
> + } else {
> + deadline = VLC_TS_INVALID;
> + }
> + while (!vout_control_Pop(&sys->control, &cmd, deadline))
> if (ThreadControl(vout, cmd))
> return NULL;
>
> deadline = VLC_TS_INVALID;
> - while (!ThreadDisplayPicture(vout, &deadline))
> - ;
> + wait = ThreadDisplayPicture(vout, &deadline) != VLC_SUCCESS;
>
> const bool picture_interlaced = sys->displayed.is_interlaced;
>
> --
> 2.1.3
>
More information about the vlc-devel
mailing list