summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Peng <robinpeng@google.com>2022-07-06 09:41:34 +0000
committerRobin Peng <robinpeng@google.com>2022-07-06 09:41:34 +0000
commitfcd8a7a7a9f582d81fe227c81f72968524aef9ce (patch)
tree8b5eb0fc41a5422836a8306e2bf888149707f70b
parent5f66b981206151b5f7241136b862c0cc7cb48a08 (diff)
parent5ccd15e452802d57f7f1d4ad91508ebb0967270c (diff)
downloadaoc-fcd8a7a7a9f582d81fe227c81f72968524aef9ce.tar.gz
Merge "Merge android13-gs-pixel-5.10-tm-d1 into android13-gs-pixel-5.10-tm-qpr1" into android13-gs-pixel-5.10-tm-qpr1
-rwxr-xr-xalsa/aoc_alsa.h1
-rw-r--r--alsa/aoc_alsa_compr.c15
2 files changed, 14 insertions, 2 deletions
diff --git a/alsa/aoc_alsa.h b/alsa/aoc_alsa.h
index 38cc3ac..3c0fc5c 100755
--- a/alsa/aoc_alsa.h
+++ b/alsa/aoc_alsa.h
@@ -267,6 +267,7 @@ struct aoc_alsa_stream {
int compr_offload_codec;
int gapless_offload_enable;
int send_metadata;
+ int eof_reach;
uint32_t compr_padding;
uint32_t compr_delay;
uint64_t compr_pcm_io_sample_base;
diff --git a/alsa/aoc_alsa_compr.c b/alsa/aoc_alsa_compr.c
index 3fc4843..a66fb1e 100644
--- a/alsa/aoc_alsa_compr.c
+++ b/alsa/aoc_alsa_compr.c
@@ -119,7 +119,7 @@ void aoc_compr_offload_isr(struct aoc_service_dev *dev)
if (alsa_stream->gapless_offload_enable) {
pr_info("compress offload gapless ring buffer is depleted\n");
snd_compr_drain_notify(alsa_stream->cstream);
- aoc_compr_reset_pointer(alsa_stream);
+ alsa_stream->eof_reach = 1;
return;
}
}
@@ -127,7 +127,7 @@ void aoc_compr_offload_isr(struct aoc_service_dev *dev)
if (aoc_ring_bytes_available_to_read(dev->service, AOC_DOWN) == 0) {
pr_info("compress offload ring buffer is depleted\n");
snd_compr_drain_notify(alsa_stream->cstream);
- aoc_compr_reset_pointer(alsa_stream);
+ alsa_stream->eof_reach = 1;
return;
}
@@ -360,6 +360,7 @@ static int aoc_compr_playback_open(struct snd_compr_stream *cstream)
alsa_stream->compr_padding = COMPR_INVALID_METADATA;
alsa_stream->compr_delay = COMPR_INVALID_METADATA;
alsa_stream->send_metadata = 1;
+ alsa_stream->eof_reach = 0;
alsa_stream->gapless_offload_enable = chip->gapless_offload_enable;
err = aoc_audio_open(alsa_stream);
@@ -689,6 +690,16 @@ static int aoc_compr_set_metadata(struct snd_soc_component *component,
int ret = 0;
pr_debug("%s %pK, %pK\n", __func__, runtime, metadata);
+ /* clear pointer for gapless offload playback, call sequence should be:
+ * receive EOF -> notify EOF to ap -> ap set_metadata for next track
+ * -> ap write buffer for next track -> write metadata to aoc ->
+ * write next track buffer to aoc.
+ * Reset buffer pointer when ap set_metadata for next track.
+ */
+ if (alsa_stream->eof_reach) {
+ alsa_stream->eof_reach = 0;
+ aoc_compr_reset_pointer(alsa_stream);
+ }
if (metadata->key == SNDRV_COMPRESS_ENCODER_PADDING) {
alsa_stream->compr_padding = metadata->value[0];