-
Notifications
You must be signed in to change notification settings - Fork 112
addref to obs_source_t* before getProperties #1701
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 |
|---|---|---|
|
|
@@ -591,6 +591,37 @@ describe(testName, () => { | |
| }); | ||
| }); | ||
|
|
||
| it('Get properties of browser source while releasing concurrently does not crash', async function() { | ||
| if (obs.skipSource(EOBSInputTypes.BrowserSource)) { this.skip(); } // Skip if browser source is not supported | ||
| const iterations = 20; | ||
| const promises: Promise<void>[] = []; | ||
|
|
||
| for (let i = 0; i < iterations; i++) { | ||
| const input = osn.InputFactory.create(EOBSInputTypes.BrowserSource, 'browser_concurrent_' + i); | ||
| expect(input).to.not.equal(undefined, GetErrorMessage(ETestErrorMsg.CreateInput, EOBSInputTypes.BrowserSource)); | ||
|
|
||
|
sandboxcoder marked this conversation as resolved.
|
||
| // Race getProperties against release on separate async ticks | ||
| const getProps = new Promise<void>(resolve => { | ||
| setImmediate(() => { | ||
| try { input.properties; } catch (_) {} | ||
| resolve(); | ||
| }); | ||
| }); | ||
|
|
||
| const releaseSource = new Promise<void>(resolve => { | ||
| setImmediate(() => { | ||
| try { input.release(); } catch (_) {} | ||
| resolve(); | ||
| }); | ||
| }); | ||
|
|
||
| promises.push(getProps, releaseSource); | ||
| } | ||
|
|
||
| // If the race condition is present, one of these will crash the OBS server process | ||
| await Promise.all(promises); | ||
|
Comment on lines
+594
to
+622
Contributor
Author
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 true, it appears this is mostly a stress test in its' current form. Would likely need to convert this into a C++ Catch2 test
Contributor
Author
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. Will hopefully be resolved by #1706 |
||
| }); | ||
|
|
||
| it('Set enabled and get it for all filter types', () => { | ||
| obs.filterTypes.forEach(function(filterType) { | ||
| logInfo(testName, 'Testing filter type: ' + filterType); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
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.
good suggestion. However,
osn::Source::Manageris a generic Singleton container. This suggestion means the ref counting belongs at the container level where we increment the ref count upon assignment (actually, the suggestion actually means just add a newfindStrongReffunction)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.
Actually I do not think I need to add this since
OBSSourceshould implicitly handle this.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.
Addressed here: #1707