* [PATCH v3] ALSA: compress: allow setting codec params after next track
@ 2023-06-19 9:28 Srinivas Kandagatla
2023-06-21 5:23 ` Vinod Koul
2023-06-21 5:28 ` Takashi Iwai
0 siblings, 2 replies; 3+ messages in thread
From: Srinivas Kandagatla @ 2023-06-19 9:28 UTC (permalink / raw)
To: vkoul, broonie, tiwai
Cc: corbet, alsa-devel, linux-doc, linux-kernel, quic_plai, quic_mohs,
Srinivas Kandagatla
For gapless playback it is possible that each track can have different
codec profile with same decoder, for example we have WMA album,
we may have different tracks as WMA v9, WMA v10 and so on
Or if DSP's like QDSP have abililty to switch decoders on single stream
for each track, then this call could be used to set new codec parameters.
Existing code does not allow to change this profile while doing gapless
playback.
Reuse existing SNDRV_COMPRESS_SET_PARAMS to set this new track params along
some additional checks to enforce proper state machine.
With this new changes now the user can call SNDRV_COMPRESS_SET_PARAMS
anytime after setting next track and additional check in write should
also ensure that params are set before writing new data.
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
Changes since v2:
simplified the logic to allow set_params and udated the documentation accordingly
Documentation/sound/designs/compress-offload.rst | 11 ++++++-----
sound/core/compress_offload.c | 5 ++++-
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/Documentation/sound/designs/compress-offload.rst b/Documentation/sound/designs/compress-offload.rst
index 935f325dbc77..655624f77092 100644
--- a/Documentation/sound/designs/compress-offload.rst
+++ b/Documentation/sound/designs/compress-offload.rst
@@ -268,11 +268,12 @@ with setting of meta_data and signalling for next track ::
| |
| V
| +----------+
- | | |
- | |NEXT_TRACK|
- | | |
- | +----------+
- | |
+ | compr_set_params() | |
+ | +-----------|NEXT_TRACK|
+ | | | |
+ | | +--+-------+
+ | | | |
+ | +--------------+ |
| |
| | compr_partial_drain()
| |
diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c
index 243acad89fd3..30f73097447b 100644
--- a/sound/core/compress_offload.c
+++ b/sound/core/compress_offload.c
@@ -589,7 +589,7 @@ 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->next_track) {
/*
* we should allow parameter change only when stream has been
* opened not in other cases
@@ -612,6 +612,9 @@ snd_compr_set_params(struct snd_compr_stream *stream, unsigned long arg)
if (retval)
goto out;
+ if (stream->next_track)
+ goto out;
+
stream->metadata_set = false;
stream->next_track = false;
--
2.21.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH v3] ALSA: compress: allow setting codec params after next track
2023-06-19 9:28 [PATCH v3] ALSA: compress: allow setting codec params after next track Srinivas Kandagatla
@ 2023-06-21 5:23 ` Vinod Koul
2023-06-21 5:28 ` Takashi Iwai
1 sibling, 0 replies; 3+ messages in thread
From: Vinod Koul @ 2023-06-21 5:23 UTC (permalink / raw)
To: Srinivas Kandagatla
Cc: broonie, tiwai, corbet, alsa-devel, linux-doc, linux-kernel,
quic_plai, quic_mohs
On 19-06-23, 10:28, Srinivas Kandagatla wrote:
> For gapless playback it is possible that each track can have different
> codec profile with same decoder, for example we have WMA album,
> we may have different tracks as WMA v9, WMA v10 and so on
>
> Or if DSP's like QDSP have abililty to switch decoders on single stream
> for each track, then this call could be used to set new codec parameters.
>
> Existing code does not allow to change this profile while doing gapless
> playback.
>
> Reuse existing SNDRV_COMPRESS_SET_PARAMS to set this new track params along
> some additional checks to enforce proper state machine.
>
> With this new changes now the user can call SNDRV_COMPRESS_SET_PARAMS
> anytime after setting next track and additional check in write should
> also ensure that params are set before writing new data.
Acked-by: Vinod Koul <vkoul@kernel.org>
--
~Vinod
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v3] ALSA: compress: allow setting codec params after next track
2023-06-19 9:28 [PATCH v3] ALSA: compress: allow setting codec params after next track Srinivas Kandagatla
2023-06-21 5:23 ` Vinod Koul
@ 2023-06-21 5:28 ` Takashi Iwai
1 sibling, 0 replies; 3+ messages in thread
From: Takashi Iwai @ 2023-06-21 5:28 UTC (permalink / raw)
To: Srinivas Kandagatla
Cc: vkoul, broonie, tiwai, corbet, alsa-devel, linux-doc,
linux-kernel, quic_plai, quic_mohs
On Mon, 19 Jun 2023 11:28:05 +0200,
Srinivas Kandagatla wrote:
>
> For gapless playback it is possible that each track can have different
> codec profile with same decoder, for example we have WMA album,
> we may have different tracks as WMA v9, WMA v10 and so on
>
> Or if DSP's like QDSP have abililty to switch decoders on single stream
> for each track, then this call could be used to set new codec parameters.
>
> Existing code does not allow to change this profile while doing gapless
> playback.
>
> Reuse existing SNDRV_COMPRESS_SET_PARAMS to set this new track params along
> some additional checks to enforce proper state machine.
>
> With this new changes now the user can call SNDRV_COMPRESS_SET_PARAMS
> anytime after setting next track and additional check in write should
> also ensure that params are set before writing new data.
>
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> ---
> Changes since v2:
> simplified the logic to allow set_params and udated the documentation accordingly
Applied now. Thanks.
Takashi
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-06-21 5:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-19 9:28 [PATCH v3] ALSA: compress: allow setting codec params after next track Srinivas Kandagatla
2023-06-21 5:23 ` Vinod Koul
2023-06-21 5:28 ` Takashi Iwai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).