Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2c94a5ea authored by Sharad Sangle's avatar Sharad Sangle
Browse files

ASOC: qdsp6:Add pause/resume support for AAC encoder



-  If session is stopped, AUDIO_START should
   trigger session to be started again. This way
   pause/resume becomes stop/start for AAC encoder

Change-Id: Id44a5342bb90b049d9c617ede60bf41a5289c581
Signed-off-by: default avatarSharad Sangle <assangle@codeaurora.org>
parent 4411c560
Loading
Loading
Loading
Loading
+32 −5
Original line number Diff line number Diff line
@@ -58,12 +58,39 @@ static long aac_in_ioctl(struct file *file,
			break;
		}

		if (audio->opened) {
			rc = audio_in_buf_alloc(audio);
			if (rc < 0) {
				pr_err("%s:session id %d: buffer allocation failed\n",
					 __func__, audio->ac->session);
				break;
			}
		} else {
			if (audio->feedback == NON_TUNNEL_MODE) {
				pr_debug("%s: starting in non_tunnel mode",
					__func__);
				rc = q6asm_open_read_write(audio->ac,
					FORMAT_MPEG4_AAC, FORMAT_LINEAR_PCM);
				if (rc < 0) {
					pr_err("%s:open read write failed\n",
						__func__);
					break;
				}
			}
			if (audio->feedback == TUNNEL_MODE) {
				pr_debug("%s: starting in tunnel mode",
					__func__);
				rc = q6asm_open_read(audio->ac,
							FORMAT_MPEG4_AAC);

				if (rc < 0) {
					pr_err("%s:open read failed\n",
							__func__);
					break;
				}
			}
			audio->stopped = 0;
		}

		pr_debug("%s:sbr_ps_flag = %d, sbr_flag = %d\n", __func__,
			aac_config->sbr_ps_on_flag, aac_config->sbr_on_flag);
+14 −10
Original line number Diff line number Diff line
@@ -260,6 +260,7 @@ long audio_in_ioctl(struct file *file,
		}
		audio->str_cfg.buffer_size = cfg.buffer_size;
		audio->str_cfg.buffer_count = cfg.buffer_count;
		if (audio->opened) {
			rc = q6asm_audio_client_buf_alloc(OUT, audio->ac,
				ALIGN_BUF_SIZE(audio->str_cfg.buffer_size),
				audio->str_cfg.buffer_count);
@@ -269,6 +270,7 @@ long audio_in_ioctl(struct file *file,
			rc = -ENOMEM;
			break;
			}
		}
		audio->buf_alloc |= BUF_ALLOC_OUT;
		rc = 0;
		pr_debug("%s:session id %d: AUDIO_SET_STREAM_CONFIG %d %d\n",
@@ -349,6 +351,7 @@ long audio_in_ioctl(struct file *file,
		audio->pcm_cfg.buffer_size  = cfg.buffer_size;
		audio->pcm_cfg.channel_count = cfg.channel_count;
		audio->pcm_cfg.sample_rate = cfg.sample_rate;
		if (audio->opened && audio->feedback == NON_TUNNEL_MODE) {
			rc = q6asm_audio_client_buf_alloc(IN, audio->ac,
				ALIGN_BUF_SIZE(audio->pcm_cfg.buffer_size),
				audio->pcm_cfg.buffer_count);
@@ -358,6 +361,7 @@ long audio_in_ioctl(struct file *file,
				rc = -ENOMEM;
				break;
			}
		}
		audio->buf_alloc |= BUF_ALLOC_IN;
		rc = 0;
		pr_debug("%s:session id %d: AUDIO_SET_CONFIG %d %d\n", __func__,