]> git.sesse.net Git - nageru/commitdiff
Set realtime priority for the DeckLink thread if possible, to reduce jitter.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 24 Jun 2017 19:48:32 +0000 (21:48 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 24 Jun 2017 19:48:32 +0000 (21:48 +0200)
decklink_capture.cpp

index 4db60120f3040a0325325959c7edd5a0463cc5a8..6dba068fca51108fcbfc3a55050efcc1223880ee 100644 (file)
@@ -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(&param, 0, sizeof(param));
+               param.sched_priority = 1;
+               if (sched_setscheduler(0, SCHED_RR, &param) == -1) {
+                       printf("couldn't set realtime priority for DeckLink thread: %s\n", strerror(errno));
+               }
+
                if (has_dequeue_callbacks) {
                        dequeue_init_callback();
                }