Skip to content

Commit 7ea9ee0

Browse files
Srinivas-Kandagatlatiwai
authored andcommitted
ALSA: compress: allow setting codec params after next track
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 <[email protected]> Acked-by: Vinod Koul <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent 79597c8 commit 7ea9ee0

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

Documentation/sound/designs/compress-offload.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -268,11 +268,12 @@ with setting of meta_data and signalling for next track ::
268268
| |
269269
| V
270270
| +----------+
271-
| | |
272-
| |NEXT_TRACK|
273-
| | |
274-
| +----------+
275-
| |
271+
| compr_set_params() | |
272+
| +-----------|NEXT_TRACK|
273+
| | | |
274+
| | +--+-------+
275+
| | | |
276+
| +--------------+ |
276277
| |
277278
| | compr_partial_drain()
278279
| |

sound/core/compress_offload.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ snd_compr_set_params(struct snd_compr_stream *stream, unsigned long arg)
589589
struct snd_compr_params *params;
590590
int retval;
591591

592-
if (stream->runtime->state == SNDRV_PCM_STATE_OPEN) {
592+
if (stream->runtime->state == SNDRV_PCM_STATE_OPEN || stream->next_track) {
593593
/*
594594
* we should allow parameter change only when stream has been
595595
* opened not in other cases
@@ -612,6 +612,9 @@ snd_compr_set_params(struct snd_compr_stream *stream, unsigned long arg)
612612
if (retval)
613613
goto out;
614614

615+
if (stream->next_track)
616+
goto out;
617+
615618
stream->metadata_set = false;
616619
stream->next_track = false;
617620

0 commit comments

Comments
 (0)