From 968eaf162156aca3ba53f5331a91a7efb000d871 Mon Sep 17 00:00:00 2001 From: Keyon Jie Date: Sat, 30 May 2020 01:25:00 +0800 Subject: [PATCH] pipeline: add a flag to indicate if the buffer is being traversed Add a flag 'walking' to the buffer struct, to indicate if the buffer is just being traversed while walking through the graph, and don't go back to the buffer which is already walked. Signed-off-by: Keyon Jie --- src/audio/pipeline.c | 6 ++++++ src/include/sof/audio/buffer.h | 1 + 2 files changed, 7 insertions(+) diff --git a/src/audio/pipeline.c b/src/audio/pipeline.c index 1c255f4b9..d5f393a98 100644 --- a/src/audio/pipeline.c +++ b/src/audio/pipeline.c @@ -169,6 +169,10 @@ static int pipeline_for_each_comp(struct comp_dev *current, list_for_item(clist, buffer_list) { buffer = buffer_from_list(clist, struct comp_buffer, dir); + /* don't go back to the buffer which already walked */ + if (buffer->walking) + continue; + /* execute operation on buffer */ if (ctx->buff_func) ctx->buff_func(buffer, ctx->buff_data); @@ -182,8 +186,10 @@ static int pipeline_for_each_comp(struct comp_dev *current, /* continue further */ if (ctx->comp_func) { + buffer->walking = true; int err = ctx->comp_func(buffer_comp, buffer, ctx, dir); + buffer->walking = false; if (err < 0) return err; } diff --git a/src/include/sof/audio/buffer.h b/src/include/sof/audio/buffer.h index acd2e151c..5339dbcc7 100644 --- a/src/include/sof/audio/buffer.h +++ b/src/include/sof/audio/buffer.h @@ -111,6 +111,7 @@ struct comp_buffer { uint16_t chmap[SOF_IPC_MAX_CHANNELS]; /**< channel map - SOF_CHMAP_ */ bool hw_params_configured; /**< indicates whether hw params were set */ + bool walking; /**< indicates if the buffer is being walking */ }; struct buffer_cb_transact {