summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Ross-Gowan <rossymiles@gmail.com>2016-09-11 21:14:07 +1000
committerJames Ross-Gowan <rossymiles@gmail.com>2016-09-11 23:58:23 +1000
commit6ac0ef78c52e5c01720bddcb83ea46d52c7443bf (patch)
tree4fcd3bfb8fe3c46889796e06ad1d83c0fa29b897
parent3f7e43c2e2658eb8a1a22cc4e7359392ec70dc3b (diff)
downloadmpv-6ac0ef78c52e5c01720bddcb83ea46d52c7443bf.tar.bz2
mpv-6ac0ef78c52e5c01720bddcb83ea46d52c7443bf.tar.xz
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.
-rw-r--r--player/client.c8
1 files changed, 3 insertions, 5 deletions
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.