<!DOCTYPE html><html><head><title></title><style type="text/css">p.MsoNormal,p.MsoNoSpacing{margin:0}</style></head><body><div><br></div><div><br></div><div>On Wed, Feb 26, 2020, at 15:34, Quentin Chateau wrote:<br></div><blockquote type="cite" id="qt"><p>Thanks for the hindsight, I dug further:<br></p><p>vlc_cond_timedwait is called, and so is pthread_cond_timedwait.
      The issue happens when the deadline parameter is in the past: when
      this happens, pthread_cond_timedwait does not act as a
      cancellation point anymore...<br></p><p>In my case deadline happens to be in the past because
      ThreadDisplayPicture keeps failing (due to one of my video filters
      failing on the last frame)<br></p><p>I could not find this behavior in the pthread documentation, but
      it seems to be the case anyway. Do you think that we need to:<br></p><ol><li>Fix vlc_cond_timedwait so it will check for cancellation if
        the deadline is in the past<br></li><li>Acknowledge the fact that vlc_cond_timedwait is not always a
        cancellation point and fix the issue higher in the stack, either
        in vout_control_Pop, or similarly to the patch I sent, directly
        in Thread<br></li></ol></blockquote><div><br></div><div>Or 3. Investigate why deadline is in the past.<br></div><div><br></div><div>RĂ©mi, any preference ?<br></div><div><br></div><blockquote type="cite" id="qt"><p><br></p><div class="qt-moz-cite-prefix">On 26/02/2020 11:11, Thomas Guillem
      wrote:<br></div><blockquote cite="mid:2d816109-1f97-4b3e-8ffa-4b02394ca0e7@www.fastmail.com" type="cite"><pre class="qt-moz-quote-pre" wrap="">Why is it not canceled from vlc_cond_timedwait() called from vout_control_Pop() ?

Is ctrl->can_sleep false in your case ?

Anyway, I would prefer a fix in vout_control_Pop() like this:

    if (ctrl->cmd.i_size <= 0 && deadline != VLC_TICK_INVALID && ctrl->can_sleep) {
        /* Spurious wakeups are perfectly fine */
        ctrl->is_waiting = true;
        vlc_cond_signal(&ctrl->wait_available);
        vlc_cond_timedwait(&ctrl->wait_request, &ctrl->lock, deadline);
        ctrl->is_waiting = false;
    }
    else
        vlc_testcancel();

On Tue, Feb 25, 2020, at 12:47, <a href="mailto:quentin.chateau@deepskycorp.com" class="qt-moz-txt-link-abbreviated">quentin.chateau@deepskycorp.com</a> wrote:
<br></pre><blockquote type="cite"><pre class="qt-moz-quote-pre" wrap="">From: Quentin Chateau <a href="mailto:quentin.chateau@deepskycorp.com" class="qt-moz-txt-link-rfc2396E"><quentin.chateau@deepskycorp.com></a>

When ThreadDisplayPicture does not return VLC_SUCCESS,
explicitely check for thread cancellation.

There are cases where a video filter can fail
systematically without hitting any cancellation point
after the video output thread is cancelled, resulting
in an infinite loop if there is no explicit check.
---
 src/video_output/video_output.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 229b010a96..f7aac554e4 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1703,6 +1703,7 @@ noreturn static void *Thread(void *object)
 
         if (wait)
         {
+            vlc_testcancel();
             const vlc_tick_t max_deadline = vlc_tick_now() + 
VLC_TICK_FROM_MS(100);
             deadline = deadline == VLC_TICK_INVALID ? max_deadline : 
__MIN(deadline, max_deadline);
         } else {
-- 
2.17.1

_______________________________________________
vlc-devel mailing list
To unsubscribe or modify your subscription options:
<a href="https://mailman.videolan.org/listinfo/vlc-devel" class="qt-moz-txt-link-freetext">https://mailman.videolan.org/listinfo/vlc-devel</a>
<br></pre></blockquote><pre class="qt-moz-quote-pre" wrap="">_______________________________________________
vlc-devel mailing list
To unsubscribe or modify your subscription options:
<a href="https://mailman.videolan.org/listinfo/vlc-devel" class="qt-moz-txt-link-freetext">https://mailman.videolan.org/listinfo/vlc-devel</a><br></pre></blockquote><div>_______________________________________________<br></div><div>vlc-devel mailing list<br></div><div>To unsubscribe or modify your subscription options:<br></div><div>https://mailman.videolan.org/listinfo/vlc-devel<br></div></blockquote><div><br></div></body></html>