outputThread: optimize Command::OPEN

Try harder to skip steps (reopen filter, reopen output) if the
AudioOutput is already open.
This commit is contained in:
Max Kellermann
2016-12-24 14:05:11 +01:00
parent ffb8b4fc68
commit f95e404be1
2 changed files with 52 additions and 87 deletions

View File

@@ -171,6 +171,14 @@ struct AudioOutput {
*/
AudioFormat in_audio_format;
/**
* The #AudioFormat which is emitted by the #Filter, with
* #config_audio_format already applied. This is used to
* decide whether this object needs to be closed and reopened
* upon #AudioFormat changes.
*/
AudioFormat filter_audio_format;
/**
* The audio_format which is really sent to the device. This
* is basically config_audio_format (if configured) or
@@ -445,15 +453,6 @@ private:
void Open();
/**
* Open the #ChainFilter and call OpenOutputAndConvert().
*
* Caller must not lock the mutex.
*
* @return true on success
*/
bool OpenFilterAndOutput();
/**
* Invoke OutputPlugin::open() and configure the
* #ConvertFilter.
@@ -465,7 +464,6 @@ private:
bool OpenOutputAndConvert(AudioFormat audio_format);
void Close(bool drain);
void Reopen();
/**
* Close the output plugin.
@@ -486,8 +484,6 @@ private:
*/
void CloseFilter();
void ReopenFilter();
/**
* Wait until the output's delay reaches zero.
*