Re: [PATCH v2 8/9] ASoC: qdsp6-dai: add gapless support

From: Pierre-Louis Bossart
Date: Wed Jul 22 2020 - 11:39:25 EST





@@ -917,6 +1018,14 @@ static int q6asm_dai_compr_trigger(struct snd_soc_component *component,
ÂÂÂÂÂÂÂÂÂ ret = q6asm_cmd_nowait(prtd->audio_client, prtd->stream_id,
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ CMD_PAUSE);
ÂÂÂÂÂÂÂÂÂ break;
+ÂÂÂ case SND_COMPR_TRIGGER_NEXT_TRACK:
+ÂÂÂÂÂÂÂ prtd->next_track = true;
+ÂÂÂÂÂÂÂ prtd->next_track_stream_id = (prtd->stream_id == 1 ? 2 : 1);

it's rather odd, the initialization above uses next_track_stream_id = 0?

Vaild stream ids start from 1, So we are toggling this between 1 and 2.
So when we set next_track_stream_id to 0, that means we have opened the new next stream id and is set to prtd->stream_id. This logic is to ensure that we are not going to open next stream id twice!

ok, adding a comment would be good to show this was intentional and not a mistake.