From: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx> This sometimes causes the Track to be schedule while some metadata are still pending. Fixes: https://github.com/bluez/bluez/issues/291 --- profiles/audio/player.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/profiles/audio/player.c b/profiles/audio/player.c index d34b39168..687614b49 100644 --- a/profiles/audio/player.c +++ b/profiles/audio/player.c @@ -1308,9 +1308,14 @@ void media_player_set_duration(struct media_player *mp, uint32_t duration) g_hash_table_replace(mp->track, g_strdup("Duration"), value); - g_dbus_emit_property_changed(btd_get_dbus_connection(), + /* If metadata is pending wait for it */ + if (mp->process_id) + return; + + g_dbus_emit_property_changed_full(btd_get_dbus_connection(), mp->path, MEDIA_PLAYER_INTERFACE, - "Track"); + "Track", + G_DBUS_PROPERTY_CHANGED_FLAG_FLUSH); } void media_player_set_position(struct media_player *mp, uint32_t position) -- 2.34.1