Skip to content
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

Export Comms and Render Dialog fixes #202

Merged
merged 11 commits into from
Jun 14, 2022
Merged

Export Comms and Render Dialog fixes #202

merged 11 commits into from
Jun 14, 2022

Conversation

firthm01
Copy link
Collaborator

@firthm01 firthm01 commented May 31, 2022

This PR combines the comms-fixes and render-dialog-fixes branches (latter is based off the former)

Export Comms Fixes

Problem: Hang on OSX when trying to render after instantiating either an ADM Export Source or EAR Scene plugin after another EAR Scene.
Issue: It seems that an nng_listen on POSIX systems for a REQ-REP connection will return an NNG_EADDRINUSE if the address is being used (as expected) but in the process it disrupts the connection already on there. No messages are delivered on that connection anymore and they don't even time out - just hang.
Fix: For posix since it's all based around the filesystem, we can just do a stat to see if the address is in use without disturbing it.

Sub-problem: "Command" addresses are not being reused once released.
Issue: Sockets not destroyed
Fix: Destroy socket in Processor destructor

Sub-problem: Reused "Command" addresses are not working after deleting and re-adding a Scene plugin
Issue: There is a NngSelfRegister mechanism which attempts to keep track of everything using NNG and calls nng_fini to clear up globals once all usages are gone. If you delete the final plugin using NNG, nng_fini is called. If you then launch a new plugin, the sockets are unresponsive.
Fix: Don't bother with NngSelfRegister and nng_fini - it's not necessary anyway: https://github.com/nanomsg/nng/blob/722bf4621703ef238fa81018f8c3e68bcef91354/include/nng/nng.h#L211 . I attempted to let the extension handle the nng_fini call, but you can't guarantee destruction order of extension and plugins, so can get some nasty crashes - just keep it simple and don't use nng_fini at all.

Render Dialog Fixes

Problem: Getting a crash deep down in free() sometimes on windows when exiting REAPER. Long-term problem but hasn't caused any real problem since it's on exit.
Issue: Came down to the overly complex singleton pattern in render dialog code.
Fix: Didn't bother figuring out why it wasn't working - just replaced with a much simpler pattern which fixed it anyway.

Problem: Tested with REAPER v6.58 and there are some new Render options not applicable to OBA. They needed disabling.
Fix: Disable options using existing control look-up code and OS API (or via SWELL) calls.

@firthm01 firthm01 requested a review from rsjbailey May 31, 2022 10:43
firthm01 added 11 commits June 14, 2022 12:19
Attempting to listen to see if free will just disrupt comms on anything already using the socket. Just stat it instead.
When all plugins destroyed, nng_fini is called via NngSelfRegister and NngFinaliser. However, this means if new plugins are then instantiated, the NNG globals on the heap have already been cleared down, and the new plugins can not communicate!
Led to occasional crash in free()
We can't guarantee destruction order of extension and plugins, so can cause a hang (this is why it was disabled originally)
nng_fini isn't necessary anyway according to docs
Irrelevant - we can only render at project sample rate anyway due to how audio comms works
will not work for our system as normalisation would be applied to sink feed and we don't use the sink feed anyway
Causes mismatch between received blocks and expected received blocks of audio. Can't imagine it's of much use anyway.
@rsjbailey rsjbailey force-pushed the render-dialog-fixes branch from c38e740 to d4b5943 Compare June 14, 2022 14:05
@rsjbailey rsjbailey merged commit e5a3ab5 into main Jun 14, 2022
@firthm01 firthm01 deleted the render-dialog-fixes branch October 17, 2022 14:17
@firthm01 firthm01 restored the render-dialog-fixes branch October 17, 2022 14:21
@firthm01 firthm01 deleted the render-dialog-fixes branch October 17, 2022 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants