decoder/Thread: use ScopeLock in TryDecoderFile()
This commit is contained in:
parent
fad0e834d5
commit
ca08902d71
@ -324,25 +324,20 @@ TryDecoderFile(Decoder &decoder, Path path_fs, const char *suffix,
|
|||||||
DecoderControl &dc = decoder.dc;
|
DecoderControl &dc = decoder.dc;
|
||||||
|
|
||||||
if (plugin.file_decode != nullptr) {
|
if (plugin.file_decode != nullptr) {
|
||||||
dc.Lock();
|
const ScopeLock protect(dc.mutex);
|
||||||
|
return decoder_file_decode(plugin, decoder, path_fs);
|
||||||
bool success = decoder_file_decode(plugin, decoder, path_fs);
|
|
||||||
|
|
||||||
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);
|
||||||
if (input_stream == nullptr)
|
if (input_stream == nullptr)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
dc.Lock();
|
bool success;
|
||||||
|
{
|
||||||
bool success = decoder_stream_decode(plugin, decoder,
|
const ScopeLock protect(dc.mutex);
|
||||||
|
success = decoder_stream_decode(plugin, decoder,
|
||||||
*input_stream);
|
*input_stream);
|
||||||
|
}
|
||||||
dc.Unlock();
|
|
||||||
|
|
||||||
delete input_stream;
|
delete input_stream;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user