mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-05-22 23:16:09 +00:00
FS-10243: [mod_conference] Add conference variables
This commit is contained in:
parent
628cf17597
commit
cf12785b33
@ -1415,8 +1415,11 @@ switch_status_t conference_api_sub_vid_bandwidth(conference_obj_t *conference, s
|
|||||||
int x = 0, id = -1;
|
int x = 0, id = -1;
|
||||||
char *group = NULL;
|
char *group = NULL;
|
||||||
char *array[4] = {0};
|
char *array[4] = {0};
|
||||||
int sdiv = 0, fdiv = 0;
|
float sdiv = 0;
|
||||||
|
int fdiv = 0;
|
||||||
|
int force_w = 0, force_h = 0;
|
||||||
|
|
||||||
|
|
||||||
if (!conference_utils_test_flag(conference, CFLAG_MINIMIZE_VIDEO_ENCODING)) {
|
if (!conference_utils_test_flag(conference, CFLAG_MINIMIZE_VIDEO_ENCODING)) {
|
||||||
stream->write_function(stream, "-ERR Bandwidth control not available.\n");
|
stream->write_function(stream, "-ERR Bandwidth control not available.\n");
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
@ -1430,9 +1433,25 @@ switch_status_t conference_api_sub_vid_bandwidth(conference_obj_t *conference, s
|
|||||||
switch_split(argv[2], ':', array);
|
switch_split(argv[2], ':', array);
|
||||||
|
|
||||||
if (array[1]) {
|
if (array[1]) {
|
||||||
sdiv = atoi(array[1]);
|
if (*array[1] == '=') {
|
||||||
if (sdiv < 2 || sdiv > 8) {
|
char *p = array[1];
|
||||||
sdiv = 0;
|
|
||||||
|
force_w = atoi((p+1));
|
||||||
|
if ((p = strchr(p+1, 'x'))) {
|
||||||
|
p++;
|
||||||
|
if (*p) {
|
||||||
|
force_h = atoi(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(force_w > 100 && force_w < 1920 && force_h > 100 && force_h < 1080)) {
|
||||||
|
force_w = force_h = 0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
sdiv = atof(array[1]);
|
||||||
|
if (sdiv < 1.5 || sdiv > 8.0) {
|
||||||
|
sdiv = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1476,28 +1495,39 @@ switch_status_t conference_api_sub_vid_bandwidth(conference_obj_t *conference, s
|
|||||||
int j;
|
int j;
|
||||||
|
|
||||||
for (j = 0; j < canvas->write_codecs_count; j++) {
|
for (j = 0; j < canvas->write_codecs_count; j++) {
|
||||||
|
int w = canvas->width, h = canvas->height;
|
||||||
|
|
||||||
if ((zstr(group) || !strcmp(group, switch_str_nil(canvas->write_codecs[j]->video_codec_group)))) {
|
if ((zstr(group) || !strcmp(group, switch_str_nil(canvas->write_codecs[j]->video_codec_group)))) {
|
||||||
switch_core_codec_control(&canvas->write_codecs[j]->codec, SCC_VIDEO_BANDWIDTH,
|
switch_core_codec_control(&canvas->write_codecs[j]->codec, SCC_VIDEO_BANDWIDTH,
|
||||||
SCCT_INT, &video_write_bandwidth, SCCT_NONE, NULL, NULL, NULL);
|
SCCT_INT, &video_write_bandwidth, SCCT_NONE, NULL, NULL, NULL);
|
||||||
stream->write_function(stream, "+OK Set Bandwidth for canvas %d index %d group[%s] to %d\n", i + 1, j,
|
|
||||||
switch_str_nil(canvas->write_codecs[j]->video_codec_group), video_write_bandwidth);
|
|
||||||
|
|
||||||
if (fdiv) {
|
if (fdiv) {
|
||||||
canvas->write_codecs[j]->fps_divisor = fdiv;
|
canvas->write_codecs[j]->fps_divisor = fdiv;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sdiv) {
|
|
||||||
int w = 0, h = 0;
|
|
||||||
|
|
||||||
w = canvas->width;
|
if (force_w && force_h) {
|
||||||
h = canvas->width;
|
w = force_w;
|
||||||
|
h = force_h;
|
||||||
w /= sdiv;
|
} else if (sdiv) {
|
||||||
h /= sdiv;
|
w = (int)((float) w / sdiv);
|
||||||
|
h = (int)((float) h / sdiv);
|
||||||
switch_img_free(&canvas->write_codecs[j]->scaled_img);
|
|
||||||
canvas->write_codecs[j]->scaled_img = switch_img_alloc(NULL, SWITCH_IMG_FMT_I420, w, h, 16);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (w && h) {
|
||||||
|
switch_img_free(&canvas->write_codecs[j]->scaled_img);
|
||||||
|
if (w != canvas->img->d_w || h != canvas->img->d_h) {
|
||||||
|
canvas->write_codecs[j]->scaled_img = switch_img_alloc(NULL, SWITCH_IMG_FMT_I420, w, h, 16);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!sdiv && w) {
|
||||||
|
sdiv = (float)canvas->img->d_w / w;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
stream->write_function(stream, "+OK Set Bandwidth for canvas %d index %d group[%s] to %d sdiv %.2f %dx%d fdiv %d\n", i + 1, j,
|
||||||
|
switch_str_nil(canvas->write_codecs[j]->video_codec_group), video_write_bandwidth, sdiv, w,h, fdiv);
|
||||||
|
|
||||||
|
|
||||||
x++;
|
x++;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user