<html><head></head><body>A function that does not take necessary locks is Unlocked, e.g. fputc vs fputc_unlocked. The names in this patch are misleading.<br><br><div class="gmail_quote">Le 13 janvier 2020 13:07:31 GMT+02:00, Steve Lhomme <robux4@ycbcr.xyz> a écrit :<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre class="k9mail"><hr> src/video_output/video_output.c | 15 +++++++++------<br> 1 file changed, 9 insertions(+), 6 deletions(-)<br><br>diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c<br>index 659ede546ba..53c6416a620 100644<br>--- a/src/video_output/video_output.c<br>+++ b/src/video_output/video_output.c<br>@@ -1998,7 +1998,7 @@ int vout_ChangeSource( vout_thread_t *vout, const video_format_t *original )<br> return -1;<br> }<br> <br>-static int vout_EnableWindow(vout_thread_t *vout, const video_format_t *original,<br>+static int EnableWindowLocked(vout_thread_t *vout, const video_format_t *original,<br> vlc_decoder_device **pp_dec_device)<br> {<br> vout_thread_sys_t *sys = vout->p;<br>@@ -2006,7 +2006,6 @@ static int vout_EnableWindow(vout_thread_t *vout, const video_format_t *original<br> assert(!sys->dummy);<br> assert(vout != NULL);<br> <br>- vlc_mutex_lock(&sys->window_lock);<br> if (!sys->window_enabled) {<br> vout_window_cfg_t wcfg = {<br> .is_fullscreen = var_GetBool(vout, "fullscreen"),<br>@@ -2022,7 +2021,6 @@ static int vout_EnableWindow(vout_thread_t *vout, const video_format_t *original<br> vout_SizeWindow(vout, original, &wcfg.width, &wcfg.height);<br> <br> if (vout_window_Enable(sys->display_cfg.window, &wcfg)) {<br>- vlc_mutex_unlock(&sys->window_lock);<br> msg_Err(vout, "failed to enable window");<br> return -1;<br> }<br>@@ -2036,7 +2034,6 @@ static int vout_EnableWindow(vout_thread_t *vout, const video_format_t *original<br> sys->dec_device = vlc_decoder_device_Create(&vout->obj, sys->display_cfg.window);<br> *pp_dec_device = sys->dec_device ? vlc_decoder_device_Hold( sys->dec_device ) : NULL;<br> }<br>- vlc_mutex_unlock(&sys->window_lock);<br> return 0;<br> }<br> <br>@@ -2061,13 +2058,16 @@ int vout_Request(const vout_configuration_t *cfg, vlc_video_context *vctx, input<br> return 0;<br> }<br> <br>- if (vout_EnableWindow(vout, &original, NULL) != 0)<br>+ vlc_mutex_lock(&sys->window_lock);<br>+ if (EnableWindowLocked(vout, &original, NULL) != 0)<br> {<br> /* the window was not enabled, nor the display started */<br> msg_Err(vout, "failed to enable window");<br> video_format_Clean(&original);<br>+ vlc_mutex_unlock(&sys->window_lock);<br> return -1;<br> }<br>+ vlc_mutex_unlock(&sys->window_lock);<br> <br> if (sys->display != NULL)<br> vout_StopDisplay(vout);<br>@@ -2105,6 +2105,7 @@ vlc_decoder_device *vout_GetDevice(const vout_device_configuration_t *cfg)<br> vlc_decoder_device *dec_device = NULL;<br> <br> assert(cfg->fmt != NULL);<br>+ vout_thread_sys_t *sys = cfg->vout->p;<br> <br> if (!VoutCheckFormat(cfg->fmt))<br> return NULL;<br>@@ -2112,7 +2113,9 @@ vlc_decoder_device *vout_GetDevice(const vout_device_configuration_t *cfg)<br> video_format_t original;<br> VoutFixFormat(&original, cfg->fmt);<br> <br>- int res = vout_EnableWindow(cfg->vout, &original, &dec_device);<br>+ vlc_mutex_lock(&sys->window_lock);<br>+ int res = EnableWindowLocked(cfg->vout, &original, &dec_device);<br>+ vlc_mutex_unlock(&sys->window_lock);<br> video_format_Clean(&original);<br> if (res != 0)<br> return NULL;</pre></blockquote></div><br>-- <br>Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.</body></html>