Skip to content

Commit f396500

Browse files
committed
pipeline: allow render pipeline to recover from xrun
Fixes pipeline's ability to recover from xrun for render streams. Normally for render the ppl task is scheduled after trigger start, but in this case trigger start is done on current's task level. Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
1 parent 748aad9 commit f396500

1 file changed

Lines changed: 30 additions & 13 deletions

File tree

src/audio/pipeline.c

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,6 +1061,22 @@ void pipeline_xrun(struct pipeline *p, struct comp_dev *dev,
10611061
}
10621062
}
10631063

1064+
/* copy data from upstream source endpoints to downstream endpoints*/
1065+
static int pipeline_copy(struct comp_dev *dev)
1066+
{
1067+
int err;
1068+
1069+
err = pipeline_copy_from_upstream(dev, dev);
1070+
if (err < 0)
1071+
return err;
1072+
1073+
err = pipeline_copy_to_downstream(dev, dev);
1074+
if (err < 0)
1075+
return err;
1076+
1077+
return 0;
1078+
}
1079+
10641080
/* recover the pipeline from a XRUN condition */
10651081
static int pipeline_xrun_recover(struct pipeline *p)
10661082
{
@@ -1090,6 +1106,17 @@ static int pipeline_xrun_recover(struct pipeline *p)
10901106
return ret;
10911107
}
10921108

1109+
/* for playback copy it here, because scheduling won't work
1110+
* on this interrupt level
1111+
*/
1112+
if (p->sched_comp->params.direction == SOF_IPC_STREAM_PLAYBACK) {
1113+
ret = pipeline_copy(p->sched_comp);
1114+
if (ret < 0) {
1115+
trace_pipe_error("px3");
1116+
return ret;
1117+
}
1118+
}
1119+
10931120
return 0;
10941121
}
10951122

@@ -1125,25 +1152,15 @@ static void pipeline_task(void *arg)
11251152
if (p->xrun_bytes) {
11261153
err = pipeline_xrun_recover(p);
11271154
if (err < 0)
1128-
return; /* failed - host will stop this pipeline */
1129-
goto sched;
1130-
}
1131-
1132-
/* copy data from upstream source endpoints to downstream endpoints */
1133-
err = pipeline_copy_from_upstream(dev, dev);
1134-
if (err < 0) {
1135-
err = pipeline_xrun_recover(p);
1136-
if (err < 0)
1137-
return; /* failed - host will stop this pipeline */
1155+
return; /* failed - host will stop this pipeline */
11381156
goto sched;
11391157
}
11401158

1141-
err = pipeline_copy_to_downstream(dev, dev);
1159+
err = pipeline_copy(dev);
11421160
if (err < 0) {
11431161
err = pipeline_xrun_recover(p);
11441162
if (err < 0)
1145-
return; /* failed - host will stop this pipeline */
1146-
goto sched;
1163+
return; /* failed - host will stop this pipeline */
11471164
}
11481165

11491166
sched:

0 commit comments

Comments
 (0)