Skip to content

Commit

Permalink
mixer: remove buffer_acquire from mixer
Browse files Browse the repository at this point in the history
remove buffer ops from mixer modules

this is a continuation of changes
from commit 4a03699

Signed-off-by: Tobiasz Dryjanski <[email protected]>
  • Loading branch information
tobonex authored and kv2019i committed Sep 21, 2023
1 parent f87fa4d commit a025600
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions src/audio/mixer/mixer.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,11 @@ static int mixer_reset(struct processing_module *mod)
/* FIXME: this is racy and implicitly protected by serialised IPCs */
struct comp_buffer *source = container_of(blist, struct comp_buffer,
sink_list);
struct comp_buffer *source_c = buffer_acquire(source);
bool stop = false;

if (source_c->source && source_c->source->state > COMP_STATE_READY)
if (source->source && source->source->state > COMP_STATE_READY)
stop = true;

buffer_release(source_c);
/* only mix the sources with the same state with mixer */
if (stop)
/* should not reset the downstream components */
Expand Down Expand Up @@ -224,22 +222,18 @@ static int mixer_prepare(struct processing_module *mod,
struct sof_sink **sinks, int num_of_sinks)
{
struct mixer_data *md = module_get_private_data(mod);
struct comp_buffer *sink_c;
struct comp_dev *dev = mod->dev;
struct comp_buffer *sink;
struct list_item *blist;

sink = list_first_item(&dev->bsink_list, struct comp_buffer,
source_list);
sink_c = buffer_acquire(sink);
md->mix_func = mixer_get_processing_function(dev, sink_c);
mixer_set_frame_alignment(&sink_c->stream);
buffer_release(sink_c);
md->mix_func = mixer_get_processing_function(dev, sink);
mixer_set_frame_alignment(&sink->stream);

/* check each mixer source state */
list_for_item(blist, &dev->bsource_list) {
struct comp_buffer *source;
struct comp_buffer *source_c;
bool stop;

/*
Expand All @@ -251,11 +245,9 @@ static int mixer_prepare(struct processing_module *mod,
* done.
*/
source = container_of(blist, struct comp_buffer, sink_list);
source_c = buffer_acquire(source);
mixer_set_frame_alignment(&source_c->stream);
stop = source_c->source && (source_c->source->state == COMP_STATE_PAUSED ||
source_c->source->state == COMP_STATE_ACTIVE);
buffer_release(source_c);
mixer_set_frame_alignment(&source->stream);
stop = source->source && (source->source->state == COMP_STATE_PAUSED ||
source->source->state == COMP_STATE_ACTIVE);

/* only prepare downstream if we have no active sources */
if (stop)
Expand Down

0 comments on commit a025600

Please sign in to comment.