Skip to content

ensure metadata update after last call to setNeedsMetadataUpdate

Devin Lehmacher requested to merge lehmacdj/vlc-ios:master into master

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.

Edited by Devin Lehmacher

Merge request reports

Loading