From 34fbabc2fdf50445a737ede429704d49b5341b12 Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Wed, 1 Feb 2017 16:55:56 +0000 Subject: [PATCH] Fix hang skipping after pause (thread deadlock / videoomx thread cancellation protection) --- videoomx.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/videoomx.cc b/videoomx.cc index bb16ffe..b96b830 100644 --- a/videoomx.cc +++ b/videoomx.cc @@ -2819,10 +2819,19 @@ bool VideoOMX::DrainTargetBufferFull() if (full && omx_vid_stalled && !omx_first_frame) { omx_vid_stalled=false; Log::getInstance()->log("Video", Log::DEBUG, "Decoder is stalled, do a reset!"); + + int oldcancelstate; + int oldcanceltype; + pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &oldcancelstate); + pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, &oldcanceltype); + clock_mutex.Lock(); FlushRenderingPipe(); omx_first_frame=true; clock_mutex.Unlock(); + + pthread_setcancelstate(oldcancelstate, NULL); + pthread_setcanceltype(oldcanceltype, NULL); } return full; -- 2.39.2