ASoc: msm: qdsp6v2: Fix timestamp glitch during gapless transition

Change conditions to query DSP for session time

Bug: 21633313
Change-Id: I7676d11747083eb35826c52abaa0de47f50032fc
Signed-off-by: Haynes Mathew George <hgeorge@codeaurora.org>
This commit is contained in:
Haynes Mathew George 2015-06-04 16:20:22 -07:00 committed by Gerrit - the friendly Code Review server
parent 9d9cf7636c
commit 3d90a144e7

View file

@ -1983,20 +1983,25 @@ static int msm_compr_pointer(struct snd_compr_stream *cstream,
gapless_transition = prtd->gapless_state.gapless_transition; gapless_transition = prtd->gapless_state.gapless_transition;
spin_unlock_irqrestore(&prtd->lock, flags); spin_unlock_irqrestore(&prtd->lock, flags);
if (gapless_transition)
pr_debug("%s session time in gapless transition",
__func__);
/* /*
Query timestamp from DSP if some data is with it. - Do not query if no buffer has been given.
This prevents timeouts. - Do not query on a gapless transition.
Playback for the 2nd stream can start (thus returning time
starting from 0) before the driver knows about EOS of first stream.
*/ */
if (!first_buffer || gapless_transition) {
if (gapless_transition) if (!first_buffer && !gapless_transition) {
pr_debug("%s session time in gapless transition",
__func__);
if (pdata->use_legacy_api) if (pdata->use_legacy_api)
rc = q6asm_get_session_time_legacy(prtd->audio_client, rc = q6asm_get_session_time_legacy(prtd->audio_client,
&timestamp); &prtd->marker_timestamp);
else else
rc = q6asm_get_session_time(prtd->audio_client, rc = q6asm_get_session_time(prtd->audio_client,
&timestamp); &prtd->marker_timestamp);
if (rc < 0) { if (rc < 0) {
pr_err("%s: Get Session Time return value =%lld\n", pr_err("%s: Get Session Time return value =%lld\n",
__func__, timestamp); __func__, timestamp);
@ -2005,9 +2010,8 @@ static int msm_compr_pointer(struct snd_compr_stream *cstream,
else else
return -EAGAIN; return -EAGAIN;
} }
} else {
timestamp = prtd->marker_timestamp;
} }
timestamp = prtd->marker_timestamp;
/* DSP returns timestamp in usec */ /* DSP returns timestamp in usec */
pr_debug("%s: timestamp = %lld usec\n", __func__, timestamp); pr_debug("%s: timestamp = %lld usec\n", __func__, timestamp);