From 2d858e0ba274eed484ec06a1a617687d3f1668d4 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 26 Sep 2022 11:10:02 +0200 Subject: [PATCH] spa: a Flush command does not stop processing A flush command is not supposed to stop playback but just clear the current state. Normally, to avoid complications, an application will Pause, Flush and optionally Start to do things smoothly without interfering with the process loop, but things should not crash if that's not the case. Fixes #2726 --- spa/plugins/audioconvert/audioadapter.c | 6 +++--- spa/plugins/audioconvert/audioconvert.c | 6 +++--- spa/plugins/videoconvert/videoadapter.c | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/spa/plugins/audioconvert/audioadapter.c b/spa/plugins/audioconvert/audioadapter.c index dc416a09f..21bf45f82 100644 --- a/spa/plugins/audioconvert/audioadapter.c +++ b/spa/plugins/audioconvert/audioadapter.c @@ -824,13 +824,13 @@ static int impl_node_send_command(void *object, const struct spa_command *comman case SPA_NODE_COMMAND_Suspend: configure_format(this, 0, NULL); SPA_FALLTHROUGH - case SPA_NODE_COMMAND_Flush: - this->io_buffers.status = SPA_STATUS_OK; - SPA_FALLTHROUGH case SPA_NODE_COMMAND_Pause: this->started = false; spa_log_debug(this->log, "%p: stopped", this); break; + case SPA_NODE_COMMAND_Flush: + this->io_buffers.status = SPA_STATUS_OK; + break; default: break; } diff --git a/spa/plugins/audioconvert/audioconvert.c b/spa/plugins/audioconvert/audioconvert.c index 9cca99617..0b9c4ff6f 100644 --- a/spa/plugins/audioconvert/audioconvert.c +++ b/spa/plugins/audioconvert/audioconvert.c @@ -1547,12 +1547,12 @@ static int impl_node_send_command(void *object, const struct spa_command *comman case SPA_NODE_COMMAND_Suspend: this->setup = false; SPA_FALLTHROUGH; - case SPA_NODE_COMMAND_Flush: - reset_node(this); - SPA_FALLTHROUGH; case SPA_NODE_COMMAND_Pause: this->started = false; break; + case SPA_NODE_COMMAND_Flush: + reset_node(this); + break; default: return -ENOTSUP; } diff --git a/spa/plugins/videoconvert/videoadapter.c b/spa/plugins/videoconvert/videoadapter.c index 694e6af65..c09417b41 100644 --- a/spa/plugins/videoconvert/videoadapter.c +++ b/spa/plugins/videoconvert/videoadapter.c @@ -823,12 +823,12 @@ static int impl_node_send_command(void *object, const struct spa_command *comman case SPA_NODE_COMMAND_Suspend: configure_format(this, 0, NULL); SPA_FALLTHROUGH - case SPA_NODE_COMMAND_Flush: - this->io_buffers.status = SPA_STATUS_OK; - SPA_FALLTHROUGH case SPA_NODE_COMMAND_Pause: this->started = false; break; + case SPA_NODE_COMMAND_Flush: + this->io_buffers.status = SPA_STATUS_OK; + break; default: break; }