<html><head></head><body>Hi,<br><br>Badly designed or implemented plugins are what they are. Just as big loops in the UI thread are bad for interactivity, big loops in the render thread are bad for timeliness. And besides those egregiously broken plugins you have, e.g., rotate and transform who actually translate the mouse event, and should obviously run synchronously - not at the next render.<br><br><div class="gmail_quote">Le 20 août 2020 10:02:30 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">On 2020-08-19 17:27, Alexandre Janniaux wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;">Hi,<br><br>On Wed, Aug 19, 2020 at 04:58:56PM +0200, Rémi Denis-Courmont wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #ad7fa8; padding-left: 1ex;"> Hi,<br><br> I don't know where this assertion that mouse events should be processed in a different thread comes from. It sounds saner to me to process them in the UI loop (like UIs typically do) than in the render thread.<br></blockquote></blockquote><br>This is what I went with first. I agree that's the logical thing to do.<br><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;">I agree, that is what is done in almost all interface using<br>LibVLC without the mouse handling too (VLC for Android, VLC<br>for iOS, etc).<br><br>It's the filter / other mouse event client responsability to<br>manage the events correctly to not have race when making the<br>final output, and in the very worse case make the UI wait for<br>the event completion instead of letting it spam more event<br>than can be handled, though blocking the UI thread is probably<br>a mistake in most cases.<br></blockquote><br>Except that's a totally new requirement on filters. All of the filters <br>handling mouse events have to be refactored to be thread safe. The mouse <br>events were always done in the same thread that does the filtering.<br><br>Still, I looked at the implementations because they probably don't do a <br>lot with the mouse. I found 2 filters that do big loops on pixels when <br>processing the mouse:<br><br><a href="https://code.videolan.org/videolan/vlc/-/blob/master/modules/video_filter/freeze.c#L248">https://code.videolan.org/videolan/vlc/-/blob/master/modules/video_filter/freeze.c#L248</a><br><a href="https://code.videolan.org/videolan/vlc/-/blob/master/modules/video_filter/puzzle.c#L702">https://code.videolan.org/videolan/vlc/-/blob/master/modules/video_filter/puzzle.c#L702</a><br><br>IMO these loops, that were never done in the UI thread, should not be <br>done in the UI thread.<br><br>>><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;"><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #ad7fa8; padding-left: 1ex;">Le 18 août 2020 16:58:27 GMT+02:00, Steve Lhomme <robux4@ycbcr.xyz> a écrit :<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #8ae234; padding-left: 1ex;"> The filter commands can be replaced with states of the latest filter<br> request.<br><br> The mouse events still need to be processed in sequence and most likely<br> outside<br> of the UI thread where they are generated. They are handled in a<br> similar way<br> as it was done in the control API but with tighter integration with the<br> vout<br> state.<br><br> The terminate command can be internally with a boolean and trigger the<br> wait<br> condition on mouse events.<br><br> The mouse event callback of filters is also simplified for more<br> readability.<br><br> Steve Lhomme (18):<br> filters: initialize the output mouse state to the new state<br> filters: remove the duplicate new mouse state<br> video_output: only reset the mouse_event if it was set on display<br> release<br> video_output: don't include control.h in include shared across the<br> core<br> video_output: use filter lock to change filters in the vout thread<br> video_output: use filter lock to change deinterlacing in the vout<br> thread<br> video_output: remove always true boolean from ThreadChangeFilters<br> video_output: rework the deadline parameter return<br> video_output: use the rendering delay when we were given a deadline to<br> wait for<br> video_output: use INT64_MAX for the invalid control pop deadline<br> vout/control: keep the lock instead of setting a held flag<br> vout/control: move the lock outside of the control API<br> vout/control: move the condition on pictures/control outside of the<br> control API<br> video_output: use an internal bool to detect when we must exit the<br> vout thread<br> video_output: move the mouse events handling outside of the control<br> pop<br> video_output: do not wait for new mouse commands if we have a picture<br> ready<br> video_output: remove unused control API<br> video_output: code cleaning<br><br> include/vlc_filter.h | 3 +-<br> modules/spu/logo.c | 7 +-<br> modules/video_chroma/chain.c | 5 +-<br> modules/video_filter/ci_filters.m | 6 +-<br> .../video_filter/deinterlace/deinterlace.c | 6 +-<br> modules/video_filter/freeze.c | 7 +-<br> modules/video_filter/magnify.c | 9 +-<br> modules/video_filter/puzzle.c | 8 +-<br> modules/video_filter/puzzle.h | 3 +-<br> modules/video_filter/transform.c | 3 +-<br> src/Makefile.am | 2 -<br> src/misc/filter_chain.c | 4 +-<br> src/video_output/control.c | 174 -------------<br> src/video_output/control.h | 82 ------<br> src/video_output/video_output.c | 233 +++++++++++-------<br> src/video_output/vout_internal.h | 1 -<br> 16 files changed, 171 insertions(+), 382 deletions(-)<br> delete mode 100644 src/video_output/control.c<br> delete mode 100644 src/video_output/control.h<br><br> --<br> 2.26.2<hr> vlc-devel mailing list<br> To unsubscribe or modify your subscription options:<br> <a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a><br></blockquote>--<br>Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.<br><hr>vlc-devel mailing list<br>To unsubscribe or modify your subscription options:<br><a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a><br></blockquote><hr>vlc-devel mailing list<br>To unsubscribe or modify your subscription options:<br><a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a><br><br></blockquote><hr>vlc-devel mailing list<br>To unsubscribe or modify your subscription options:<br><a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a></pre></blockquote></div><br>-- <br>Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.</body></html>