-
Notifications
You must be signed in to change notification settings - Fork 300
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
module_adapter: fix buffer consumption logic in simple_copy mode #6909
Closed
kv2019i
wants to merge
1
commit into
thesofproject:main
from
kv2019i:202301-modadapter-buffer-consume-fix
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this still problematic? Now you've got the wrong consumed value right? What we need to do instead is iterate through 0 -> num_source_buffers and skip those with a different state isnt it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ranj063 I'm open to better ways to do this, but wanted to keep this small to avoid conflicts with your #6836 (but I think we are anyways conflicting already).
But. but. I think this is right. The module process sees "num_input_buffers" of input buffers and reports consumed on each of them. In this loop, we iteratate over these buffers using "mod_input". The "i" variable goes over all bsources.
The consumed is updated in module_process() using the "mod->input_buffers, num_input_buffers" passed as inputs. Thus to pair right source with consumed value, we need to use "input_buffers[mod_input].consumed" as that's the buffer we passed for source "source_c[i]" and specific "i != mod_input" when any sources are skipped.
I can see values of 3+ million bytes passed as argument to comp_update_buffer_consume() when I run pause-resume tests on current main with current code and this PR fixes that. With asserts not enabled, this just silently leads to undefined behaviours.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ranj063 This is mimicking the loop on L650, but we can't do the state check here again as the state might have changed (unlikely but would be a very hard to debug problem), and rather we should stick to the decision we do on L655. If a bsource is skipped, we ignore it when calling the consume after process as well.