From a8899b9c75f9762e918a8892a6a4d566ebe0f199 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 10 Apr 2020 21:36:37 +0000 Subject: [PATCH] [mod_verto] get the conference to send a keyframe when you reload/attach so the video shows up faster --- .../mod_conference/conference_video.c | 3 ++- src/mod/endpoints/mod_verto/mod_verto.c | 18 +++++++++++++----- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/mod/applications/mod_conference/conference_video.c b/src/mod/applications/mod_conference/conference_video.c index 357f30a560..e94b835c3d 100644 --- a/src/mod/applications/mod_conference/conference_video.c +++ b/src/mod/applications/mod_conference/conference_video.c @@ -3344,7 +3344,8 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr if (imember->watching_canvas_id == canvas->canvas_id && switch_channel_test_flag(imember->channel, CF_VIDEO_REFRESH_REQ)) { switch_channel_clear_flag(imember->channel, CF_VIDEO_REFRESH_REQ); - send_keyframe = SWITCH_TRUE; + canvas->send_keyframe = 30; + send_keyframe = 1; } if (conference_utils_test_flag(conference, CFLAG_MINIMIZE_VIDEO_ENCODING) && diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index 4d02fee4f8..a5c0c1c841 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -1239,6 +1239,8 @@ static void tech_reattach(verto_pvt_t *tech_pvt, jsock_t *jsock) switch_channel_get_name(tech_pvt->channel), tech_pvt->mparams->local_sdp_str); set_call_params(params, tech_pvt); + switch_core_media_gen_key_frame(tech_pvt->session); + switch_channel_set_flag(tech_pvt->channel, CF_VIDEO_REFRESH_REQ); jsock_queue_event(jsock, &msg, SWITCH_TRUE); } @@ -3484,6 +3486,17 @@ static switch_bool_t verto__attach_func(const char *method, cJSON *params, jsock } } + if (tech_pvt) { + if (err) { + if (tech_pvt->channel) { + switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_BEARERCAPABILITY_NOTAVAIL); + } + } else { + switch_core_media_gen_key_frame(tech_pvt->session); + switch_channel_set_flag(tech_pvt->channel, CF_VIDEO_REFRESH_REQ); + } + } + if (session) { switch_core_session_rwunlock(session); } @@ -3492,11 +3505,6 @@ static switch_bool_t verto__attach_func(const char *method, cJSON *params, jsock return SWITCH_TRUE; } - if (tech_pvt && tech_pvt->channel) { - switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_BEARERCAPABILITY_NOTAVAIL); - } - - cJSON_AddItemToObject(obj, "code", cJSON_CreateNumber(CODE_SESSION_ERROR)); return SWITCH_FALSE;