FS-11226: [freeswitch-core,mod_conference] Missing font files can lead to crash in conference #resolve
This commit is contained in:
parent
bc3e1c9e7d
commit
79ccf87ae7
|
@ -1199,16 +1199,20 @@ void conference_member_set_logo(conference_member_t *member, const char *path)
|
|||
if (y < 0) y = 0;
|
||||
}
|
||||
|
||||
img = switch_img_write_text_img(member->video_logo->d_w, member->video_logo->d_h, SWITCH_FALSE, var);
|
||||
switch_img_fit(&img, member->video_logo->d_w, member->video_logo->d_h, SWITCH_FIT_NECESSARY);
|
||||
switch_img_attenuate(member->video_logo);
|
||||
if ((img = switch_img_write_text_img(member->video_logo->d_w, member->video_logo->d_h, SWITCH_FALSE, var))) {
|
||||
switch_img_fit(&img, member->video_logo->d_w, member->video_logo->d_h, SWITCH_FIT_NECESSARY);
|
||||
switch_img_attenuate(member->video_logo);
|
||||
|
||||
if (center) {
|
||||
x = center_off + ((member->video_logo->d_w - center_off - img->d_w) / 2);
|
||||
|
||||
if (center) {
|
||||
x = center_off + ((member->video_logo->d_w - center_off - img->d_w) / 2);
|
||||
}
|
||||
|
||||
switch_img_patch(member->video_logo, img, x, y);
|
||||
switch_img_free(&img);
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Failed to write text on image!\n");
|
||||
}
|
||||
|
||||
switch_img_patch(member->video_logo, img, x, y);
|
||||
switch_img_free(&img);
|
||||
}
|
||||
|
||||
if (params && (var = switch_event_get_header(params, "alt_text"))) {
|
||||
|
@ -1236,17 +1240,21 @@ void conference_member_set_logo(conference_member_t *member, const char *path)
|
|||
y = atoi(tmp);
|
||||
if (y < 0) y = 0;
|
||||
}
|
||||
|
||||
if ((img = switch_img_write_text_img(member->video_logo->d_w, member->video_logo->d_h, SWITCH_FALSE, var))) {
|
||||
switch_img_fit(&img, member->video_logo->d_w, member->video_logo->d_h, SWITCH_FIT_NECESSARY);
|
||||
switch_img_attenuate(member->video_logo);
|
||||
|
||||
if (center) {
|
||||
x = center_off + ((member->video_logo->d_w - center_off - img->d_w) / 2);
|
||||
}
|
||||
|
||||
img = switch_img_write_text_img(member->video_logo->d_w, member->video_logo->d_h, SWITCH_FALSE, var);
|
||||
switch_img_fit(&img, member->video_logo->d_w, member->video_logo->d_h, SWITCH_FIT_NECESSARY);
|
||||
switch_img_attenuate(member->video_logo);
|
||||
|
||||
if (center) {
|
||||
x = center_off + ((member->video_logo->d_w - center_off - img->d_w) / 2);
|
||||
switch_img_patch(member->video_logo, img, x, y);
|
||||
switch_img_free(&img);
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Failed to write text on image!\n");
|
||||
}
|
||||
|
||||
switch_img_patch(member->video_logo, img, x, y);
|
||||
switch_img_free(&img);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2196,6 +2196,11 @@ SWITCH_DECLARE(switch_image_t *) switch_img_write_text_img(int w, int h, switch_
|
|||
} else {
|
||||
width = pre_width;
|
||||
}
|
||||
|
||||
if (width == 0 || height == 0) {
|
||||
txtimg = NULL;
|
||||
goto done;
|
||||
}
|
||||
|
||||
//if (bg) {
|
||||
// txtimg = switch_img_alloc(NULL, SWITCH_IMG_FMT_I420, width, height, 1);
|
||||
|
@ -2224,6 +2229,9 @@ SWITCH_DECLARE(switch_image_t *) switch_img_write_text_img(int w, int h, switch_
|
|||
txtimg,
|
||||
x, y,
|
||||
txt, NULL, fg, bg, 0, 0);
|
||||
|
||||
done:
|
||||
|
||||
switch_img_txt_handle_destroy(&txthandle);
|
||||
|
||||
switch_safe_free(duptxt);
|
||||
|
|
Loading…
Reference in New Issue