<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body><div><br></div>
<div><br></div>
<div><br></div>
<div>On Sat, Jul 1, 2017, at 17:46, Rémi Denis-Courmont wrote:<br></div>
<blockquote type="cite"><div defang_data-gmailquote="yes"><div>Le 1 juillet 2017 17:44:30 GMT+02:00, Thomas Guillem <thomas@gllm.fr> a écrit :<br></div>
<blockquote defang_data-gmailquote="yes" style="margin-top:0pt;margin-right:0pt;margin-bottom:0pt;margin-left:0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204, 204, 204);padding-left:1ex;"><div><br></div>
<div><br></div>
<div><br></div>
<div>On Sat, Jul 1, 2017, at 17:33, Rémi Denis-Courmont wrote:<br></div>
<blockquote type="cite"><div><div>Le 1 juillet 2017 16:54:42 GMT+02:00, Thomas Guillem <thomas@gllm.fr> a écrit :<br></div>
<blockquote style="margin-top:0pt;margin-right:0pt;margin-bottom:0pt;margin-left:0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204, 204, 204);padding-left:1ex;"><pre><div>---<br></div>
<div>
<br></div>
<div> src/input/decoder.c | 20 ++++++++++++++++++++<br></div>
<div>
<br></div>
<div> 1 file changed, 20 insertions(+)<br></div>
<div>
<br></div>
<div><br></div>
<div>
<br></div>
<div>diff --git a/src/input/decoder.c b/src/input/decoder.c<br></div>
<div>
<br></div>
<div>index dac313737a..23e5a7356b 100644<br></div>
<div>
<br></div>
<div>--- a/src/input/decoder.c<br></div>
<div>
<br></div>
<div>+++ b/src/input/decoder.c<br></div>
<div>
<br></div>
<div>@@ -54,6 +54,11 @@<br></div>
<div>
<br></div>
<div> <br></div>
<div>
<br></div>
<div> #include "../video_output/vout_control.h"<br></div>
<div>
<br></div>
<div> <br></div>
<div>
<br></div>
<div>+/* Number of vout request failures after we slow down vout requests */<br></div>
<div>
<br></div>
<div>+#define VOUT_MAX_FAILURE 10<br></div>
<div>
<br></div>
<div>+/* Delay between each failing vout requests */<br></div>
<div>
<br></div>
<div>+#define VOUT_RETRY_DELAY 1000000UL<br></div>
<div>
<br></div>
<div>+<br></div>
<div>
<br></div>
<div> /*<br></div>
<div>
<br></div>
<div> * Possibles values set in p_owner->reload atomic<br></div>
<div>
<br></div>
<div> */<br></div>
<div>
<br></div>
<div>@@ -108,6 +113,8 @@ struct decoder_owner_sys_t<br></div>
<div>
<br></div>
<div> audio_output_t *p_aout;<br></div>
<div>
<br></div>
<div> <br></div>
<div>
<br></div>
<div> vout_thread_t *p_vout;<br></div>
<div>
<br></div>
<div>+ unsigned vout_nb_failures;<br></div>
<div>
<br></div>
<div>+ mtime_t vout_last_failure;<br></div>
<div>
<br></div>
<div> <br></div>
<div>
<br></div>
<div> /* -- Theses variables need locking on read *and* write -- */<br></div>
<div>
<br></div>
<div> /* Preroll */<br></div>
<div>
<br></div>
<div>@@ -408,6 +415,13 @@ static int vout_update_format( decoder_t *p_dec )<br></div>
<div>
<br></div>
<div> {<br></div>
<div>
<br></div>
<div> decoder_owner_sys_t *p_owner = p_dec->p_owner;<br></div>
<div>
<br></div>
<div> <br></div>
<div>
<br></div>
<div>+ /* Avoid to spam vout requests if no vout is capable of handling the<br></div>
<div>
<br></div>
<div>+ * current format. We should still request vouts from time to time since a<br></div>
<div>
<br></div>
<div>+ * vout can become available in between. */<br></div>
<div>
<br></div>
<div>+ if( p_owner->vout_nb_failures > VOUT_MAX_FAILURE<br></div>
<div>
<br></div>
<div>+ && mdate() - p_owner->vout_last_failure < VOUT_RETRY_DELAY )<br></div>
<div>
<br></div>
<div>+ return -1;<br></div>
<div>
<br></div>
<div>+<br></div>
<div>
<br></div>
<div> if( p_owner->p_vout == NULL<br></div>
<div>
<br></div>
<div> || p_dec->fmt_<a href="http://out.video">out.video</a>.i_width != p_owner-><a href="http://fmt.video">fmt.video</a>.i_width<br></div>
<div>
<br></div>
<div> || p_dec->fmt_<a href="http://out.video">out.video</a>.i_height != p_owner-><a href="http://fmt.video">fmt.video</a>.i_height<br></div>
<div>
<br></div>
<div>@@ -530,8 +544,12 @@ static int vout_update_format( decoder_t *p_dec )<br></div>
<div>
<br></div>
<div> if( p_vout == NULL )<br></div>
<div>
<br></div>
<div> {<br></div>
<div>
<br></div>
<div> msg_Err( p_dec, "failed to create video output" );<br></div>
<div>
<br></div>
<div>+ p_owner->vout_nb_failures++;<br></div>
<div>
<br></div>
<div>+ p_owner->vout_last_failure = mdate();<br></div>
<div>
<br></div>
<div> return -1;<br></div>
<div>
<br></div>
<div> }<br></div>
<div>
<br></div>
<div>+ p_owner->vout_nb_failures = 0;<br></div>
<div>
<br></div>
<div>+ p_owner->vout_last_failure = 0;<br></div>
<div>
<br></div>
<div> }<br></div>
<div>
<br></div>
<div> <br></div>
<div>
<br></div>
<div> if ( memcmp( &p_dec->fmt_<a href="http://out.video">out.video</a>.mastering,<br></div>
<div>
<br></div>
<div>@@ -1662,6 +1680,8 @@ static decoder_t * CreateDecoder( vlc_object_t *p_parent,<br></div>
<div>
<br></div>
<div> p_owner->p_resource = p_resource;<br></div>
<div>
<br></div>
<div> p_owner->p_aout = NULL;<br></div>
<div>
<br></div>
<div> p_owner->p_vout = NULL;<br></div>
<div>
<br></div>
<div>+ p_owner->vout_nb_failures = 0;<br></div>
<div>
<br></div>
<div>+ p_owner->vout_last_failure = 0;<br></div>
<div>
<br></div>
<div> p_owner->p_spu_vout = NULL;<br></div>
<div>
<br></div>
<div> p_owner->i_spu_channel = 0;<br></div>
<div>
<br></div>
<div> p_owner->i_spu_order = 0;<br></div>
<div>
<br></div>
</pre></blockquote></div>
<div><br></div>
<div>AFAICT, retrying does not make sense. Just fail immediately if the format is the same as before. It cannot be assumed that the decoder will actually keep retrying with the same format (even now, that is not always true).<br></div>
</blockquote><div><br></div>
<div>Fail immediately ? I was in favor of that solution but someone (maybe you ?) told me that we should always retry because we can't know the reason of the failure. This could be because of low memory, a driver/display not available that can became available just after few seconds.<br></div>
<div><br></div>
<div>Even with that in mind, I prefer to fail immediately than doing this delay hack.<br></div>
<div><br></div>
<blockquote type="cite"><div><br></div>
<div>With that said, you can't expect this to really prevent spam. The decoder could just as well iterate multiple failing formats again and again. So I'd say this patch is kinda useless.<br></div>
<div>-- <br></div>
<div>Rémi Denis-Courmont<br></div>
<div>Typed on an inconvenient virtual keyboard <br></div>
<div><u>_______________________________________________</u><br></div>
<div>vlc-devel mailing list<br></div>
<div>To unsubscribe or modify your subscription options:<br></div>
<div><a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a><br></div>
</blockquote><div><br></div>
</blockquote></div>
<div><br></div>
<div>We cannot really assume anything at that level either way. This would be second-guessing the decoder and the video outputs.<br></div>
<div> <br></div>
<div> You could rate limit the error message though.<br></div>
</blockquote><div><br></div>
<div>The main problem is the window creation/deletion glitch, not the error message.<br></div>
<div><br></div>
<div>You can easily reproduce it with ./vlc --vout sdl for example. (keep in mind that this problem can happen without forcing any vout).<br></div>
<div><br></div>
<blockquote type="cite"><div> -- <br></div>
<div> Rémi Denis-Courmont<br></div>
<div> Typed on an inconvenient virtual keyboard <br></div>
<div><u>_______________________________________________</u><br></div>
<div>vlc-devel mailing list<br></div>
<div>To unsubscribe or modify your subscription options:<br></div>
<div><a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a><br></div>
</blockquote><div><br></div>
</body>
</html>