Moved executive code from asserts

In case someone defined NDEBUG, this particular code wouldn't compile.
This commit is contained in:
Martin Pulec
2020-04-22 11:56:23 +02:00
parent ccf00cc201
commit aef1ca16cd
6 changed files with 26 additions and 15 deletions

View File

@@ -233,22 +233,25 @@ void *hd_rum_decompress_init(struct module *parent, struct hd_rum_output_conf co
chrono::steady_clock::time_point start_time(chrono::steady_clock::now());
char cfg[128] = "";
int ret;
switch(conf.mode){
case NORMAL:
snprintf(cfg, sizeof cfg, "%p", s);
assert (initialize_video_display(parent, "pipe", cfg, 0, NULL, &s->display) == 0);
ret = initialize_video_display(parent, "pipe", cfg, 0, NULL, &s->display);
break;
case BLEND:
snprintf(cfg, sizeof cfg, "pipe:%p", s);
assert (initialize_video_display(parent, "proxy", cfg, 0, NULL, &s->display) == 0);
ret = initialize_video_display(parent, "proxy", cfg, 0, NULL, &s->display);
break;
case CONFERENCE:
snprintf(cfg, sizeof cfg, "pipe:%p#%s", s, conf.arg);
assert (initialize_video_display(parent, "conference", cfg, 0, NULL, &s->display) == 0);
ret = initialize_video_display(parent, "conference", cfg, 0, NULL, &s->display);
break;
}
assert(ret == 0 && "Unable to initialize auxiliary display");
map<string, param_u> params;
// common

View File

@@ -48,14 +48,16 @@
void module_init_default(struct module *module_data)
{
int ret = 0;
memset(module_data, 0, sizeof(struct module));
pthread_mutexattr_t attr;
assert(pthread_mutexattr_init(&attr) == 0);
assert(pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE) == 0);
assert(pthread_mutex_init(&module_data->lock, &attr) == 0);
assert(pthread_mutex_init(&module_data->msg_queue_lock, &attr) == 0);
pthread_mutexattr_destroy(&attr);
ret |= pthread_mutexattr_init(&attr);
ret |= pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
ret |= pthread_mutex_init(&module_data->lock, &attr);
ret |= pthread_mutex_init(&module_data->msg_queue_lock, &attr);
ret |= pthread_mutexattr_destroy(&attr);
assert(ret == 0 && "Unable to create mutex or set attributes");
module_data->childs = simple_linked_list_init();
module_data->msg_queue = simple_linked_list_init();

View File

@@ -102,7 +102,8 @@ static int vidcap_ug_input_init(struct vidcap_params *cap_params, void **state)
char cfg[128] = "";
snprintf(cfg, sizeof cfg, "pipe:%p", s);
assert (initialize_video_display(vidcap_params_get_parent(cap_params), "proxy", cfg, 0, NULL, &s->display) == 0);
int ret = initialize_video_display(vidcap_params_get_parent(cap_params), "proxy", cfg, 0, NULL, &s->display);
assert(ret == 0 && "Unable to initialize proxy display");
map<string, param_u> params;

View File

@@ -212,6 +212,7 @@ static void * j2k_decompress_init(void)
unsigned int tile_limit = DEFAULT_TILE_LIMIT;
unsigned int queue_len = DEFAULT_MAX_QUEUE_SIZE;
unsigned int encoder_in_frames = DEFAULT_MAX_IN_FRAMES;
int ret;
if (get_commandline_param("j2k-dec-mem-limit")) {
mem_limit = unit_evaluate(get_commandline_param("j2k-dec-mem-limit"));
@@ -247,8 +248,8 @@ static void * j2k_decompress_init(void)
CHECK_OK(cmpto_j2k_dec_cfg_create(s->decoder, &s->settings), "Error creating configuration",
goto error);
assert(pthread_create(&s->thread_id, NULL, decompress_j2k_worker,
(void *) s) == 0);
ret = pthread_create(&s->thread_id, NULL, decompress_j2k_worker, (void *) s);
assert(ret == 0 && "Unable to create thread");
return s;

View File

@@ -412,6 +412,7 @@ static void *display_conference_init(struct module *parent, const char *fmt, uns
char *fmt_copy = NULL;
const char *requested_display = "gl";
const char *cfg = NULL;
int ret;
printf("FMT: %s\n", fmt);
@@ -493,10 +494,11 @@ static void *display_conference_init(struct module *parent, const char *fmt, uns
return &display_init_noerr;
}
s->common = shared_ptr<state_conference_common>(new state_conference_common(width, height, fps, gpu));
assert (initialize_video_display(parent, requested_display, cfg, flags, NULL, &s->common->real_display) == 0);
ret = initialize_video_display(parent, requested_display, cfg, flags, NULL, &s->common->real_display);
assert(ret == 0 && "Unable to intialize conference display");
free(fmt_copy);
int ret = pthread_create(&s->common->thread_id, NULL, (void *(*)(void *)) display_run_worker,
ret = pthread_create(&s->common->thread_id, NULL, (void *(*)(void *)) display_run_worker,
s->common->real_display);
assert (ret == 0);

View File

@@ -128,6 +128,7 @@ static void *display_proxy_init(struct module *parent, const char *fmt, unsigned
char *fmt_copy = NULL;
const char *requested_display = "gl";
const char *cfg = NULL;
int ret;
s = new state_proxy();
@@ -148,10 +149,11 @@ static void *display_proxy_init(struct module *parent, const char *fmt, unsigned
}
}
s->common = shared_ptr<state_proxy_common>(new state_proxy_common());
assert (initialize_video_display(parent, requested_display, cfg, flags, NULL, &s->common->real_display) == 0);
ret = initialize_video_display(parent, requested_display, cfg, flags, NULL, &s->common->real_display);
assert(ret == 0 && "Unable to initialize real display for proxy");
free(fmt_copy);
int ret = pthread_create(&s->common->thread_id, NULL, display_run_worker,
ret = pthread_create(&s->common->thread_id, NULL, display_run_worker,
s->common->real_display);
assert (ret == 0);