|
@@ -386,7 +386,6 @@ static int obs_init_video(struct obs_video_info *ovi)
|
|
{
|
|
{
|
|
struct obs_core_video *video = &obs->video;
|
|
struct obs_core_video *video = &obs->video;
|
|
struct video_output_info vi;
|
|
struct video_output_info vi;
|
|
- pthread_mutexattr_t attr;
|
|
|
|
int errorcode;
|
|
int errorcode;
|
|
|
|
|
|
make_video_info(&vi, ovi);
|
|
make_video_info(&vi, ovi);
|
|
@@ -420,10 +419,6 @@ static int obs_init_video(struct obs_video_info *ovi)
|
|
|
|
|
|
gs_leave_context();
|
|
gs_leave_context();
|
|
|
|
|
|
- if (pthread_mutexattr_init(&attr) != 0)
|
|
|
|
- return OBS_VIDEO_FAIL;
|
|
|
|
- if (pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE) != 0)
|
|
|
|
- return OBS_VIDEO_FAIL;
|
|
|
|
if (pthread_mutex_init(&video->gpu_encoder_mutex, NULL) < 0)
|
|
if (pthread_mutex_init(&video->gpu_encoder_mutex, NULL) < 0)
|
|
return OBS_VIDEO_FAIL;
|
|
return OBS_VIDEO_FAIL;
|
|
if (pthread_mutex_init(&video->task_mutex, NULL) < 0)
|
|
if (pthread_mutex_init(&video->task_mutex, NULL) < 0)
|
|
@@ -570,15 +565,9 @@ static bool obs_init_audio(struct audio_output_info *ai)
|
|
struct obs_core_audio *audio = &obs->audio;
|
|
struct obs_core_audio *audio = &obs->audio;
|
|
int errorcode;
|
|
int errorcode;
|
|
|
|
|
|
- pthread_mutexattr_t attr;
|
|
|
|
-
|
|
|
|
pthread_mutex_init_value(&audio->monitoring_mutex);
|
|
pthread_mutex_init_value(&audio->monitoring_mutex);
|
|
|
|
|
|
- if (pthread_mutexattr_init(&attr) != 0)
|
|
|
|
- return false;
|
|
|
|
- if (pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE) != 0)
|
|
|
|
- return false;
|
|
|
|
- if (pthread_mutex_init(&audio->monitoring_mutex, &attr) != 0)
|
|
|
|
|
|
+ if (pthread_mutex_init_recursive(&audio->monitoring_mutex) != 0)
|
|
return false;
|
|
return false;
|
|
|
|
|
|
audio->user_volume = 1.0f;
|
|
audio->user_volume = 1.0f;
|
|
@@ -628,30 +617,25 @@ static void obs_free_audio(void)
|
|
static bool obs_init_data(void)
|
|
static bool obs_init_data(void)
|
|
{
|
|
{
|
|
struct obs_core_data *data = &obs->data;
|
|
struct obs_core_data *data = &obs->data;
|
|
- pthread_mutexattr_t attr;
|
|
|
|
|
|
|
|
assert(data != NULL);
|
|
assert(data != NULL);
|
|
|
|
|
|
pthread_mutex_init_value(&obs->data.displays_mutex);
|
|
pthread_mutex_init_value(&obs->data.displays_mutex);
|
|
pthread_mutex_init_value(&obs->data.draw_callbacks_mutex);
|
|
pthread_mutex_init_value(&obs->data.draw_callbacks_mutex);
|
|
|
|
|
|
- if (pthread_mutexattr_init(&attr) != 0)
|
|
|
|
- return false;
|
|
|
|
- if (pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE) != 0)
|
|
|
|
- goto fail;
|
|
|
|
- if (pthread_mutex_init(&data->sources_mutex, &attr) != 0)
|
|
|
|
|
|
+ if (pthread_mutex_init_recursive(&data->sources_mutex) != 0)
|
|
goto fail;
|
|
goto fail;
|
|
- if (pthread_mutex_init(&data->audio_sources_mutex, &attr) != 0)
|
|
|
|
|
|
+ if (pthread_mutex_init_recursive(&data->audio_sources_mutex) != 0)
|
|
goto fail;
|
|
goto fail;
|
|
- if (pthread_mutex_init(&data->displays_mutex, &attr) != 0)
|
|
|
|
|
|
+ if (pthread_mutex_init_recursive(&data->displays_mutex) != 0)
|
|
goto fail;
|
|
goto fail;
|
|
- if (pthread_mutex_init(&data->outputs_mutex, &attr) != 0)
|
|
|
|
|
|
+ if (pthread_mutex_init_recursive(&data->outputs_mutex) != 0)
|
|
goto fail;
|
|
goto fail;
|
|
- if (pthread_mutex_init(&data->encoders_mutex, &attr) != 0)
|
|
|
|
|
|
+ if (pthread_mutex_init_recursive(&data->encoders_mutex) != 0)
|
|
goto fail;
|
|
goto fail;
|
|
- if (pthread_mutex_init(&data->services_mutex, &attr) != 0)
|
|
|
|
|
|
+ if (pthread_mutex_init_recursive(&data->services_mutex) != 0)
|
|
goto fail;
|
|
goto fail;
|
|
- if (pthread_mutex_init(&obs->data.draw_callbacks_mutex, &attr) != 0)
|
|
|
|
|
|
+ if (pthread_mutex_init_recursive(&obs->data.draw_callbacks_mutex) != 0)
|
|
goto fail;
|
|
goto fail;
|
|
if (!obs_view_init(&data->main_view))
|
|
if (!obs_view_init(&data->main_view))
|
|
goto fail;
|
|
goto fail;
|
|
@@ -660,7 +644,6 @@ static bool obs_init_data(void)
|
|
data->valid = true;
|
|
data->valid = true;
|
|
|
|
|
|
fail:
|
|
fail:
|
|
- pthread_mutexattr_destroy(&attr);
|
|
|
|
return data->valid;
|
|
return data->valid;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -764,7 +747,6 @@ static pthread_once_t obs_pthread_once_init_token = PTHREAD_ONCE_INIT;
|
|
static inline bool obs_init_hotkeys(void)
|
|
static inline bool obs_init_hotkeys(void)
|
|
{
|
|
{
|
|
struct obs_core_hotkeys *hotkeys = &obs->hotkeys;
|
|
struct obs_core_hotkeys *hotkeys = &obs->hotkeys;
|
|
- pthread_mutexattr_t attr;
|
|
|
|
bool success = false;
|
|
bool success = false;
|
|
|
|
|
|
assert(hotkeys != NULL);
|
|
assert(hotkeys != NULL);
|
|
@@ -782,11 +764,7 @@ static inline bool obs_init_hotkeys(void)
|
|
if (!obs_hotkeys_platform_init(hotkeys))
|
|
if (!obs_hotkeys_platform_init(hotkeys))
|
|
return false;
|
|
return false;
|
|
|
|
|
|
- if (pthread_mutexattr_init(&attr) != 0)
|
|
|
|
- return false;
|
|
|
|
- if (pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE) != 0)
|
|
|
|
- goto fail;
|
|
|
|
- if (pthread_mutex_init(&hotkeys->mutex, &attr) != 0)
|
|
|
|
|
|
+ if (pthread_mutex_init_recursive(&hotkeys->mutex) != 0)
|
|
goto fail;
|
|
goto fail;
|
|
|
|
|
|
if (os_event_init(&hotkeys->stop_event, OS_EVENT_TYPE_MANUAL) != 0)
|
|
if (os_event_init(&hotkeys->stop_event, OS_EVENT_TYPE_MANUAL) != 0)
|
|
@@ -800,7 +778,6 @@ static inline bool obs_init_hotkeys(void)
|
|
success = true;
|
|
success = true;
|
|
|
|
|
|
fail:
|
|
fail:
|
|
- pthread_mutexattr_destroy(&attr);
|
|
|
|
return success;
|
|
return success;
|
|
}
|
|
}
|
|
|
|
|