]> git.vomp.tv Git - vompclient.git/commitdiff
Fix hang skipping after pause (thread deadlock / videoomx thread cancellation protection)
authorChris Tallon <chris@vomp.tv>
Wed, 1 Feb 2017 16:55:56 +0000 (16:55 +0000)
committerChris Tallon <chris@vomp.tv>
Wed, 1 Feb 2017 16:55:56 +0000 (16:55 +0000)
videoomx.cc

index bb16ffef60a854654a9d53df7e799712888b260f..b96b83033e9196c67f3c109a17c011fae27f861d 100644 (file)
@@ -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;