mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-17 09:12:25 +00:00
FS-7509: add some more bandwidth control features
This commit is contained in:
parent
1857da8a54
commit
c9cccd519a
@ -115,8 +115,7 @@
|
|||||||
<span class="sharediv">
|
<span class="sharediv">
|
||||||
<button data-inline="true" id="smallerbtn">Smaller - </button>
|
<button data-inline="true" id="smallerbtn">Smaller - </button>
|
||||||
<button data-inline="true" id="biggerbtn">Bigger +</button>
|
<button data-inline="true" id="biggerbtn">Bigger +</button>
|
||||||
<button data-inline="true" id="fullbtn">Full Screen</button>
|
<button data-inline="true" id="fullbtn">Enter Full Screen</button>
|
||||||
<button data-inline="true" id="nofullbtn">Exit Full Screen</button>
|
|
||||||
<button data-inline="true" id="vmutebtn">Toggle Video Mute</button>
|
<button data-inline="true" id="vmutebtn">Toggle Video Mute</button>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
@ -418,6 +417,8 @@ if ($('#devices').is(':visible')) {
|
|||||||
|
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</div><br clear="all"><br>
|
</div><br clear="all"><br>
|
||||||
|
<label><input id="use_dedenc" type="checkbox" value="foo" > Use Dedicated Remote Encoder</label>
|
||||||
|
<label><input id="mirror_input" type="checkbox" value="foo" >Scale Remote Video To Match Camera</label>
|
||||||
<br><br>
|
<br><br>
|
||||||
<center><button data-inline="true" id="refreshbtn">Refresh Device List</button>
|
<center><button data-inline="true" id="refreshbtn">Refresh Device List</button>
|
||||||
<button data-inline="true" id="hidedevices" onclick="$('#devices').hide();$('#showdevices').show()">Save Device Settings</button>
|
<button data-inline="true" id="hidedevices" onclick="$('#devices').hide();$('#showdevices').show()">Save Device Settings</button>
|
||||||
|
@ -521,17 +521,6 @@ var is_full = false;
|
|||||||
var usrto;
|
var usrto;
|
||||||
function noop() { return; }
|
function noop() { return; }
|
||||||
|
|
||||||
$("#nofullbtn").click(function() {
|
|
||||||
|
|
||||||
if (document.webkitFullscreenEnabled) {
|
|
||||||
document.webkitExitFullscreen();
|
|
||||||
} else if (document.mozFullScreenEnabled) {
|
|
||||||
document.mozExitFullScreen();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
function on_full(which)
|
function on_full(which)
|
||||||
{
|
{
|
||||||
is_full = which;
|
is_full = which;
|
||||||
@ -558,7 +547,18 @@ $(document).on('webkitfullscreenchange mozfullscreenchange fullscreenchange MSFu
|
|||||||
|
|
||||||
$("#fullbtn").click(function() {
|
$("#fullbtn").click(function() {
|
||||||
|
|
||||||
|
if (!is_full) {
|
||||||
full_screen("fs");
|
full_screen("fs");
|
||||||
|
$("#fullbtn").text("Exit Full Screen");
|
||||||
|
} else {
|
||||||
|
$("#fullbtn").text("Enter Full Screen");
|
||||||
|
if (document.webkitFullscreenEnabled) {
|
||||||
|
document.webkitExitFullscreen();
|
||||||
|
} else if (document.mozFullScreenEnabled) {
|
||||||
|
document.mozExitFullScreen();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// $("#mod1").css("position", "absolute").css("z-index", "2");
|
// $("#mod1").css("position", "absolute").css("z-index", "2");
|
||||||
@ -597,7 +597,9 @@ function docall() {
|
|||||||
useVideo: check_vid(),
|
useVideo: check_vid(),
|
||||||
useStereo: $("#use_stereo").is(':checked'),
|
useStereo: $("#use_stereo").is(':checked'),
|
||||||
useCamera: $("#usecamera").find(":selected").val(),
|
useCamera: $("#usecamera").find(":selected").val(),
|
||||||
useMic: $("#usemic").find(":selected").val()
|
useMic: $("#usemic").find(":selected").val(),
|
||||||
|
dedEnc: $("#use_dedenc").is(':checked'),
|
||||||
|
mirrorInput: $("#mirror_input").is(':checked')
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -630,7 +632,9 @@ function doshare(on) {
|
|||||||
incomingBandwidth: incomingBandwidth,
|
incomingBandwidth: incomingBandwidth,
|
||||||
useCamera: sharedev,
|
useCamera: sharedev,
|
||||||
useVideo: true,
|
useVideo: true,
|
||||||
screenShare: true
|
screenShare: true,
|
||||||
|
dedEnc: $("#use_dedenc").is(':checked'),
|
||||||
|
mirrorInput: $("#mirror_input").is(':checked')
|
||||||
});
|
});
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -650,7 +654,9 @@ function doshare(on) {
|
|||||||
incomingBandwidth: incomingBandwidth,
|
incomingBandwidth: incomingBandwidth,
|
||||||
videoParams: screen_constraints.video.mandatory,
|
videoParams: screen_constraints.video.mandatory,
|
||||||
useVideo: true,
|
useVideo: true,
|
||||||
screenShare: true
|
screenShare: true,
|
||||||
|
dedEnc: $("#use_dedenc").is(':checked'),
|
||||||
|
mirrorInput: $("#mirror_input").is(':checked')
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -805,6 +811,40 @@ function init() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
tmp = $.cookie("verto_demo_dedenc_checked") || "false";
|
||||||
|
$.cookie("verto_demo_dedenc_checked", tmp, {
|
||||||
|
expires: 365
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#use_dedenc").prop("checked", tmp === "true").change(function(e) {
|
||||||
|
tmp = $("#use_dedenc").is(':checked');
|
||||||
|
|
||||||
|
if (!tmp && $("#mirror_input").is(':checked')) {
|
||||||
|
$("#mirror_input").click();
|
||||||
|
}
|
||||||
|
|
||||||
|
$.cookie("verto_demo_dedenc_checked", tmp ? "true" : "false", {
|
||||||
|
expires: 365
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
tmp = $.cookie("verto_demo_mirror_input_checked") || "false";
|
||||||
|
$.cookie("verto_demo_mirror_input_checked", tmp, {
|
||||||
|
expires: 365
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#mirror_input").prop("checked", tmp === "true").change(function(e) {
|
||||||
|
tmp = $("#mirror_input").is(':checked');
|
||||||
|
if (tmp && !$("#use_dedenc").is(':checked')) {
|
||||||
|
$("#use_dedenc").click();
|
||||||
|
}
|
||||||
|
$.cookie("verto_demo_mirror_input_checked", tmp ? "true" : "false", {
|
||||||
|
expires: 365
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
//
|
//
|
||||||
outgoingBandwidth = $.cookie("verto_demo_outgoingBandwidth") || "default";
|
outgoingBandwidth = $.cookie("verto_demo_outgoingBandwidth") || "default";
|
||||||
$.cookie("verto_demo_outgoingBandwidth", outgoingBandwidth, {
|
$.cookie("verto_demo_outgoingBandwidth", outgoingBandwidth, {
|
||||||
|
@ -1471,6 +1471,7 @@ typedef enum {
|
|||||||
CF_VIDEO_DEBUG_WRITE,
|
CF_VIDEO_DEBUG_WRITE,
|
||||||
CF_VIDEO_ONLY,
|
CF_VIDEO_ONLY,
|
||||||
CF_VIDEO_READY,
|
CF_VIDEO_READY,
|
||||||
|
CF_VIDEO_MIRROR_INPUT,
|
||||||
/* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */
|
/* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */
|
||||||
/* IF YOU ADD NEW ONES CHECK IF THEY SHOULD PERSIST OR ZERO THEM IN switch_core_session.c switch_core_session_request_xml() */
|
/* IF YOU ADD NEW ONES CHECK IF THEY SHOULD PERSIST OR ZERO THEM IN switch_core_session.c switch_core_session_request_xml() */
|
||||||
CF_FLAG_MAX
|
CF_FLAG_MAX
|
||||||
|
@ -3771,6 +3771,10 @@ static switch_status_t conference_add_member(conference_obj_t *conference, confe
|
|||||||
member->video_reservation_id = switch_core_strdup(member->pool, var);
|
member->video_reservation_id = switch_core_strdup(member->pool, var);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((var = switch_channel_get_variable(channel, "video_use_dedicated_encoder")) && switch_true(var)) {
|
||||||
|
switch_set_flag_locked(member, MFLAG_NO_MINIMIZE_ENCODING);
|
||||||
|
}
|
||||||
|
|
||||||
switch_channel_set_variable_printf(channel, "conference_member_id", "%d", member->id);
|
switch_channel_set_variable_printf(channel, "conference_member_id", "%d", member->id);
|
||||||
switch_channel_set_variable_printf(channel, "conference_moderator", "%s", switch_test_flag(member, MFLAG_MOD) ? "true" : "false");
|
switch_channel_set_variable_printf(channel, "conference_moderator", "%s", switch_test_flag(member, MFLAG_MOD) ? "true" : "false");
|
||||||
switch_channel_set_variable_printf(channel, "conference_ghost", "%s", switch_test_flag(member, MFLAG_GHOST) ? "true" : "false");
|
switch_channel_set_variable_printf(channel, "conference_ghost", "%s", switch_test_flag(member, MFLAG_GHOST) ? "true" : "false");
|
||||||
|
@ -3204,7 +3204,7 @@ static switch_bool_t verto__info_func(const char *method, cJSON *params, jsock_t
|
|||||||
|
|
||||||
static switch_bool_t verto__invite_func(const char *method, cJSON *params, jsock_t *jsock, cJSON **response)
|
static switch_bool_t verto__invite_func(const char *method, cJSON *params, jsock_t *jsock, cJSON **response)
|
||||||
{
|
{
|
||||||
cJSON *obj = cJSON_CreateObject(), *screenShare = NULL;
|
cJSON *obj = cJSON_CreateObject(), *screenShare = NULL, *dedEnc = NULL, *mirrorInput;
|
||||||
switch_core_session_t *session = NULL;
|
switch_core_session_t *session = NULL;
|
||||||
switch_channel_t *channel;
|
switch_channel_t *channel;
|
||||||
switch_event_t *var_event;
|
switch_event_t *var_event;
|
||||||
@ -3274,6 +3274,15 @@ static switch_bool_t verto__invite_func(const char *method, cJSON *params, jsock
|
|||||||
switch_channel_set_flag(channel, CF_VIDEO_ONLY);
|
switch_channel_set_flag(channel, CF_VIDEO_ONLY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((dedEnc = cJSON_GetObjectItem(dialog, "dedEnc")) && dedEnc->type == cJSON_True) {
|
||||||
|
switch_channel_set_variable(channel, "video_use_dedicated_encoder", "true");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((mirrorInput = cJSON_GetObjectItem(dialog, "mirrorInput")) && mirrorInput->type == cJSON_True) {
|
||||||
|
switch_channel_set_variable(channel, "video_mirror_input", "true");
|
||||||
|
switch_channel_set_flag(channel, CF_VIDEO_MIRROR_INPUT);
|
||||||
|
}
|
||||||
|
|
||||||
if ((bandwidth = cJSON_GetObjectCstr(dialog, "outgoingBandwidth"))) {
|
if ((bandwidth = cJSON_GetObjectCstr(dialog, "outgoingBandwidth"))) {
|
||||||
if (strcasecmp(bandwidth, "default")) {
|
if (strcasecmp(bandwidth, "default")) {
|
||||||
switch_channel_set_variable(channel, "rtp_video_max_bandwidth_in", bandwidth);
|
switch_channel_set_variable(channel, "rtp_video_max_bandwidth_in", bandwidth);
|
||||||
|
@ -10029,7 +10029,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_video_frame(switch_cor
|
|||||||
switch_codec_t *codec = switch_core_session_get_video_write_codec(session);
|
switch_codec_t *codec = switch_core_session_get_video_write_codec(session);
|
||||||
switch_timer_t *timer;
|
switch_timer_t *timer;
|
||||||
switch_media_handle_t *smh;
|
switch_media_handle_t *smh;
|
||||||
switch_image_t *img = frame->img;
|
switch_image_t *dup_img = NULL, *img = frame->img;
|
||||||
switch_status_t encode_status;
|
switch_status_t encode_status;
|
||||||
switch_frame_t write_frame = {0};
|
switch_frame_t write_frame = {0};
|
||||||
//switch_rtp_engine_t *v_engine;
|
//switch_rtp_engine_t *v_engine;
|
||||||
@ -10085,6 +10085,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_video_frame(switch_cor
|
|||||||
switch_goto_status(vstatus, done);
|
switch_goto_status(vstatus, done);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* When desired, scale video to match the input signal (if output is bigger) */
|
||||||
|
if (switch_channel_test_flag(session->channel, CF_VIDEO_READY) && smh->vid_params.width &&
|
||||||
|
switch_channel_test_flag(session->channel, CF_VIDEO_MIRROR_INPUT) &&
|
||||||
|
(smh->vid_params.width * smh->vid_params.height) < (img->d_w * img->d_h)) {
|
||||||
|
switch_img_scale(img, &dup_img, smh->vid_params.width, smh->vid_params.height);
|
||||||
|
img = dup_img;
|
||||||
|
}
|
||||||
|
|
||||||
write_frame = *frame;
|
write_frame = *frame;
|
||||||
frame = &write_frame;
|
frame = &write_frame;
|
||||||
frame->img = img;
|
frame->img = img;
|
||||||
@ -10131,6 +10139,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_video_frame(switch_cor
|
|||||||
switch_mutex_unlock(smh->write_mutex[SWITCH_MEDIA_TYPE_VIDEO]);
|
switch_mutex_unlock(smh->write_mutex[SWITCH_MEDIA_TYPE_VIDEO]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch_img_free(&dup_img);
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user