mirror of https://github.com/mpv-player/mpv
Replace calls to usec_sleep()
This is just dumb sed replacement to mp_sleep_us(). Also remove the now unused usec_sleep() wrapper.
This commit is contained in:
parent
e56d8a200d
commit
f44a242258
|
@ -1019,7 +1019,7 @@ static int AudioStreamChangeFormat( AudioStreamID i_stream_id, AudioStreamBasicD
|
||||||
AudioStreamBasicDescription actual_format;
|
AudioStreamBasicDescription actual_format;
|
||||||
int j;
|
int j;
|
||||||
for (j = 0; !stream_format_changed && j < 50; ++j)
|
for (j = 0; !stream_format_changed && j < 50; ++j)
|
||||||
usec_sleep(10000);
|
mp_sleep_us(10000);
|
||||||
if (stream_format_changed)
|
if (stream_format_changed)
|
||||||
stream_format_changed = 0;
|
stream_format_changed = 0;
|
||||||
else
|
else
|
||||||
|
@ -1143,7 +1143,7 @@ static void uninit(int immed)
|
||||||
if (!immed) {
|
if (!immed) {
|
||||||
long long timeleft=(1000000LL*av_fifo_size(ao->buffer))/ao_data.bps;
|
long long timeleft=(1000000LL*av_fifo_size(ao->buffer))/ao_data.bps;
|
||||||
ao_msg(MSGT_AO,MSGL_DBG2, "%d bytes left @%d bps (%d usec)\n", av_fifo_size(ao->buffer), ao_data.bps, (int)timeleft);
|
ao_msg(MSGT_AO,MSGL_DBG2, "%d bytes left @%d bps (%d usec)\n", av_fifo_size(ao->buffer), ao_data.bps, (int)timeleft);
|
||||||
usec_sleep((int)timeleft);
|
mp_sleep_us((int)timeleft);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ao->b_digital) {
|
if (!ao->b_digital) {
|
||||||
|
|
|
@ -531,7 +531,7 @@ static void audio_resume(void)
|
||||||
static void uninit(int immed)
|
static void uninit(int immed)
|
||||||
{
|
{
|
||||||
if (!immed)
|
if (!immed)
|
||||||
usec_sleep(get_delay() * 1000000);
|
mp_sleep_us(get_delay() * 1000000);
|
||||||
reset();
|
reset();
|
||||||
|
|
||||||
DestroyBuffer();
|
DestroyBuffer();
|
||||||
|
|
|
@ -311,10 +311,10 @@ err_out:
|
||||||
// close audio device
|
// close audio device
|
||||||
static void uninit(int immed) {
|
static void uninit(int immed) {
|
||||||
if (!immed)
|
if (!immed)
|
||||||
usec_sleep(get_delay() * 1000 * 1000);
|
mp_sleep_us(get_delay() * 1000 * 1000);
|
||||||
// HACK, make sure jack doesn't loop-output dirty buffers
|
// HACK, make sure jack doesn't loop-output dirty buffers
|
||||||
reset();
|
reset();
|
||||||
usec_sleep(100 * 1000);
|
mp_sleep_us(100 * 1000);
|
||||||
jack_client_close(client);
|
jack_client_close(client);
|
||||||
av_fifo_free(buffer);
|
av_fifo_free(buffer);
|
||||||
buffer = NULL;
|
buffer = NULL;
|
||||||
|
|
|
@ -211,7 +211,7 @@ static void uninit(int immed) {
|
||||||
ALint state;
|
ALint state;
|
||||||
alGetSourcei(sources[0], AL_SOURCE_STATE, &state);
|
alGetSourcei(sources[0], AL_SOURCE_STATE, &state);
|
||||||
while (state == AL_PLAYING) {
|
while (state == AL_PLAYING) {
|
||||||
usec_sleep(10000);
|
mp_sleep_us(10000);
|
||||||
alGetSourcei(sources[0], AL_SOURCE_STATE, &state);
|
alGetSourcei(sources[0], AL_SOURCE_STATE, &state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,7 +153,7 @@ static void uninit(struct ao *ao, bool cut_audio)
|
||||||
* guaranteed by backend drivers, so we approximate this behavior.
|
* guaranteed by backend drivers, so we approximate this behavior.
|
||||||
*/
|
*/
|
||||||
if (!cut_audio)
|
if (!cut_audio)
|
||||||
usec_sleep(rsd_delay_ms(priv->rd) * 1000);
|
mp_sleep_us(rsd_delay_ms(priv->rd) * 1000);
|
||||||
|
|
||||||
rsd_stop(priv->rd);
|
rsd_stop(priv->rd);
|
||||||
rsd_free(priv->rd);
|
rsd_free(priv->rd);
|
||||||
|
|
|
@ -1436,7 +1436,7 @@ static void read_events(struct input_ctx *ictx, int time)
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (time > 0)
|
if (time > 0)
|
||||||
usec_sleep(time * 1000);
|
mp_sleep_us(time * 1000);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2029,7 +2029,7 @@ static double timing_sleep(struct MPContext *mpctx, double time_frame)
|
||||||
struct MPOpts *opts = &mpctx->opts;
|
struct MPOpts *opts = &mpctx->opts;
|
||||||
double margin = opts->softsleep ? 0.011 : 0;
|
double margin = opts->softsleep ? 0.011 : 0;
|
||||||
while (time_frame > margin) {
|
while (time_frame > margin) {
|
||||||
usec_sleep(1000000 * (time_frame - margin));
|
mp_sleep_us(1000000 * (time_frame - margin));
|
||||||
time_frame -= get_relative_time(mpctx);
|
time_frame -= get_relative_time(mpctx);
|
||||||
}
|
}
|
||||||
if (opts->softsleep) {
|
if (opts->softsleep) {
|
||||||
|
|
|
@ -42,12 +42,6 @@ double mp_time_sec(void)
|
||||||
return mp_time_us() / (double)(1000 * 1000);
|
return mp_time_us() / (double)(1000 * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
int usec_sleep(int usec_delay)
|
|
||||||
{
|
|
||||||
mp_sleep_us(usec_delay);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,4 @@ uint64_t mp_raw_time_us(void);
|
||||||
// Sleep in microseconds.
|
// Sleep in microseconds.
|
||||||
void mp_sleep_us(int64_t us);
|
void mp_sleep_us(int64_t us);
|
||||||
|
|
||||||
// Legacy timer functions. These can wrap.
|
|
||||||
int usec_sleep(int usec_delay);
|
|
||||||
|
|
||||||
#endif /* MPLAYER_TIMER_H */
|
#endif /* MPLAYER_TIMER_H */
|
||||||
|
|
|
@ -441,9 +441,9 @@ static void cache_mainloop(cache_vars_t *s) {
|
||||||
#endif
|
#endif
|
||||||
if (sleep_count < INITIAL_FILL_USLEEP_COUNT) {
|
if (sleep_count < INITIAL_FILL_USLEEP_COUNT) {
|
||||||
sleep_count++;
|
sleep_count++;
|
||||||
usec_sleep(INITIAL_FILL_USLEEP_TIME);
|
mp_sleep_us(INITIAL_FILL_USLEEP_TIME);
|
||||||
} else
|
} else
|
||||||
usec_sleep(FILL_USLEEP_TIME); // idle
|
mp_sleep_us(FILL_USLEEP_TIME); // idle
|
||||||
#if FORKED_CACHE
|
#if FORKED_CACHE
|
||||||
sa.sa_handler = SIG_IGN;
|
sa.sa_handler = SIG_IGN;
|
||||||
sigaction(SIGUSR1, &sa, NULL);
|
sigaction(SIGUSR1, &sa, NULL);
|
||||||
|
|
|
@ -295,7 +295,7 @@ static int stream_reconnect(stream_t *s)
|
||||||
"Connection lost! Attempting to reconnect...\n");
|
"Connection lost! Attempting to reconnect...\n");
|
||||||
|
|
||||||
if (retry)
|
if (retry)
|
||||||
usec_sleep(RECONNECT_SLEEP_MS * 1000);
|
mp_sleep_us(RECONNECT_SLEEP_MS * 1000);
|
||||||
|
|
||||||
s->eof = 1;
|
s->eof = 1;
|
||||||
stream_reset(s);
|
stream_reset(s);
|
||||||
|
@ -630,7 +630,7 @@ void stream_set_interrupt_callback(int (*cb)(struct input_ctx *, int),
|
||||||
int stream_check_interrupt(int time)
|
int stream_check_interrupt(int time)
|
||||||
{
|
{
|
||||||
if (!stream_check_interrupt_cb) {
|
if (!stream_check_interrupt_cb) {
|
||||||
usec_sleep(time * 1000);
|
mp_sleep_us(time * 1000);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return stream_check_interrupt_cb(stream_check_interrupt_ctx, time);
|
return stream_check_interrupt_cb(stream_check_interrupt_ctx, time);
|
||||||
|
|
|
@ -475,7 +475,7 @@ static void wait_for_completion(struct vo *vo, int max_outstanding)
|
||||||
" for XShm completion events...\n");
|
" for XShm completion events...\n");
|
||||||
ctx->Shm_Warned_Slow = 1;
|
ctx->Shm_Warned_Slow = 1;
|
||||||
}
|
}
|
||||||
usec_sleep(1000);
|
mp_sleep_us(1000);
|
||||||
vo_x11_check_events(vo);
|
vo_x11_check_events(vo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -685,7 +685,7 @@ static void wait_for_completion(struct vo *vo, int max_outstanding)
|
||||||
" for XShm completion events...\n");
|
" for XShm completion events...\n");
|
||||||
ctx->Shm_Warned_Slow = 1;
|
ctx->Shm_Warned_Slow = 1;
|
||||||
}
|
}
|
||||||
usec_sleep(1000);
|
mp_sleep_us(1000);
|
||||||
vo_x11_check_events(vo);
|
vo_x11_check_events(vo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue