Skip to content
Snippets Groups Projects
Commit 81609a6b authored by Devin Lehmacher's avatar Devin Lehmacher
Browse files

ensure there is a metadata update after last call to needsMetadataUpdate

When metadata updates moved to the background thread this introduced a
race condition where it was possible for setNeedsMetadataUpdate to be
called when _needsMetadataUpdate == NO thus skipping the update while
the action to update the metadata is already being executed on the
background thread. With a precise interleaving this could leave the
player metadata in an inconsistent state where it is still displaying
the metadata from the last song even though the next song has already
started playing.

This patch ensures that there will always be at least one metadata
update after the last call to setNeedsMetadataUpdate. It is now possible
for there to be a redundant metadata update, however if the metadata is
already up to date this is idempotent thus doesn't lead to an
inconsistent state. Since the metadata update isn't particularly
expensive and occurs on a background thread, the cost of an extra update
in some cases seems reasonable.
parent db240c0e
No related branches found
No related tags found
Loading
Pipeline #266395 passed with stages
in 3 minutes and 20 seconds