diff options
author | wm4 <wm4@nowhere> | 2016-09-16 14:24:15 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2016-09-16 14:39:45 +0200 |
commit | 03fec24e192ea1b5c0cf957a5a64c0db9d33e67a (patch) | |
tree | 75f58b93ce56c3f6cd3afdbd3ce028f93dcf35bb /player/misc.c | |
parent | b8ade7c99b830ee9870040bcfc1f2c3d3a64d172 (diff) | |
download | mpv-03fec24e192ea1b5c0cf957a5a64c0db9d33e67a.tar.bz2 mpv-03fec24e192ea1b5c0cf957a5a64c0db9d33e67a.tar.xz |
player: litter code with explicit wakeup calls
This does 3 kinds of changes:
- change sleeptime=x to mp_set_timeout()
- change sleeptime=0 to mp_wakeup_core() calls (to be more explicit)
- change commands etc. to call mp_wakeup_core() if they do changes that
require the playloop to be rerun
This is preparation for the following changes. The goal is to process
client API requests without having to rerun the playloop every time. As
of this commit, the changes should not change behavior. In particular,
the playloop is still implicitly woken up on every command.
Diffstat (limited to 'player/misc.c')
-rw-r--r-- | player/misc.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/player/misc.c b/player/misc.c index 65aad50de7..eb4c1c031e 100644 --- a/player/misc.c +++ b/player/misc.c @@ -201,7 +201,7 @@ void error_on_track(struct MPContext *mpctx, struct track *track) if (mpctx->error_playing >= 0) mpctx->error_playing = MPV_ERROR_NOTHING_TO_PLAY; } - mpctx->sleeptime = 0; + mp_wakeup_core(mpctx); } int stream_dump(struct MPContext *mpctx, const char *source_filename) @@ -222,7 +222,8 @@ int stream_dump(struct MPContext *mpctx, const char *source_filename) (long long int)pos, (long long int)size); } stream_fill_buffer(stream); - mp_process_input(mpctx); + mp_wakeup_core(mpctx); // don't actually sleep + mp_idle(mpctx); // but process input } free_stream(stream); @@ -295,5 +296,6 @@ int mpctx_run_reentrant(struct MPContext *mpctx, void (*thread_fn)(void *arg), pthread_join(thread, NULL); done: pthread_mutex_destroy(&args.mutex); + mp_wakeup_core(mpctx); // avoid lost wakeups during waiting return success ? 0 : -1; } |