asoc: compress: support gapless playback in GKI mode

Next track gapless mode requires stream state of running. Set
stream state to running after partial buffer, EOS and zero buffer.

Change-Id: I61e55989305cd495a9a03306ccecdd62b4f7504f
Signed-off-by: xsang <xsang@codeaurora.org>
This commit is contained in:
xsang 2020-11-24 23:22:36 +08:00
parent 27e52b9f18
commit 20ad21c0b3

View File

@ -711,6 +711,11 @@ static void compr_event_handler(uint32_t opcode,
pr_debug("%s: issue CMD_RUN", __func__); pr_debug("%s: issue CMD_RUN", __func__);
q6asm_run_nowait(prtd->audio_client, 0, 0, 0); q6asm_run_nowait(prtd->audio_client, 0, 0, 0);
snd_compr_drain_notify(cstream); snd_compr_drain_notify(cstream);
/*
* Next track requires state of running. Otherwise,
* it fails.
*/
cstream->runtime->state = SNDRV_PCM_STATE_RUNNING;
spin_unlock_irqrestore(&prtd->lock, flags); spin_unlock_irqrestore(&prtd->lock, flags);
break; break;
} }
@ -2550,9 +2555,7 @@ static int msm_compr_trigger(struct snd_compr_stream *cstream, int cmd)
struct audio_client *ac = prtd->audio_client; struct audio_client *ac = prtd->audio_client;
unsigned long fe_id = rtd->dai_link->id; unsigned long fe_id = rtd->dai_link->id;
int rc = 0; int rc = 0;
#if IS_ENABLED(CONFIG_AUDIO_QGKI)
int bytes_to_write; int bytes_to_write;
#endif
unsigned long flags; unsigned long flags;
int stream_id; int stream_id;
uint32_t stream_index; uint32_t stream_index;
@ -2941,6 +2944,21 @@ static int msm_compr_trigger(struct snd_compr_stream *cstream, int cmd)
q6asm_run_nowait(prtd->audio_client, 0, 0, 0); q6asm_run_nowait(prtd->audio_client, 0, 0, 0);
} }
#else #else
if ((prtd->bytes_received > prtd->copied_total) &&
(prtd->bytes_received < runtime->fragment_size)) {
pr_debug("%s: send the only partial buffer to dsp\n",
__func__);
bytes_to_write = prtd->bytes_received
- prtd->copied_total;
if (bytes_to_write > 0) {
pr_debug("%s: send %d partial bytes at the end",
__func__, bytes_to_write);
atomic_set(&prtd->xrun, 0);
prtd->last_buffer = 1;
msm_compr_send_buffer(prtd);
}
}
atomic_set(&prtd->drain, 1); atomic_set(&prtd->drain, 1);
spin_unlock_irqrestore(&prtd->lock, flags); spin_unlock_irqrestore(&prtd->lock, flags);
#endif #endif