summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2016-05-13 13:00:40 +0200
committerMax Kellermann <max@duempel.org>2016-05-13 13:00:40 +0200
commitfe8a13f76ff9e6c1c731ea1a0a04e996476d60b5 (patch)
tree438e741ce307f28b45c573ebb92019a4a992861a /src
parent9252432bc0fbd93f95c25860236f9b78d723ea8b (diff)
decoder/Thread: move code to DecoderUnlockedRunUri()
Diffstat (limited to 'src')
-rw-r--r--src/decoder/DecoderThread.cxx17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/decoder/DecoderThread.cxx b/src/decoder/DecoderThread.cxx
index b68c8bc57..d432cf4c1 100644
--- a/src/decoder/DecoderThread.cxx
+++ b/src/decoder/DecoderThread.cxx
@@ -345,6 +345,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.
*
* Caller holds DecoderControl::mutex.
@@ -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 */