Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions test/cmocka/test_ws_remove_input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

/* The C++ headers come before cmocka.h: its macros break libstdc++. */
#include <cstdio>
#include <cstring>
#include <exception>
#include <string>

Expand Down Expand Up @@ -146,6 +147,13 @@ static int case_setup(void **)
if (!scene_a || !scene_b || !input) {
return -1;
}
/* libobs renames an input whose name is in use. RemoveInput then finds
* a leftover from the last case instead of this input. */
if (strcmp(obs_source_get_name(input), "ws remove input") != 0) {
fprintf(stderr, "input is named '%s': a source of the last case is still alive\n",
obs_source_get_name(input));
return -1;
}
obs_scene_add(scene_a, input);
obs_scene_add(scene_b, input);
return 0;
Expand All @@ -166,6 +174,12 @@ static int case_teardown(void **)
obs_source_remove(input);
obs_source_release(input);
input = nullptr;
/* libobs destroys sources on its destruction thread. Destroying a scene
* queues the destruction of its items' sources behind the wait marker,
* so wait until a pass processes nothing, as obs_shutdown() does. The
* next case can then use the same names. */
while (obs_wait_for_destroy_queue())
;
return 0;
}

Expand Down
Loading