decoder/Thread: move code to DecoderUnlockedRunUri()

This commit is contained in:
Max Kellermann 2016-05-13 13:00:40 +02:00
parent 9252432bc0
commit fe8a13f76f
1 changed files with 14 additions and 3 deletions

View File

@ -344,6 +344,19 @@ decoder_run_file(Decoder &decoder, const char *uri_utf8, Path path_fs)
});
}
/**
* Decode a song.
*
* DecoderControl::mutex is not locked.
*/
static bool
DecoderUnlockedRunUri(Decoder &decoder, const char *real_uri, Path path_fs)
{
return !path_fs.IsNull()
? decoder_run_file(decoder, real_uri, path_fs)
: decoder_run_stream(decoder, real_uri);
}
/**
* Decode a song addressed by a #DetachedSong.
*
@ -367,9 +380,7 @@ decoder_run_song(DecoderControl &dc,
{
const ScopeUnlock unlock(dc.mutex);
success = !path_fs.IsNull()
? decoder_run_file(decoder, uri, path_fs)
: decoder_run_stream(decoder, uri);
success = DecoderUnlockedRunUri(decoder, uri, path_fs);
/* flush the last chunk */