From 7c26af1581077cb63dc0bd76942f1f4262312f7f Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Sat, 24 Jun 2017 21:48:32 +0200 Subject: [PATCH] Set realtime priority for the DeckLink thread if possible, to reduce jitter. --- decklink_capture.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/decklink_capture.cpp b/decklink_capture.cpp index 4db6012..6dba068 100644 --- a/decklink_capture.cpp +++ b/decklink_capture.cpp @@ -319,6 +319,14 @@ HRESULT STDMETHODCALLTYPE DeckLinkCapture::VideoInputFrameArrived( char thread_name[16]; snprintf(thread_name, sizeof(thread_name), "DeckLink_C_%d", card_index); pthread_setname_np(pthread_self(), thread_name); + + sched_param param; + memset(¶m, 0, sizeof(param)); + param.sched_priority = 1; + if (sched_setscheduler(0, SCHED_RR, ¶m) == -1) { + printf("couldn't set realtime priority for DeckLink thread: %s\n", strerror(errno)); + } + if (has_dequeue_callbacks) { dequeue_init_callback(); } -- 2.39.2