mirror of https://github.com/mpv-player/mpv
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.
This commit is contained in:
parent
3f7e43c2e2
commit
6ac0ef78c5
|
@ -1373,12 +1373,10 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
// Broadcast that a property has changed.
|
||||
void mp_client_property_change(struct MPContext *mpctx, const char *name)
|
||||
|
|
Loading…
Reference in New Issue