[vlc-commits] splitter: lock display while in use (refs #21604)
Rémi Denis-Courmont
git at videolan.org
Sat Jan 12 15:46:45 CET 2019
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Jan 12 16:44:23 2019 +0200| [3f8852823e4f5b22e274b6c051cf79b881ec0d30] | committer: Rémi Denis-Courmont
splitter: lock display while in use (refs #21604)
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3f8852823e4f5b22e274b6c051cf79b881ec0d30
---
modules/video_output/splitter.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/modules/video_output/splitter.c b/modules/video_output/splitter.c
index 00ccadb6b6..59dc248ecd 100644
--- a/modules/video_output/splitter.c
+++ b/modules/video_output/splitter.c
@@ -63,6 +63,7 @@ static void vlc_vidsplit_Prepare(vout_display_t *vd, picture_t *pic,
for (int i = 0; i < sys->splitter.i_output; i++) {
struct vlc_vidsplit_part *part = &sys->parts[i];
+ vlc_sem_wait(&part->lock);
sys->pictures[i] = vout_display_Prepare(part->display,
sys->pictures[i], NULL, date);
}
@@ -77,6 +78,7 @@ static void vlc_vidsplit_Display(vout_display_t *vd, picture_t *picture)
if (sys->pictures[i] != NULL)
vout_display_Display(part->display, sys->pictures[i]);
+ vlc_sem_post(&part->lock);
}
(void) picture;
@@ -211,8 +213,10 @@ static int vlc_vidsplit_Open(vout_display_t *vd,
};
const char *modname = output->psz_module;
struct vlc_vidsplit_part *part = &sys->parts[i];
+ vout_display_t *display;
vlc_sem_init(&part->lock, 1);
+ part->display = NULL;
vdcfg.window = video_splitter_CreateWindow(obj, &vdcfg, &output->fmt);
if (vdcfg.window == NULL) {
@@ -221,9 +225,9 @@ static int vlc_vidsplit_Open(vout_display_t *vd,
return VLC_EGENERIC;
}
- part->display = vlc_vidsplit_CreateDisplay(obj, &output->fmt, &vdcfg,
- modname);
- if (part->display == NULL) {
+ display = vlc_vidsplit_CreateDisplay(obj, &output->fmt, &vdcfg,
+ modname);
+ if (display == NULL) {
vout_window_Disable(vdcfg.window);
vout_window_Delete(vdcfg.window);
vlc_sem_destroy(&part->lock);
@@ -231,6 +235,10 @@ static int vlc_vidsplit_Open(vout_display_t *vd,
vlc_vidsplit_Close(vd);
return VLC_EGENERIC;
}
+
+ vlc_sem_wait(&part->lock);
+ part->display = display;
+ vlc_sem_post(&part->lock);
}
vd->prepare = vlc_vidsplit_Prepare;
More information about the vlc-commits
mailing list