various: use mp_sleep_ns

This commit is contained in:
nanahi authored and Kacper Michajłow committed 2025-10-27 20:00:59 +01:00
1 parent 8410f3157d
commit 8ac52fd1ab
2 files changed
+8 -7

No files matched your search

+2 -1
View File
@@ -39,6 +39,7 @@
#include "options/m_option.h"
#include "common/msg.h"
#include "osdep/endian.h"
#include "osdep/timer.h"
#include <alsa/asoundlib.h>
@@ -972,7 +973,7 @@ static bool recover_and_get_state(struct ao *ao, struct mp_pcm_state *state)
if (err == -EAGAIN) {
// Cargo-cult from decades ago, with a cargo cult timeout.
MP_INFO(ao, "PCM resume EAGAIN - retrying.\n");
sleep(1);
mp_sleep_ns(MP_TIME_S_TO_NS(1));
continue;
}
if (err == -ENOSYS) {
+6 -6
View File
@@ -300,7 +300,7 @@ static int check_status(dvb_priv_t *priv, int fd_frontend, float tmout)
}
}
}
usleep(10000);
mp_sleep_ns(MP_TIME_MS_TO_NS(10));
int tm2 = (int)mp_time_sec();
if ((festatus & FE_TIMEDOUT) || (locks >= 2) || (tm2 - tm1 >= tmout))
ok = true;
@@ -345,17 +345,17 @@ static int diseqc_send_msg(int fd, fe_sec_voltage_t v, struct diseqc_cmd *cmd,
return -1;
if (ioctl(fd, FE_SET_VOLTAGE, v) < 0)
return -1;
usleep(15 * 1000);
mp_sleep_ns(MP_TIME_MS_TO_NS(15));
if (ioctl(fd, FE_DISEQC_SEND_MASTER_CMD, &cmd->cmd) < 0)
return -1;
usleep(cmd->wait * 1000);
usleep(15 * 1000);
mp_sleep_ns(MP_TIME_MS_TO_NS(cmd->wait));
mp_sleep_ns(MP_TIME_MS_TO_NS(15));
if (ioctl(fd, FE_DISEQC_SEND_BURST, b) < 0)
return -1;
usleep(15 * 1000);
mp_sleep_ns(MP_TIME_MS_TO_NS(15));
if (ioctl(fd, FE_SET_TONE, t) < 0)
return -1;
usleep(100000);
mp_sleep_ns(MP_TIME_MS_TO_NS(100));
return 0;
}