mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-03-15 13:14:03 +00:00
FS-7499 FS-7513 try to avoid storm of refreshes in heavy usage
This commit is contained in:
parent
dc4c38dab5
commit
02cac73d37
@ -1666,9 +1666,9 @@ static void write_canvas_image_to_codec_group(conference_obj_t *conference, code
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (need_refresh) {
|
//if (need_refresh) {
|
||||||
switch_core_session_request_video_refresh(imember->session);
|
// switch_core_session_request_video_refresh(imember->session);
|
||||||
}
|
//}
|
||||||
|
|
||||||
//switch_core_session_write_encoded_video_frame(imember->session, frame, 0, 0);
|
//switch_core_session_write_encoded_video_frame(imember->session, frame, 0, 0);
|
||||||
switch_set_flag(frame, SFF_ENCODED);
|
switch_set_flag(frame, SFF_ENCODED);
|
||||||
@ -1754,9 +1754,11 @@ static void *SWITCH_THREAD_FUNC conference_video_muxing_write_thread_run(switch_
|
|||||||
switch_core_media_gen_key_frame(member->session);
|
switch_core_media_gen_key_frame(member->session);
|
||||||
switch_core_session_request_video_refresh(member->session);
|
switch_core_session_request_video_refresh(member->session);
|
||||||
}
|
}
|
||||||
|
|
||||||
loops++;
|
loops++;
|
||||||
|
|
||||||
frame = (switch_frame_t *) pop;
|
frame = (switch_frame_t *) pop;
|
||||||
|
|
||||||
if (switch_test_flag(frame, SFF_ENCODED)) {
|
if (switch_test_flag(frame, SFF_ENCODED)) {
|
||||||
switch_core_session_write_encoded_video_frame(member->session, frame, 0, 0);
|
switch_core_session_write_encoded_video_frame(member->session, frame, 0, 0);
|
||||||
} else {
|
} else {
|
||||||
@ -1874,6 +1876,7 @@ static void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread
|
|||||||
switch_image_t *write_img = NULL, *file_img = NULL;
|
switch_image_t *write_img = NULL, *file_img = NULL;
|
||||||
uint32_t timestamp = 0, avatar_layers = 0;
|
uint32_t timestamp = 0, avatar_layers = 0;
|
||||||
video_layout_t *vlayout = get_layout(conference);
|
video_layout_t *vlayout = get_layout(conference);
|
||||||
|
switch_time_t last_refresh_req = 0;
|
||||||
|
|
||||||
if (!vlayout) {
|
if (!vlayout) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot find layout\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot find layout\n");
|
||||||
@ -1948,7 +1951,11 @@ static void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread
|
|||||||
if (switch_test_flag(conference, CFLAG_MINIMIZE_VIDEO_ENCODING) && switch_channel_test_flag(imember->channel, CF_VIDEO)) {
|
if (switch_test_flag(conference, CFLAG_MINIMIZE_VIDEO_ENCODING) && switch_channel_test_flag(imember->channel, CF_VIDEO)) {
|
||||||
if (switch_channel_test_flag(imember->channel, CF_VIDEO_REFRESH_REQ)) {
|
if (switch_channel_test_flag(imember->channel, CF_VIDEO_REFRESH_REQ)) {
|
||||||
switch_channel_clear_flag(imember->channel, CF_VIDEO_REFRESH_REQ);
|
switch_channel_clear_flag(imember->channel, CF_VIDEO_REFRESH_REQ);
|
||||||
|
|
||||||
|
if (!last_refresh_req || (now - last_refresh_req) > 1000) {
|
||||||
need_refresh = SWITCH_TRUE;
|
need_refresh = SWITCH_TRUE;
|
||||||
|
last_refresh_req = now;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (imember->video_codec_index < 0 && (check_codec = switch_core_session_get_video_write_codec(imember->session))) {
|
if (imember->video_codec_index < 0 && (check_codec = switch_core_session_get_video_write_codec(imember->session))) {
|
||||||
@ -2021,6 +2028,11 @@ static void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread
|
|||||||
|
|
||||||
if (flushed && imember->blanks) {
|
if (flushed && imember->blanks) {
|
||||||
switch_img_free(&imember->avatar_png_img);
|
switch_img_free(&imember->avatar_png_img);
|
||||||
|
|
||||||
|
if (layer) {
|
||||||
|
layer->is_avatar = 0;
|
||||||
|
}
|
||||||
|
|
||||||
imember->blanks = 0;
|
imember->blanks = 0;
|
||||||
switch_core_session_request_video_refresh(imember->session);
|
switch_core_session_request_video_refresh(imember->session);
|
||||||
switch_channel_video_sync(imember->channel);
|
switch_channel_video_sync(imember->channel);
|
||||||
|
@ -1295,6 +1295,9 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
|||||||
#if 1
|
#if 1
|
||||||
case SWITCH_MESSAGE_INDICATE_VIDEO_REFRESH_REQ:
|
case SWITCH_MESSAGE_INDICATE_VIDEO_REFRESH_REQ:
|
||||||
{
|
{
|
||||||
|
const char *ua = switch_channel_get_variable(tech_pvt->channel, "sip_user_agent");
|
||||||
|
if (ua && switch_stristr("polycom", ua)) {
|
||||||
|
|
||||||
//const char *pl = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<media_control>\n<vc_primitive>\n<to_encoder>\n<picture_fast_update>\n</picture_fast_update>\n</to_encoder>\n</vc_primitive>\n</media_control>";
|
//const char *pl = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<media_control>\n<vc_primitive>\n<to_encoder>\n<picture_fast_update>\n</picture_fast_update>\n</to_encoder>\n</vc_primitive>\n</media_control>";
|
||||||
const char *pl = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<media_control><vc_primitive><to_encoder><picture_fast_update /></to_encoder></vc_primitive></media_control>\n";
|
const char *pl = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<media_control><vc_primitive><to_encoder><picture_fast_update /></to_encoder></vc_primitive></media_control>\n";
|
||||||
time_t now = switch_epoch_time_now(NULL);
|
time_t now = switch_epoch_time_now(NULL);
|
||||||
@ -1309,7 +1312,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
|||||||
|
|
||||||
nua_info(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("application/media_control+xml"), SIPTAG_PAYLOAD_STR(pl), TAG_END());
|
nua_info(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("application/media_control+xml"), SIPTAG_PAYLOAD_STR(pl), TAG_END());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user