output/Thread: simplify the main loop switch
Move the InternalPlay() call and the wake_cond.wait() call into the `case Command::NONE` and revert all `continue` statements to a simple `break`.
This commit is contained in:
parent
8f0a1a5d82
commit
b0596291a8
@ -422,6 +422,16 @@ AudioOutputControl::Task() noexcept
|
|||||||
while (true) {
|
while (true) {
|
||||||
switch (command) {
|
switch (command) {
|
||||||
case Command::NONE:
|
case Command::NONE:
|
||||||
|
/* no pending command: play (or wait for a
|
||||||
|
command) */
|
||||||
|
|
||||||
|
if (open && allow_play && InternalPlay(lock))
|
||||||
|
/* don't wait for an event if there
|
||||||
|
are more chunks in the pipe */
|
||||||
|
continue;
|
||||||
|
|
||||||
|
woken_for_play = false;
|
||||||
|
wake_cond.wait(lock);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Command::ENABLE:
|
case Command::ENABLE:
|
||||||
@ -454,11 +464,7 @@ AudioOutputControl::Task() noexcept
|
|||||||
}
|
}
|
||||||
|
|
||||||
InternalPause(lock);
|
InternalPause(lock);
|
||||||
/* don't "break" here: this might cause
|
break;
|
||||||
Play() to be called when command==CLOSE
|
|
||||||
ends the paused state - "continue" checks
|
|
||||||
the new command first */
|
|
||||||
continue;
|
|
||||||
|
|
||||||
case Command::RELEASE:
|
case Command::RELEASE:
|
||||||
if (!open) {
|
if (!open) {
|
||||||
@ -483,18 +489,14 @@ AudioOutputControl::Task() noexcept
|
|||||||
CommandFinished();
|
CommandFinished();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* don't "break" here: this might cause
|
break;
|
||||||
Play() to be called when command==CLOSE
|
|
||||||
ends the paused state - "continue" checks
|
|
||||||
the new command first */
|
|
||||||
continue;
|
|
||||||
|
|
||||||
case Command::DRAIN:
|
case Command::DRAIN:
|
||||||
if (open)
|
if (open)
|
||||||
InternalDrain();
|
InternalDrain();
|
||||||
|
|
||||||
CommandFinished();
|
CommandFinished();
|
||||||
continue;
|
break;
|
||||||
|
|
||||||
case Command::CANCEL:
|
case Command::CANCEL:
|
||||||
source.Cancel();
|
source.Cancel();
|
||||||
@ -505,7 +507,7 @@ AudioOutputControl::Task() noexcept
|
|||||||
}
|
}
|
||||||
|
|
||||||
CommandFinished();
|
CommandFinished();
|
||||||
continue;
|
break;
|
||||||
|
|
||||||
case Command::KILL:
|
case Command::KILL:
|
||||||
InternalDisable();
|
InternalDisable();
|
||||||
@ -513,16 +515,6 @@ AudioOutputControl::Task() noexcept
|
|||||||
CommandFinished();
|
CommandFinished();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (open && allow_play && InternalPlay(lock))
|
|
||||||
/* don't wait for an event if there are more
|
|
||||||
chunks in the pipe */
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (command == Command::NONE) {
|
|
||||||
woken_for_play = false;
|
|
||||||
wake_cond.wait(lock);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user