Skip to content

Commit

Permalink
Merge pull request #232 from mustafa-gokce/fix-win-mingw
Browse files Browse the repository at this point in the history
reception_flow.cc: Fix MinGW compilation on Windows
  • Loading branch information
jrsnen authored Nov 14, 2024
2 parents 63789b5 + 919204c commit c3781dd
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/reception_flow.cc
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,22 @@ rtp_error_t uvgrtp::reception_flow::start(std::shared_ptr<uvgrtp::socket> socket
pthread_setschedparam(receiver_->native_handle(), SCHED_FIFO, &params);
params.sched_priority = sched_get_priority_max(SCHED_FIFO) - 1;
pthread_setschedparam(processor_->native_handle(), SCHED_FIFO, &params);
#else

#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());
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;
Expand Down Expand Up @@ -741,4 +753,4 @@ rtp_error_t uvgrtp::reception_flow::update_remote_ssrc(uint32_t old_remote_ssrc,
hooks_.insert({new_remote_ssrc, hook});
}
return RTP_OK;
}
}

0 comments on commit c3781dd

Please sign in to comment.