diff mbox series

[01/14] ALSA: compress: Update compress set params for gapless playback

Message ID 20230201134947.1638197-2-quic_mohs@quicinc.com
State New
Headers show
Series [01/14] ALSA: compress: Update compress set params for gapless playback | expand

Commit Message

Mohammad Rafi Shaik Feb. 1, 2023, 1:49 p.m. UTC
Update compress set params for supporting next track settings
during gapless playback.
Update the runtime state to setup state only if it's in open state.
Allow parameter change only when stream has been opened and running
state.

Signed-off-by: Mohammad Rafi Shaik <quic_mohs@quicinc.com>
Co-developed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 sound/core/compress_offload.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c
index 243acad89fd3..9b951d76c120 100644
--- a/sound/core/compress_offload.c
+++ b/sound/core/compress_offload.c
@@ -589,7 +589,8 @@  snd_compr_set_params(struct snd_compr_stream *stream, unsigned long arg)
 	struct snd_compr_params *params;
 	int retval;
 
-	if (stream->runtime->state == SNDRV_PCM_STATE_OPEN) {
+	if (stream->runtime->state == SNDRV_PCM_STATE_OPEN ||
+			stream->runtime->state == SNDRV_PCM_STATE_RUNNING) {
 		/*
 		 * we should allow parameter change only when stream has been
 		 * opened not in other cases
@@ -612,10 +613,13 @@  snd_compr_set_params(struct snd_compr_stream *stream, unsigned long arg)
 		if (retval)
 			goto out;
 
-		stream->metadata_set = false;
-		stream->next_track = false;
+		if (stream->runtime->state == SNDRV_PCM_STATE_OPEN) {
+			stream->metadata_set = false;
+			stream->next_track = false;
+
+			stream->runtime->state = SNDRV_PCM_STATE_SETUP;
+		}
 
-		stream->runtime->state = SNDRV_PCM_STATE_SETUP;
 	} else {
 		return -EPERM;
 	}