0
1
mirror of https://github.com/radio95-rnt/rds95.git synced 2026-02-26 20:33:53 +01:00
This commit is contained in:
2025-12-24 23:37:50 +01:00
parent 1fafaaa473
commit 7750ce6eaf

View File

@@ -33,10 +33,6 @@ static void stop() {
static void *udp_server_worker() { static void *udp_server_worker() {
while (!stop_rds) { while (!stop_rds) {
if(reload_requested) {
reload_requested = 0;
reload_lua();
}
poll_udp_server(); poll_udp_server();
msleep(READ_TIMEOUT_MS); msleep(READ_TIMEOUT_MS);
} }
@@ -172,19 +168,18 @@ int main(int argc, char **argv) {
init_rds_modulator(&rdsModulator, &rdsEncoder, config.num_streams); init_rds_modulator(&rdsModulator, &rdsEncoder, config.num_streams);
init_rds_encoder(&rdsEncoder); init_rds_encoder(&rdsEncoder);
if(config.udp_port) { if(config.udp_port == 0) config.udp_port = 5000;
if(open_udp_server(config.udp_port, &rdsModulator) == 0) { if(open_udp_server(config.udp_port, &rdsModulator) == 0) {
fprintf(stderr, "Reading control commands on UDP:%d.\n", config.udp_port); fprintf(stderr, "Reading control commands on UDP:%d.\n", config.udp_port);
int r = pthread_create(&udp_server_thread, &attr, udp_server_worker, NULL); int r = pthread_create(&udp_server_thread, &attr, udp_server_worker, NULL);
if (r < 0) { if (r < 0) {
fprintf(stderr, "Could not create UDP server thread.\n"); fprintf(stderr, "Could not create UDP server thread.\n");
config.udp_port = 0;
goto exit;
} else fprintf(stderr, "Created UDP server thread.\n");
} else {
fprintf(stderr, "Failed to open UDP server\n");
config.udp_port = 0; config.udp_port = 0;
} goto exit;
} else fprintf(stderr, "Created UDP server thread.\n");
} else {
fprintf(stderr, "Failed to open UDP server\n");
config.udp_port = 0;
} }
int pulse_error; int pulse_error;
@@ -202,6 +197,10 @@ int main(int argc, char **argv) {
fprintf(stderr, "Error: could not play audio. (%s : %d)\n", pa_strerror(pulse_error), pulse_error); fprintf(stderr, "Error: could not play audio. (%s : %d)\n", pa_strerror(pulse_error), pulse_error);
break; break;
} }
if(reload_requested) {
reload_requested = 0;
reload_lua();
}
} }
free(rds_buffer); free(rds_buffer);