Compare commits

...

2 Commits
0.5 ... master

Author SHA1 Message Date
Mark Hills 0c5ab0dfc1 Do not use the ambiguous sched_setscheduler()
POSIX specifies this is per-process, and GNU implemented it on the
thread. Musl realises the problem with this and so doesn't implement
it at all, forcing this more specific alternative to be used.
2023-05-12 16:31:03 +01:00
Mark Hills 5c844e6996 Use the default logging level
This is a #define to bctoolbox which means we have to link ourselves
to that library. Whereas oRTP defines its own link. It turns out the
default logging level is appropriate, so use that.

This also removes one of the compatibility problems caused by
different versions of oRTP which had different definitions of this
function.
2020-11-28 11:03:34 +00:00
2 changed files with 8 additions and 10 deletions

17
sched.c
View File

@ -17,6 +17,8 @@
* *
*/ */
#include <errno.h>
#include <pthread.h>
#include <sched.h> #include <sched.h>
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
@ -28,23 +30,20 @@
int go_realtime(void) int go_realtime(void)
{ {
int max_pri; int max_pri;
struct sched_param sp; const struct sched_param sp = {
.sched_priority = REALTIME_PRIORITY,
if (sched_getparam(0, &sp)) { };
perror("sched_getparam");
return -1;
}
max_pri = sched_get_priority_max(SCHED_FIFO); max_pri = sched_get_priority_max(SCHED_FIFO);
sp.sched_priority = REALTIME_PRIORITY;
if (sp.sched_priority > max_pri) { if (sp.sched_priority > max_pri) {
fprintf(stderr, "Invalid priority (maximum %d)\n", max_pri); fprintf(stderr, "Invalid priority (maximum %d)\n", max_pri);
return -1; return -1;
} }
if (sched_setscheduler(0, SCHED_FIFO, &sp)) { errno = pthread_setschedparam(pthread_self(), SCHED_FIFO, &sp);
perror("sched_setscheduler"); if (errno) {
perror("pthread_setschedparam");
return -1; return -1;
} }

1
tx.c
View File

@ -245,7 +245,6 @@ int main(int argc, char *argv[])
ortp_init(); ortp_init();
ortp_scheduler_init(); ortp_scheduler_init();
ortp_set_log_level_mask(NULL, ORTP_WARNING|ORTP_ERROR);
session = create_rtp_send(addr, port); session = create_rtp_send(addr, port);
assert(session != NULL); assert(session != NULL);