[vlc-devel] [PATCH v3 8/8] RFC video_output:control: move the is_held wait in control_Pop
Steve Lhomme
robux4 at ycbcr.xyz
Fri Dec 18 07:57:45 UTC 2020
On 2020-12-18 7:42, Steve Lhomme wrote:
> The only way is_held can become true is when control_Hold passed. And for
> control_Hold to pass, is_waiting has to become true. This only way this can
> happen is during the wait with a deadline. So we can narrow the is_held wait
> to that part of the code.
>
> As correct as it may be, this shows that when there is no deadline (frame by
> frame mode, no displayed.current yet on start/after a flush, render delayed)
Correction: when displayed.current is NULL it causes a VLC_EGENERIC when
rendering which means we have to wait. In that case we wait about 100 ms
or until a given deadline (but there is none in this case).
The only case with no deadline is when ThreadDisplayPicture returns
VLC_SUCCESS. That's when it waited until the displayed.current deadline
to render the picture, in non frame-by-frame.
In that case the loop is not very intensive as there is a wait on the
picture deadline.
> the control_Pop is non blocking and can cause the vout thread to loop a lot.
> ---
> src/video_output/control.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/src/video_output/control.c b/src/video_output/control.c
> index c5b14887ecb..422e3f6f101 100644
> --- a/src/video_output/control.c
> +++ b/src/video_output/control.c
> @@ -94,12 +94,12 @@ int vout_control_Pop(vout_control_t *ctrl, vlc_mouse_t *mouse, vlc_tick_t deadli
> vlc_cond_signal(&ctrl->wait_available);
> vlc_cond_timedwait(&ctrl->wait_request, &ctrl->lock, deadline);
> ctrl->is_waiting = false;
> +
> + while (ctrl->is_held)
> + vlc_cond_wait(&ctrl->wait_available, &ctrl->lock);
> }
> }
>
> - while (ctrl->is_held)
> - vlc_cond_wait(&ctrl->wait_available, &ctrl->lock);
> -
> if (ctrl->cmd.i_size > 0) {
> has_cmd = true;
> *mouse = ARRAY_VAL(ctrl->cmd, 0);
> --
> 2.29.2
>
> _______________________________________________
> 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