]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-10259: [freeswitch-core,mod_commands,mod_conference] Allow uuid_video_bitrate...
authorAnthony Minessale <anthm@freeswitch.org>
Fri, 21 Apr 2017 21:15:53 +0000 (16:15 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Fri, 21 Apr 2017 21:15:53 +0000 (16:15 -0500)
src/mod/applications/mod_commands/mod_commands.c
src/switch_jitterbuffer.c

index 29febefc531c65100dc2c98e405bf4e99c13f6ae..77d4120d567e904646e0c48d3f3fc0679369bb54 100644 (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));
index 9e37a5f99ab3d4ee349715304e5c4daeb0a48ffa..bc927fd916a905be060c9d0d0aee1365c7179a56 100644 (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);
                                }