mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-08-29 02:03:03 +08:00
libobs: Fix race condition
It is possible for a GPU encoder to be in a destruction state while still in the GPU encoder list, although very rare.
This commit is contained in:
@@ -58,9 +58,10 @@ static void *gpu_encode_thread(void *unused)
|
||||
video_output_inc_texture_frames(video->video);
|
||||
|
||||
for (size_t i = 0; i < video->gpu_encoders.num; i++) {
|
||||
obs_encoder_t *encoder = video->gpu_encoders.array[i];
|
||||
da_push_back(encoders, &encoder);
|
||||
obs_encoder_addref(encoder);
|
||||
obs_encoder_t *encoder = obs_encoder_get_ref(
|
||||
video->gpu_encoders.array[i]);
|
||||
if (encoder)
|
||||
da_push_back(encoders, &encoder);
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&video->gpu_encoder_mutex);
|
||||
|
||||
Reference in New Issue
Block a user