decoder/Thread: move check to SongHasVolatileTags()

This commit is contained in:
Max Kellermann 2018-10-24 16:32:41 +02:00
parent 30e22b753b
commit 426bde3f75
1 changed files with 14 additions and 1 deletions

View File

@ -431,6 +431,19 @@ try {
error_uri));
}
/**
* Try to guess whether tags attached to the given song are
* "volatile", e.g. if they have been received by a live stream, but
* are only kept as a cache to be displayed by the client; they shall
* not be sent to the output.
*/
gcc_pure
static bool
SongHasVolatileTags(const DetachedSong &song) noexcept
{
return !song.IsFile();
}
/**
* Decode a song addressed by a #DetachedSong.
*
@ -446,7 +459,7 @@ decoder_run_song(DecoderControl &dc,
file - tags on "stream" songs are just
remembered from the last time we
played it*/
song.IsFile() ? std::make_unique<Tag>(song.GetTag()) : nullptr);
!SongHasVolatileTags(song) ? std::make_unique<Tag>(song.GetTag()) : nullptr);
dc.state = DecoderState::START;
dc.CommandFinishedLocked();