decoder/Thread: always unlock mutex before returning from TryDecoderFile()
Remove that surprising rule.
This commit is contained in:
parent
dc76eb6139
commit
fad0e834d5
@ -312,8 +312,7 @@ decoder_load_replay_gain(Decoder &decoder, Path path_fs)
|
|||||||
/**
|
/**
|
||||||
* Decode a file with the given decoder plugin.
|
* Decode a file with the given decoder plugin.
|
||||||
*
|
*
|
||||||
* DecoderControl::mutex must not be locked by the caller. It will be
|
* DecoderControl::mutex is not locked by caller.
|
||||||
* left locked upon returning true.
|
|
||||||
*/
|
*/
|
||||||
static bool
|
static bool
|
||||||
TryDecoderFile(Decoder &decoder, Path path_fs, const char *suffix,
|
TryDecoderFile(Decoder &decoder, Path path_fs, const char *suffix,
|
||||||
@ -327,10 +326,11 @@ TryDecoderFile(Decoder &decoder, Path path_fs, const char *suffix,
|
|||||||
if (plugin.file_decode != nullptr) {
|
if (plugin.file_decode != nullptr) {
|
||||||
dc.Lock();
|
dc.Lock();
|
||||||
|
|
||||||
if (decoder_file_decode(plugin, decoder, path_fs))
|
bool success = decoder_file_decode(plugin, decoder, path_fs);
|
||||||
return true;
|
|
||||||
|
|
||||||
dc.Unlock();
|
dc.Unlock();
|
||||||
|
|
||||||
|
return success;
|
||||||
} else if (plugin.stream_decode != nullptr) {
|
} else if (plugin.stream_decode != nullptr) {
|
||||||
InputStream *input_stream =
|
InputStream *input_stream =
|
||||||
decoder_input_stream_open(dc, path_fs);
|
decoder_input_stream_open(dc, path_fs);
|
||||||
@ -346,13 +346,9 @@ TryDecoderFile(Decoder &decoder, Path path_fs, const char *suffix,
|
|||||||
|
|
||||||
delete input_stream;
|
delete input_stream;
|
||||||
|
|
||||||
if (success) {
|
return success;
|
||||||
dc.Lock();
|
} else
|
||||||
return true;
|
return false;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -367,21 +363,15 @@ decoder_run_file(Decoder &decoder, const char *uri_utf8, Path path_fs)
|
|||||||
if (suffix == nullptr)
|
if (suffix == nullptr)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
DecoderControl &dc = decoder.dc;
|
|
||||||
|
|
||||||
decoder_load_replay_gain(decoder, path_fs);
|
decoder_load_replay_gain(decoder, path_fs);
|
||||||
|
|
||||||
if (decoder_plugins_try([&decoder, path_fs,
|
return decoder_plugins_try([&decoder, path_fs,
|
||||||
suffix](const DecoderPlugin &plugin){
|
suffix](const DecoderPlugin &plugin){
|
||||||
return TryDecoderFile(decoder,
|
return TryDecoderFile(decoder,
|
||||||
path_fs, suffix,
|
path_fs,
|
||||||
plugin);
|
suffix,
|
||||||
})) {
|
plugin);
|
||||||
dc.Unlock();
|
});
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user