From 426bde3f759cabfd240861ac41df78f1ddd4dfa8 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 24 Oct 2018 16:32:41 +0200 Subject: [PATCH] decoder/Thread: move check to SongHasVolatileTags() --- src/decoder/Thread.cxx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/decoder/Thread.cxx b/src/decoder/Thread.cxx index 7571ff974..f9dad2627 100644 --- a/src/decoder/Thread.cxx +++ b/src/decoder/Thread.cxx @@ -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(song.GetTag()) : nullptr); + !SongHasVolatileTags(song) ? std::make_unique(song.GetTag()) : nullptr); dc.state = DecoderState::START; dc.CommandFinishedLocked();