Skip to content

Commit ed6c0f1

Browse files
committed
ipc4: handler: pipeline: Add support for eos state
Add support for setting the pipeline in the EOS state. Setting this state sets the except_eos flag in the pipeline, indicating that the end of data to be processed is expected. Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
1 parent 95ca17b commit ed6c0f1

2 files changed

Lines changed: 20 additions & 3 deletions

File tree

src/include/sof/audio/pipeline.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ struct pipeline {
6868
int32_t xrun_bytes; /* last xrun length */
6969
uint32_t status; /* pipeline status */
7070
struct tr_ctx tctx; /* trace settings */
71+
bool expect_eos; /* pipeline is expecting end of stream */
7172

7273
/* scheduling */
7374
struct task *pipe_task; /* pipeline processing task */

src/ipc/ipc4/handler.c

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,12 @@ int ipc4_pipeline_prepare(struct ipc_comp_dev *ppl_icd, uint32_t cmd)
287287

288288
switch (cmd) {
289289
case SOF_IPC4_PIPELINE_STATE_RUNNING:
290+
if (ppl_icd->pipeline->expect_eos) {
291+
ipc_cmd_err(&ipc_tr, "pipeline %d: Can't transition from EOS to RUNNING",
292+
ppl_icd->id);
293+
return IPC4_INVALID_REQUEST;
294+
}
295+
290296
/* init params when pipeline is complete or reset */
291297
switch (status) {
292298
case COMP_STATE_ACTIVE:
@@ -339,11 +345,15 @@ int ipc4_pipeline_prepare(struct ipc_comp_dev *ppl_icd, uint32_t cmd)
339345
}
340346

341347
break;
342-
/* special case- TODO */
343348
case SOF_IPC4_PIPELINE_STATE_EOS:
344-
if (status != COMP_STATE_ACTIVE)
349+
if (status != COMP_STATE_ACTIVE) {
350+
ipc_cmd_err(&ipc_tr, "pipeline %d: Invalid state for EOS: %d",
351+
ppl_icd->id, status);
345352
return IPC4_INVALID_REQUEST;
346-
COMPILER_FALLTHROUGH;
353+
}
354+
ppl_icd->pipeline->expect_eos = true;
355+
return 0; /* Must return here. Any other transition clears expect_eos. */
356+
/* special case - TODO */
347357
case SOF_IPC4_PIPELINE_STATE_SAVED:
348358
case SOF_IPC4_PIPELINE_STATE_ERROR_STOP:
349359
default:
@@ -354,6 +364,9 @@ int ipc4_pipeline_prepare(struct ipc_comp_dev *ppl_icd, uint32_t cmd)
354364

355365
if (ret < 0)
356366
return IPC4_INVALID_REQUEST;
367+
368+
ppl_icd->pipeline->expect_eos = false;
369+
357370
return ret;
358371
}
359372

@@ -417,6 +430,9 @@ int ipc4_pipeline_trigger(struct ipc_comp_dev *ppl_icd, uint32_t cmd, bool *dela
417430
}
418431

419432
break;
433+
case SOF_IPC4_PIPELINE_STATE_EOS:
434+
/* EOS handled in ipc4_pipeline_prepare */
435+
return 0;
420436
default:
421437
ipc_cmd_err(&ipc_tr, "pipeline %d: unsupported trigger cmd: %d",
422438
ppl_icd->id, cmd);

0 commit comments

Comments
 (0)