rtmp-services: Initialize mutex/dynamic array

The Twitch ingest lookup file did not initialize the dynamic array or
mutex before using.
This commit is contained in:
jp9000 2017-08-09 12:33:16 -07:00
parent 21d1658925
commit a625448d97
2 changed files with 10 additions and 0 deletions

View File

@ -40,11 +40,14 @@ static bool confirm_service_file(void *param, struct file_download_data *file)
return true;
}
extern void init_twitch_data(void);
extern void load_twitch_data(const char *module_str);
extern void unload_twitch_data(void);
bool obs_module_load(void)
{
init_twitch_data();
char *local_dir = obs_module_file("");
char *cache_dir = obs_module_config_path("");
struct dstr module_name = {0};

View File

@ -135,6 +135,12 @@ struct twitch_ingest twitch_ingest(size_t idx)
return ingest;
}
void init_twitch_data(void)
{
da_init(cur_ingests);
pthread_mutex_init(&mutex, NULL);
}
void load_twitch_data(const char *module_str)
{
char *twitch_cache = obs_module_config_path("twitch_ingests.json");
@ -162,4 +168,5 @@ void unload_twitch_data(void)
{
update_info_destroy(twitch_update_info);
free_ingests();
pthread_mutex_destroy(&mutex);
}