FS-10259: [freeswitch-core,mod_commands,mod_conference] Allow uuid_video_bitrate to supersede bitrate control from the conference #resolve

This commit is contained in:
Anthony Minessale 2017-04-21 16:15:53 -05:00
parent c922223541
commit db7b27317a
2 changed files with 23 additions and 3 deletions

View File

@ -4202,6 +4202,10 @@ SWITCH_STANDARD_API(uuid_video_refresh_function)
return SWITCH_STATUS_SUCCESS;
}
typedef enum {
BITRATE_INUSE = (1 << 0)
} uuid_video_bitrate_enum_t;
#define VIDEO_BITRATE_SYNTAX "<uuid> <bitrate>"
SWITCH_STANDARD_API(uuid_video_bitrate_function)
{
@ -4219,13 +4223,29 @@ SWITCH_STANDARD_API(uuid_video_bitrate_function)
switch_core_session_t *lsession = NULL;
if ((lsession = switch_core_session_locate(argv[0]))) {
int kps = switch_parse_bandwidth_string(argv[1]);
int kps;
switch_core_session_message_t msg = { 0 };
switch_channel_t *channel = switch_core_session_get_channel(lsession);
if (argv[1] && !strcasecmp(argv[1], "clear")) {
if (switch_channel_test_app_flag_key("uuid_video_bitrate", channel, BITRATE_INUSE)) {
switch_channel_clear_flag_recursive(channel, CF_VIDEO_BITRATE_UNMANAGABLE);
switch_channel_clear_app_flag_key("uuid_video_bitrate", channel, BITRATE_INUSE);
}
}
kps = switch_parse_bandwidth_string(argv[1]);
msg.message_id = SWITCH_MESSAGE_INDICATE_BITRATE_REQ;
msg.numeric_arg = kps * 1024;
msg.from = __FILE__;
if (!switch_channel_test_app_flag_key("uuid_video_bitrate", channel, BITRATE_INUSE)) {
switch_channel_set_app_flag_key("uuid_video_bitrate", channel, BITRATE_INUSE);
switch_channel_set_flag_recursive(channel, CF_VIDEO_BITRATE_UNMANAGABLE);
}
switch_core_session_receive_message(lsession, &msg);
switch_core_session_video_reinit(lsession);
switch_channel_video_sync(switch_core_session_get_channel(lsession));

View File

@ -1325,7 +1325,7 @@ SWITCH_DECLARE(switch_status_t) switch_jb_get_packet(switch_jb_t *jb, switch_rtp
if (switch_channel_test_flag(jb->channel, CF_VIDEO_BITRATE_UNMANAGABLE) && jb->frame_len == jb->min_frame_len) {
jb_debug(jb, 2, "%s", "Allow BITRATE changes\n");
switch_channel_clear_flag(jb->channel, CF_VIDEO_BITRATE_UNMANAGABLE);
switch_channel_clear_flag_recursive(jb->channel, CF_VIDEO_BITRATE_UNMANAGABLE);
jb->bitrate_control = 0;
if (jb->session) {
switch_core_session_request_video_refresh(jb->session);
@ -1342,7 +1342,7 @@ SWITCH_DECLARE(switch_status_t) switch_jb_get_packet(switch_jb_t *jb, switch_rtp
jb_debug(jb, 2, "Force BITRATE to %d\n", jb->bitrate_control);
switch_core_session_receive_message(jb->session, &msg);
switch_channel_set_flag(jb->channel, CF_VIDEO_BITRATE_UNMANAGABLE);
switch_channel_set_flag_recursive(jb->channel, CF_VIDEO_BITRATE_UNMANAGABLE);
if (jb->session) {
switch_core_session_request_video_refresh(jb->session);
}