From 6ac0ef78c52e5c01720bddcb83ea46d52c7443bf Mon Sep 17 00:00:00 2001 From: James Ross-Gowan Date: Sun, 11 Sep 2016 21:14:07 +1000 Subject: client API: don't miss property changes after updates When update_prop() successfully fetches a changed property value, it sets prop->changed to true. mark_property_changed() only sets prop->need_new_value if prop->changed is false, so this had the effect of ignoring new property values until prop->changed was set back to false in the next call to gen_property_change_event(). This meant that when a property change event was generated for a property that was not observed with MPV_FORMAT_NONE, it would contain the value associated with the earliest property change, rather than the most recent, and the property change event for the most recent change would never be generated. To fix this, mark_property_changed() should unconditionally set prop->changed and prop->need_new_value, which will cause the property value to be re-fetched and a property change event to be generated for the most recent value. --- player/client.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'player') diff --git a/player/client.c b/player/client.c index 7587b8bbae..803ef36fca 100644 --- a/player/client.c +++ b/player/client.c @@ -1373,11 +1373,9 @@ int mpv_unobserve_property(mpv_handle *ctx, uint64_t userdata) static void mark_property_changed(struct mpv_handle *client, int index) { struct observe_property *prop = client->properties[index]; - if (!prop->changed && !prop->need_new_value) { - prop->changed = true; - prop->need_new_value = prop->format != 0; - client->lowest_changed = MPMIN(client->lowest_changed, index); - } + prop->changed = true; + prop->need_new_value = prop->format != 0; + client->lowest_changed = MPMIN(client->lowest_changed, index); } // Broadcast that a property has changed. -- cgit v1.2.3