decoder_thread: reopen the stream after file_decode() has failed
When decoding a local file, the decoder thread tries to run all matching decoders, until one succeeds. Both file_decode() and stream_decode() can decode a stream, but MPD closes the stream before calling file_decode(). Problem is: when this decoder fails, and the next's stream_decode() method is invoked, the input_stream is still closed. This patch reopens it.
This commit is contained in:
parent
d5ddecb15a
commit
2536b0da83
@ -186,6 +186,17 @@ static void decoder_run_song(const struct song *song, const char *uri)
|
|||||||
if (ret)
|
if (ret)
|
||||||
break;
|
break;
|
||||||
} else if (plugin->stream_decode != NULL) {
|
} else if (plugin->stream_decode != NULL) {
|
||||||
|
if (!close_instream) {
|
||||||
|
/* the input_stream object has
|
||||||
|
been closed before
|
||||||
|
decoder_file_decode() -
|
||||||
|
reopen it */
|
||||||
|
if (input_stream_open(&input_stream, uri))
|
||||||
|
close_instream = true;
|
||||||
|
else
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
ret = decoder_stream_decode(plugin, &decoder,
|
ret = decoder_stream_decode(plugin, &decoder,
|
||||||
&input_stream);
|
&input_stream);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
Loading…
Reference in New Issue
Block a user