From a0ca98e193fb24a283d3b213f4bc811ce2995209 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mustafa=20G=C3=B6k=C3=A7e?= <48911620+mustafa-gokce@users.noreply.github.com> Date: Wed, 16 Oct 2024 16:42:27 +0300 Subject: [PATCH 1/2] reception_flow.cc: Fix MinGW compilation on Windows --- src/reception_flow.cc | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/reception_flow.cc b/src/reception_flow.cc index fb9bae10..0d7bd48b 100644 --- a/src/reception_flow.cc +++ b/src/reception_flow.cc @@ -150,8 +150,17 @@ rtp_error_t uvgrtp::reception_flow::start(std::shared_ptr socket pthread_setschedparam(processor_->native_handle(), SCHED_FIFO, ¶ms); #else - SetThreadPriority(receiver_->native_handle(), REALTIME_PRIORITY_CLASS); - SetThreadPriority(processor_->native_handle(), ABOVE_NORMAL_PRIORITY_CLASS); + HANDLE hReceiverThread = OpenThread(THREAD_SET_INFORMATION, FALSE, receiver_->native_handle()); + if (hReceiverThread) { + SetThreadPriority(hReceiverThread, THREAD_PRIORITY_TIME_CRITICAL); + CloseHandle(hReceiverThread); + } + + HANDLE hProcessorThread = OpenThread(THREAD_SET_INFORMATION, FALSE, processor_->native_handle()); + if (hProcessorThread) { + SetThreadPriority(hProcessorThread, THREAD_PRIORITY_ABOVE_NORMAL); + CloseHandle(hProcessorThread); + } #endif active_ = true; @@ -741,4 +750,4 @@ rtp_error_t uvgrtp::reception_flow::update_remote_ssrc(uint32_t old_remote_ssrc, hooks_.insert({new_remote_ssrc, hook}); } return RTP_OK; -} \ No newline at end of file +} From 919204c1f814a0e44ccc5a3130e86a698546bbdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joni=20R=C3=A4s=C3=A4nen?= Date: Thu, 14 Nov 2024 15:30:37 +0200 Subject: [PATCH 2/2] common: Fix msvc compilation --- src/reception_flow.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/reception_flow.cc b/src/reception_flow.cc index 0d7bd48b..dc5314d9 100644 --- a/src/reception_flow.cc +++ b/src/reception_flow.cc @@ -148,6 +148,9 @@ rtp_error_t uvgrtp::reception_flow::start(std::shared_ptr socket pthread_setschedparam(receiver_->native_handle(), SCHED_FIFO, ¶ms); params.sched_priority = sched_get_priority_max(SCHED_FIFO) - 1; pthread_setschedparam(processor_->native_handle(), SCHED_FIFO, ¶ms); +#elif defined(_MSC_VER) + SetThreadPriority(receiver_->native_handle(), REALTIME_PRIORITY_CLASS); + SetThreadPriority(processor_->native_handle(), ABOVE_NORMAL_PRIORITY_CLASS); #else HANDLE hReceiverThread = OpenThread(THREAD_SET_INFORMATION, FALSE, receiver_->native_handle());