[vlc-devel] [PATCH 2/4] vout: remove flag is_sleeping from vout_control_t
Felix Abecassis
felix.abecassis at gmail.com
Wed Feb 19 12:30:03 CET 2014
Previously, the is_sleeping flag was not set to true if a deadline was
passed to vout_control_Pop. Consequently, the condition variable would
not be signalled by function vout_control_Wake, called by
vout_PutPicture to give a vout a picture to display. Thus, the vout
would not wake up even when receiving several pictures, instead the
vout waits until the end of the deadline. If the deadline was computed
as the "refresh" deadline from ThreadDisplayPicture, the sleep time
can be as high as 60-70 ms.
---
src/video_output/control.c | 6 +-----
src/video_output/control.h | 1 -
2 files changed, 1 insertion(+), 6 deletions(-)
diff --git a/src/video_output/control.c b/src/video_output/control.c
index 73877d5..bc7bda2 100644
--- a/src/video_output/control.c
+++ b/src/video_output/control.c
@@ -62,7 +62,6 @@ void vout_control_Init(vout_control_t *ctrl)
vlc_cond_init(&ctrl->wait_acknowledge);
ctrl->is_dead = false;
- ctrl->is_sleeping = false;
ctrl->can_sleep = true;
ctrl->is_processing = false;
ARRAY_INIT(ctrl->cmd);
@@ -115,8 +114,7 @@ void vout_control_Wake(vout_control_t *ctrl)
{
vlc_mutex_lock(&ctrl->lock);
ctrl->can_sleep = false;
- if (ctrl->is_sleeping)
- vlc_cond_signal(&ctrl->wait_request);
+ vlc_cond_signal(&ctrl->wait_request);
vlc_mutex_unlock(&ctrl->lock);
}
@@ -190,10 +188,8 @@ int vout_control_Pop(vout_control_t *ctrl, vout_control_cmd_t *cmd,
/* Spurious wakeups are perfectly fine */
if (deadline <= VLC_TS_INVALID) {
- ctrl->is_sleeping = true;
if (ctrl->can_sleep)
vlc_cond_timedwait(&ctrl->wait_request, &ctrl->lock, max_deadline);
- ctrl->is_sleeping = false;
} else {
vlc_cond_timedwait(&ctrl->wait_request, &ctrl->lock, __MIN(deadline, max_deadline));
}
diff --git a/src/video_output/control.h b/src/video_output/control.h
index 3d66793..f52a529 100644
--- a/src/video_output/control.h
+++ b/src/video_output/control.h
@@ -107,7 +107,6 @@ typedef struct {
/* */
bool is_dead;
- bool is_sleeping;
bool can_sleep;
bool is_processing;
DECL_ARRAY(vout_control_cmd_t) cmd;
--
1.8.3.2
More information about the vlc-devel
mailing list