summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-09-08 18:53:20 +0200
committerwm4 <wm4@nowhere>2016-09-08 18:53:20 +0200
commita2fce5ba26dbab4836df4cb75a1458ca41f0dcb6 (patch)
tree23b04527949610022b8ac16795a467d80e932eab
parentc3097422f2e6f5fc687a21022e541a3f16e8ad19 (diff)
downloadmpv-a2fce5ba26dbab4836df4cb75a1458ca41f0dcb6.tar.bz2
mpv-a2fce5ba26dbab4836df4cb75a1458ca41f0dcb6.tar.xz
vo: don't access global options unsynchronized
And since there's no proper fine-grained option change notification mechanism yet, intercept updates to "framedrop" manually.
-rw-r--r--player/command.c11
-rw-r--r--video/out/vo.c16
2 files changed, 21 insertions, 6 deletions
diff --git a/player/command.c b/player/command.c
index 03ea4d640c..e63e9181e5 100644
--- a/player/command.c
+++ b/player/command.c
@@ -2673,6 +2673,16 @@ static int mp_property_display_fps(void *ctx, struct m_property *prop,
return m_property_double_ro(action, arg, fps);
}
+static int mp_property_framedrop(void *ctx, struct m_property *prop,
+ int action, void *arg)
+{
+ MPContext *mpctx = ctx;
+ int ret = mp_property_generic_option(mpctx, prop, action, arg);
+ if (action == M_PROPERTY_SET && ret == M_PROPERTY_OK && mpctx->video_out)
+ vo_event(mpctx->video_out, VO_EVENT_WIN_STATE);
+ return ret;
+}
+
static int mp_property_estimated_display_fps(void *ctx, struct m_property *prop,
int action, void *arg)
{
@@ -3881,6 +3891,7 @@ static const struct m_property mp_properties_base[] = {
{"display-fps", mp_property_display_fps},
{"estimated-display-fps", mp_property_estimated_display_fps},
{"vsync-jitter", mp_property_vsync_jitter},
+ {"framedrop", mp_property_framedrop},
{"working-directory", mp_property_cwd},
diff --git a/video/out/vo.c b/video/out/vo.c
index afd4b4c792..2ad57eff7f 100644
--- a/video/out/vo.c
+++ b/video/out/vo.c
@@ -156,6 +156,7 @@ struct vo_internal {
int req_frames; // VO's requested value of num_frames
double display_fps;
+ int opt_framedrop;
};
static void forget_frames(struct vo *vo);
@@ -458,12 +459,15 @@ static void update_display_fps(struct vo *vo)
pthread_mutex_unlock(&in->lock);
- double display_fps = 0;
- if (vo->global->opts->frame_drop_fps > 0) {
- display_fps = vo->global->opts->frame_drop_fps;
- } else {
+ mp_read_option_raw(vo->global, "framedrop", &m_option_type_choice,
+ &in->opt_framedrop);
+
+ double display_fps;
+ mp_read_option_raw(vo->global, "display-fps", &m_option_type_double,
+ &display_fps);
+
+ if (display_fps <= 0)
vo->driver->control(vo, VOCTRL_GET_DISPLAY_FPS, &display_fps);
- }
pthread_mutex_lock(&in->lock);
@@ -763,7 +767,7 @@ static bool render_frame(struct vo *vo)
in->dropped_frame &= !frame->display_synced;
in->dropped_frame &= !(vo->driver->caps & VO_CAP_FRAMEDROP);
- in->dropped_frame &= (vo->global->opts->frame_dropping & 1);
+ in->dropped_frame &= (in->opt_framedrop & 1);
// Even if we're hopelessly behind, rather degrade to 10 FPS playback,
// instead of just freezing the display forever.
in->dropped_frame &= now - in->prev_vsync < 100 * 1000;