mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-10-27 21:54:16 +00:00
WIP not shabby auto vid settings
This commit is contained in:
1 parent
828d6eaf01
commit
aa0b28e235
8 files changed
+113
-17
No files matched your search
@@ -767,6 +767,28 @@ switch_status_t conference_member_add(conference_obj_t *conference, conference_m
|
||||
conference_utils_member_set_flag_locked(member, MFLAG_NO_MINIMIZE_ENCODING);
|
||||
}
|
||||
|
||||
if ((var = switch_channel_get_variable(member->channel, "rtp_video_max_bandwidth_in"))) {
|
||||
int tmp = atoi(var);
|
||||
if (tmp > 0) {
|
||||
member->max_bw_in = tmp;
|
||||
}
|
||||
printf("FORCE MAX %d\n", member->max_bw_in);
|
||||
}
|
||||
|
||||
if ((var = switch_channel_get_variable(member->channel, "rtp_video_max_bandwidth_out"))) {
|
||||
int tmp = atoi(var);
|
||||
if (tmp > 0) {
|
||||
member->max_bw_out = tmp;
|
||||
|
||||
if (member->max_bw_out < conference->video_codec_settings.video.bandwidth) {
|
||||
printf("DED ENCODER for %d\n", member->max_bw_out);
|
||||
conference_utils_member_set_flag_locked(member, MFLAG_NO_MINIMIZE_ENCODING);
|
||||
switch_core_media_set_outgoing_bitrate(member->session, SWITCH_MEDIA_TYPE_VIDEO, member->max_bw_out);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
switch_channel_set_variable_printf(channel, "conference_member_id", "%d", member->id);
|
||||
switch_channel_set_variable_printf(channel, "conference_moderator", "%s", conference_utils_member_test_flag(member, MFLAG_MOD) ? "true" : "false");
|
||||
switch_channel_set_variable_printf(channel, "conference_ghost", "%s", conference_utils_member_test_flag(member, MFLAG_GHOST) ? "true" : "false");
|
||||
|
||||
@@ -761,6 +761,7 @@ struct conference_member {
|
||||
switch_image_t *pcanvas_img;
|
||||
int max_bw_in;
|
||||
int force_bw_in;
|
||||
int max_bw_out;
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
|
||||
@@ -1856,30 +1856,49 @@ static void client_run(jsock_t *jsock)
|
||||
char *s = (char *) data;
|
||||
|
||||
if (*s == '#') {
|
||||
char repl[80] = "", *s = (char *) data;
|
||||
char repl[2048] = "";
|
||||
switch_time_t a, b;
|
||||
|
||||
|
||||
if (s[1] == 'S' && s[2] == 'P') {
|
||||
|
||||
if (s[3] == 'U') {
|
||||
int i, size = 0;
|
||||
char *p = s+4;
|
||||
int loops = 0;
|
||||
int rem = 0;
|
||||
|
||||
if (!(size = atoi(p))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
a = switch_time_now();
|
||||
bytes = ws_read_frame(&jsock->ws, &oc, &data);
|
||||
do {
|
||||
bytes = ws_read_frame(&jsock->ws, &oc, &data);
|
||||
s = (char *) data;
|
||||
} while (bytes && data && s[0] == '#' && s[3] == 'B');
|
||||
b = switch_time_now();
|
||||
|
||||
if (!bytes || !data) continue;
|
||||
|
||||
if (s[0] != '#') goto nm;
|
||||
|
||||
switch_snprintf(repl, sizeof(repl), "#SPU %ld", (b - a) / 1000);
|
||||
ws_write_frame(&jsock->ws, WSOC_TEXT, repl, strlen(repl));
|
||||
|
||||
|
||||
s = (char *) data;
|
||||
s[3] = 'B';
|
||||
loops = size / 1024;
|
||||
rem = size % 1024;
|
||||
switch_snprintf(repl, sizeof(repl), "#SPB ");
|
||||
memset(repl+4, '.', 1024);
|
||||
a = switch_time_now();
|
||||
ws_write_frame(&jsock->ws, WSOC_TEXT, data, bytes);
|
||||
for (i = 0; i < loops; i++) {
|
||||
ws_write_frame(&jsock->ws, WSOC_TEXT, repl, 1024);
|
||||
}
|
||||
if (rem) {
|
||||
ws_write_frame(&jsock->ws, WSOC_TEXT, repl, rem);
|
||||
}
|
||||
b = switch_time_now();
|
||||
|
||||
switch_snprintf(repl, sizeof(repl), "#SPD %ld", (b - a) / 1000);
|
||||
switch_snprintf(repl, sizeof(repl), "#SPD %ld", ((b - a) / 1000) - 200);
|
||||
ws_write_frame(&jsock->ws, WSOC_TEXT, repl, strlen(repl));
|
||||
}
|
||||
}
|
||||
@@ -1887,6 +1906,7 @@ static void client_run(jsock_t *jsock)
|
||||
continue;
|
||||
}
|
||||
|
||||
nm:
|
||||
|
||||
if (process_input(jsock, data, bytes) != SWITCH_STATUS_SUCCESS) {
|
||||
die("Input Error\n");
|
||||
|
||||
Reference in new issue
Block a user