mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-07-19 09:39:15 +00:00
libobs: Fix logging of remaining views
OBS has been logging `1 views remain at shutdown` when in reality there are not technically any views remaining. When views are removed, the view itself is destroyed immediately, but the mix remains, to be garbage collected by the graphics thread. In this case, the view has already been removed, but the graphics thread has not run an interation and cleaned up the mix, so this log message appears. Fixes the issue by checking if a mix actually has an assigned view, instead of blindly logging existing mixes.
This commit is contained in:
parent
c69e40734d
commit
25df3e183e
13
libobs/obs.c
13
libobs/obs.c
|
@ -774,13 +774,16 @@ void obs_free_video_mix(struct obs_core_video_mix *video)
|
|||
static void obs_free_video(void)
|
||||
{
|
||||
pthread_mutex_lock(&obs->video.mixes_mutex);
|
||||
size_t num = obs->video.mixes.num;
|
||||
if (num)
|
||||
blog(LOG_WARNING, "%zu views remain at shutdown", num);
|
||||
for (size_t i = 0; i < num; i++) {
|
||||
obs_free_video_mix(obs->video.mixes.array[i]);
|
||||
size_t num_views = 0;
|
||||
for (size_t i = 0; i < obs->video.mixes.num; i++) {
|
||||
struct obs_core_video_mix *video = obs->video.mixes.array[i];
|
||||
if (video && video->view)
|
||||
num_views++;
|
||||
obs_free_video_mix(video);
|
||||
obs->video.mixes.array[i] = NULL;
|
||||
}
|
||||
if (num_views > 0)
|
||||
blog(LOG_WARNING, "Number of remaining views: %ld", num_views);
|
||||
pthread_mutex_unlock(&obs->video.mixes_mutex);
|
||||
|
||||
pthread_mutex_destroy(&obs->video.mixes_mutex);
|
||||
|
|
Loading…
Reference in a new issue