-
Notifications
You must be signed in to change notification settings - Fork 16
Enhance GIL management and error handling in resampling #31
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
base: master
Are you sure you want to change the base?
Conversation
acquire GIL for execution of callback
attempt to fix exception handling on windows, not tested
Release GIL while resampling
Python bump up
Increase expected size of output sample buffer, to correctly handle input termination
|
For reference this is the results of the asyncio and threading test on my local machine. Looking at #32 which has same tests on same machine at (about) the same time the headlines from this PR is:
|
fakufaku
left a comment
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.
This looks pretty good to me. Please just sync with master.
Would it make sense to combine this with your other PR that contains the tests?
| matrix: | ||
| os: [ubuntu-latest, macos-latest, windows-latest] | ||
| python-version: [3.8, 3.9, "3.10", "3.11", "3.12"] | ||
| python-version: [3.9, "3.10", "3.11", "3.12", "3.13", "3.14"] |
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.
This has been merged already. Could you please sync with master?
| #endif | ||
|
|
||
| // This value was empirically and somewhat arbitrarily chosen; increase it for further safety. | ||
| #define END_OF_INPUT_EXTRA_OUTPUT_FRAMES 10000 |
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.
Could you please add some more details about what this constant controls?
| // be more than the expected number of output samples during mid-stream | ||
| // steady-state processing. (Also, when the stream is started, the number | ||
| // of output samples generated will generally be zero or otherwise less | ||
| // than the number of samples in mid-stream processing.) |
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.
Is there a maximum we could expect?
| output.resize(out_shape); | ||
| } else if ((size_t)output_frames_gen >= new_size) { | ||
| // This means our fudge factor is too small. | ||
| throw std::runtime_error("Generated more output samples than expected!"); |
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.
Rather than failing, is it possible to truncate the output?
Improve GIL management during resampling operations to prevent blocking and enhance performance. Update error handling to manage exceptions more effectively, particularly in callback scenarios. Adjust the expected output size to accommodate additional frames introduced by #22 and remove support for Python 3.8. Update license specification format.
The latter changes are from existing community PRs that have already been merged.