Skip to content

Commit

Permalink
player/Thread: merge tag for songs have range instead of replacing wi…
Browse files Browse the repository at this point in the history
…th `chunk->tag`

While playing first track of cue file on satellite setup, the tag of
currentsong will loss. This is due to `chunk->tag` overwriting song tag
in `PlayerControl::PlayChunk`. In local cue files, `song_tag` is used to
form `stream_tag` and merged into `chunk->tag`, but `song_tag` only
works for local files. So the `chunk->tag` is decided by decoded tag
from audio files, which in cue's case is the whole album file and
doesn't contain track metadata.

This commit fixes the issue by merging song's tag with `chunk->tag`
(`chunk->tag` prioritized) in `PlayerControl::LockUpdateSongTag`, only
when the song's `end_time` is not zero. As the `end_time` will only be
set on cue virtual songs or with `rangeid` command, the impact to
current behaviour is minimized: changes only happen when user uses
`rangeid` command on a remote song, and it's expected that song tags
in database should beoverwritten with tags provided by remote stream
instead of merged.
  • Loading branch information
datasone committed Apr 12, 2023
1 parent 212f6dc commit 9a597b8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/player/Thread.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,10 @@ PlayerControl::LockUpdateSongTag(DetachedSong &song,
streams may change tags dynamically */
return;

song.SetTag(new_tag);
if (!song.GetEndTime().IsZero())
song.SetTag(Tag::Merge(song.GetTag(), new_tag));
else
song.SetTag(new_tag);

LockSetTaggedSong(song);

Expand Down

0 comments on commit 9a597b8

Please sign in to comment.