-
Notifications
You must be signed in to change notification settings - Fork 350
Audio: Mux: Fix mistake in frames count handling #7811
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -527,18 +527,24 @@ static int mux_process(struct processing_module *mod, | |
| struct comp_buffer __sparse_cache *source_c; | ||
| struct list_item *clist; | ||
| const struct audio_stream __sparse_cache *sources_stream[MUX_MAX_STREAMS] = { NULL }; | ||
| int frames; | ||
| int frames = 0; | ||
| int sink_bytes; | ||
| int source_bytes; | ||
| int i; | ||
| int i, j; | ||
|
|
||
| comp_dbg(dev, "mux_process()"); | ||
|
|
||
| /* align source streams with their respective configurations */ | ||
| j = 0; | ||
| list_for_item(clist, &dev->bsource_list) { | ||
| source = container_of(clist, struct comp_buffer, sink_list); | ||
| source_c = buffer_acquire(source); | ||
| if (source_c->source->state == dev->state) { | ||
| if (frames) | ||
| frames = MIN(frames, input_buffers[j].size); | ||
| else | ||
| frames = input_buffers[j].size; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is rather odd, why not initialize frame to MAX_INT and do the line 544 unconditionally?
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @plbossart This was in previous version of the patch, but bsource_list may be empty in which case we'd end up with frames==MAX_INT |
||
|
|
||
| i = get_stream_index(dev, cd, source_c->pipeline_id); | ||
| /* return if index wrong */ | ||
| if (i < 0) { | ||
|
|
@@ -549,13 +555,13 @@ static int mux_process(struct processing_module *mod, | |
| sources_stream[i] = &source_c->stream; | ||
| } | ||
| buffer_release(source_c); | ||
| j++; | ||
| } | ||
|
|
||
| /* check if there are any sources active */ | ||
| if (num_input_buffers == 0) | ||
| return 0; | ||
|
|
||
| frames = input_buffers[0].size; | ||
| source_bytes = frames * audio_stream_frame_bytes(mod->input_buffers[0].data); | ||
| sink_bytes = frames * audio_stream_frame_bytes(mod->output_buffers[0].data); | ||
| mux_prepare_active_look_up(cd, output_buffers[0].data, &sources_stream[0]); | ||
|
|
@@ -564,7 +570,16 @@ static int mux_process(struct processing_module *mod, | |
| cd->mux(dev, output_buffers[0].data, &sources_stream[0], frames, &cd->active_lookup); | ||
|
|
||
| /* Update consumed and produced */ | ||
| mod->input_buffers[0].consumed = source_bytes; | ||
| j = 0; | ||
| list_for_item(clist, &dev->bsource_list) { | ||
| source = container_of(clist, struct comp_buffer, sink_list); | ||
| source_c = buffer_acquire(source); | ||
| if (source_c->source->state == dev->state) | ||
| mod->input_buffers[j].consumed = source_bytes; | ||
|
|
||
| buffer_release(source_c); | ||
| j++; | ||
| } | ||
| mod->output_buffers[0].size = sink_bytes; | ||
| return 0; | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.