Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pipeline: allow render pipeline to recover from xrun #125

Merged
merged 1 commit into from
Jul 18, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 30 additions & 13 deletions src/audio/pipeline.c
Original file line number Diff line number Diff line change
Expand Up @@ -1061,6 +1061,22 @@ void pipeline_xrun(struct pipeline *p, struct comp_dev *dev,
}
}

/* copy data from upstream source endpoints to downstream endpoints*/
static int pipeline_copy(struct comp_dev *dev)
{
int err;

err = pipeline_copy_from_upstream(dev, dev);
if (err < 0)
return err;

err = pipeline_copy_to_downstream(dev, dev);
if (err < 0)
return err;

return 0;
}

/* recover the pipeline from a XRUN condition */
static int pipeline_xrun_recover(struct pipeline *p)
{
Expand Down Expand Up @@ -1090,6 +1106,17 @@ static int pipeline_xrun_recover(struct pipeline *p)
return ret;
}

/* for playback copy it here, because scheduling won't work
* on this interrupt level
*/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So you mean you kept the schedule idle copy in the pipeline trigger start as it will never work there?
Thus this is some workaround for now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly. Also my comment is a little bit misleading. To be precised, schedule won't work, because scheduler doesn't allow to add to the list tasks, which are currently running.

if (p->sched_comp->params.direction == SOF_IPC_STREAM_PLAYBACK) {
ret = pipeline_copy(p->sched_comp);
if (ret < 0) {
trace_pipe_error("px3");
return ret;
}
}

return 0;
}

Expand Down Expand Up @@ -1125,25 +1152,15 @@ static void pipeline_task(void *arg)
if (p->xrun_bytes) {
err = pipeline_xrun_recover(p);
if (err < 0)
return; /* failed - host will stop this pipeline */
goto sched;
}

/* copy data from upstream source endpoints to downstream endpoints */
err = pipeline_copy_from_upstream(dev, dev);
if (err < 0) {
err = pipeline_xrun_recover(p);
if (err < 0)
return; /* failed - host will stop this pipeline */
return; /* failed - host will stop this pipeline */
goto sched;
}

err = pipeline_copy_to_downstream(dev, dev);
err = pipeline_copy(dev);
if (err < 0) {
err = pipeline_xrun_recover(p);
if (err < 0)
return; /* failed - host will stop this pipeline */
goto sched;
return; /* failed - host will stop this pipeline */
}

sched:
Expand Down