Playlist: copy stream tags from the PlayerThread

Finally restores an important feature that has been broken for several
months when the PlayerThread started working with Song copies instead
of pointers to the Queue's Song instances (commit e96779d).
This commit is contained in:
Max Kellermann
2013-10-21 23:22:16 +02:00
parent f8c23488c9
commit 2f43e4bc66
8 changed files with 95 additions and 11 deletions

View File

@@ -335,6 +335,8 @@ Player::WaitForDecoder()
return false;
}
pc.ClearTaggedSong();
if (song != nullptr)
song->Free();
@@ -684,7 +686,7 @@ Player::ProcessCommand()
}
static void
update_song_tag(Song *song, const Tag &new_tag)
update_song_tag(player_control &pc, Song *song, const Tag &new_tag)
{
if (song->IsFile())
/* don't update tags of local files, only remote
@@ -696,6 +698,8 @@ update_song_tag(Song *song, const Tag &new_tag)
delete old_tag;
pc.LockSetTaggedSong(*song);
/* the main thread will update the playlist version when he
receives this event */
GlobalEvents::Emit(GlobalEvents::TAG);
@@ -722,7 +726,7 @@ play_chunk(player_control &pc,
assert(chunk->CheckFormat(format));
if (chunk->tag != nullptr)
update_song_tag(song, *chunk->tag);
update_song_tag(pc, song, *chunk->tag);
if (chunk->IsEmpty()) {
buffer.Return(chunk);
@@ -1077,6 +1081,8 @@ Player::Run()
pc.Lock();
pc.ClearTaggedSong();
if (queued) {
assert(pc.next_song != nullptr);
pc.next_song->Free();