uint32_t samples_per_frame;
uint32_t samples_per_second;
uint32_t bitrate_control;
+ uint32_t video_low_bitrate;
uint8_t write_init;
uint8_t read_init;
uint8_t debug_level;
SWITCH_DECLARE(void) switch_jb_set_session(switch_jb_t *jb, switch_core_session_t *session)
{
+ const char *var;
+
jb->session = session;
jb->channel = switch_core_session_get_channel(session);
+
+ if (jb->type == SJB_VIDEO && (var = switch_channel_get_variable_dup(jb->channel, "jb_video_low_bitrate", SWITCH_FALSE, -1))) {
+ int tmp = atoi(var);
+
+ if (tmp > 128 && tmp < 10240) {
+ jb->video_low_bitrate = (uint32_t)tmp;
+ }
+ }
+
}
SWITCH_DECLARE(void) switch_jb_set_flag(switch_jb_t *jb, switch_jb_flag_t flag)
jb->consec_miss_count = 0;
jb->consec_good_count = 0;
- if (jb->type == SJB_VIDEO && jb->channel) {
+ if (jb->type == SJB_VIDEO && jb->channel && jb->video_low_bitrate) {
//switch_time_t now = switch_time_now();
//int ok = (now - jb->last_bitrate_change) > 10000;
if (jb->session) {
switch_core_session_request_video_refresh(jb->session);
}
- } else if (!switch_channel_test_flag(jb->channel, CF_VIDEO_BITRATE_UNMANAGABLE) && jb->frame_len > jb->min_frame_len + 1) {
+ } else if (!switch_channel_test_flag(jb->channel, CF_VIDEO_BITRATE_UNMANAGABLE) && jb->frame_len > jb->min_frame_len * 2) {
switch_core_session_message_t msg = { 0 };
- jb->bitrate_control = 512;
+ jb->bitrate_control = jb->video_low_bitrate;
msg.message_id = SWITCH_MESSAGE_INDICATE_BITRATE_REQ;
msg.numeric_arg = jb->bitrate_control * 1024;