Skip to content

Commit

Permalink
aria: configure stream params
Browse files Browse the repository at this point in the history
Configure in/out buffer stream params.
In Windows scenarios, unconfigured values were causing zero-division
exception in audio_stream_get_avail_frames.

Signed-off-by: Przemyslaw Blaszkowski <przemyslaw.blaszkowski@intel.com>
  • Loading branch information
pblaszko authored and lgirdwood committed Mar 21, 2023
1 parent c27c5df commit 332dd4a
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/audio/aria/aria.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,12 +215,36 @@ static void aria_free(struct comp_dev *dev)
rfree(dev);
}

static void aria_set_stream_params(struct comp_buffer *buffer, struct aria_data *cd)
{
struct comp_buffer __sparse_cache *buffer_c;

buffer_c = buffer_acquire(buffer);
buffer_c->stream.channels = cd->chan_cnt;
buffer_c->stream.rate = cd->base.audio_fmt.sampling_frequency;
buffer_c->buffer_fmt = cd->base.audio_fmt.interleaving_style;
audio_stream_fmt_conversion(cd->base.audio_fmt.depth,
cd->base.audio_fmt.valid_bit_depth,
&buffer_c->stream.frame_fmt,
&buffer_c->stream.valid_sample_fmt,
cd->base.audio_fmt.s_type);
buffer_release(buffer_c);
}

static int aria_prepare(struct comp_dev *dev)
{
int ret;
struct comp_buffer *source, *sink;
struct aria_data *cd = comp_get_drvdata(dev);

comp_info(dev, "aria_prepare()");

source = list_first_item(&dev->bsource_list, struct comp_buffer, sink_list);
aria_set_stream_params(source, cd);

sink = list_first_item(&dev->bsink_list, struct comp_buffer, source_list);
aria_set_stream_params(sink, cd);

if (dev->state == COMP_STATE_ACTIVE) {
comp_info(dev, "aria_prepare(): Component is in active state.");
return 0;
Expand Down

0 comments on commit 332dd4a

Please sign in to comment.