output/Thread: unlock mutex during OpenFilter()

This commit is contained in:
Max Kellermann 2016-12-13 21:22:47 +01:00
parent c20126598f
commit f8164a3dd1
2 changed files with 7 additions and 4 deletions

View File

@ -413,6 +413,8 @@ private:
/**
* Throws std::runtime_error on error.
*
* Mutex must not be locked.
*/
AudioFormat OpenFilter(AudioFormat &format);

View File

@ -148,6 +148,7 @@ AudioOutput::Open()
AudioFormat filter_audio_format;
try {
const ScopeUnlock unlock(mutex);
filter_audio_format = OpenFilter(in_audio_format);
} catch (const std::runtime_error &e) {
FormatError(e, "Failed to open filter for \"%s\" [%s]",
@ -263,10 +264,9 @@ AudioOutput::CloseOutput(bool drain)
void
AudioOutput::ReopenFilter()
{
{
const ScopeUnlock unlock(mutex);
CloseFilter();
}
try {
OpenFilter(in_audio_format);
@ -276,6 +276,7 @@ AudioOutput::ReopenFilter()
"Failed to open filter for \"%s\" [%s]",
name, plugin.name);
const ScopeLock lock(mutex);
Close(false);
}
}