diff --git a/src/switch_core_media.c b/src/switch_core_media.c index d4602afd51..3b6b8cfc21 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -5142,8 +5142,11 @@ SWITCH_DECLARE(int) switch_core_media_toggle_hold(switch_core_session_t *session end: + switch_core_session_request_video_refresh(session); + if (b_session) { + switch_core_session_request_video_refresh(b_session); switch_core_session_rwunlock(b_session); } @@ -5229,8 +5232,11 @@ static void switch_core_session_write_blank_video(switch_core_session_t *session frame_ms = (uint32_t) 1000 / fps; frames = (uint32_t) ms / frame_ms; + + switch_core_media_gen_key_frame(session); for (i = 0; i < frames; i++) { + fr.img = blank_img; switch_core_session_write_video_frame(session, &fr, SWITCH_IO_FLAG_NONE, 0); switch_yield(frame_ms * 1000); } @@ -5462,10 +5468,11 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_set_video_file(switch_core_ses } switch_core_media_gen_key_frame(session); + switch_core_session_request_video_refresh(session); if (fh) { switch_threadattr_t *thd_attr = NULL; - switch_core_session_write_blank_video(session, 200); + switch_core_session_write_blank_video(session, 500); switch_threadattr_create(&thd_attr, switch_core_session_get_pool(session)); switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE); smh->video_write_thread_running = 1; @@ -5482,7 +5489,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_set_video_file(switch_core_ses switch_thread_join(&st, smh->video_write_thread); switch_mutex_lock(v_engine->mh.file_write_mutex); smh->video_write_thread = NULL; - switch_core_session_write_blank_video(session, 200); + switch_core_session_write_blank_video(session, 500); } smh->video_write_fh = fh; @@ -11324,17 +11331,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_codec_control(switch_core_sess } if (codec) { - if (cmd == SCC_VIDEO_GEN_KEYFRAME) { - switch_time_t now = switch_micro_time_now(); - - if (smh->last_codec_refresh && (now - smh->last_codec_refresh) < VIDEO_REFRESH_FREQ) { - return SWITCH_STATUS_BREAK; - } - - smh->last_codec_refresh = now; - switch_channel_set_flag(session->channel, CF_VIDEO_REFRESH_REQ); - } - return switch_core_codec_control(codec, cmd, ctype, cmd_data, atype, cmd_arg, rtype, ret_data); } diff --git a/src/switch_ivr_bridge.c b/src/switch_ivr_bridge.c index 087b332739..bc42bcf8f2 100644 --- a/src/switch_ivr_bridge.c +++ b/src/switch_ivr_bridge.c @@ -73,6 +73,7 @@ static void video_bridge_thread(switch_core_session_t *session, void *obj) if (switch_channel_test_flag(channel, CF_VIDEO_REFRESH_REQ)) { + switch_channel_clear_flag(channel, CF_VIDEO_REFRESH_REQ); refresh_timer = refresh_cnt; } @@ -100,10 +101,7 @@ static void video_bridge_thread(switch_core_session_t *session, void *obj) if (refresh_timer) { if (refresh_timer > 0 && (refresh_timer % 100) == 0) { - switch_core_session_request_video_refresh(vh->session_a); switch_core_session_request_video_refresh(vh->session_b); - switch_core_media_gen_key_frame(vh->session_a); - switch_core_media_gen_key_frame(vh->session_b); } refresh_timer--; } @@ -114,20 +112,12 @@ static void video_bridge_thread(switch_core_session_t *session, void *obj) switch_cond_next(); continue; } - - - if (switch_test_flag(read_frame, SFF_CNG)) { - switch_core_session_request_video_refresh(vh->session_a); - continue; - } } - if (switch_channel_test_flag(channel, CF_LEG_HOLDING) || switch_channel_test_flag(b_channel, CF_VIDEO_READ_FILE_ATTACHED)) { - switch_channel_video_sync(channel); - switch_core_session_write_video_frame(session, read_frame, SWITCH_IO_FLAG_NONE, 0); + if (switch_test_flag(read_frame, SFF_CNG) || + switch_channel_test_flag(channel, CF_LEG_HOLDING) || switch_channel_test_flag(b_channel, CF_VIDEO_READ_FILE_ATTACHED)) { continue; } - if (switch_channel_media_up(b_channel)) { if (switch_core_session_write_video_frame(vh->session_b, read_frame, SWITCH_IO_FLAG_NONE, 0) != SWITCH_STATUS_SUCCESS) { diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 5212813acc..90ee9e4cae 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -5929,14 +5929,18 @@ static switch_status_t process_rtcp_report(switch_rtp_t *rtp_session, rtcp_msg_t if (rtp_session->flags[SWITCH_RTP_FLAG_VIDEO] && (msg->header.type == _RTCP_PT_RTPFB || msg->header.type == _RTCP_PT_PSFB)) { rtcp_ext_msg_t *extp = (rtcp_ext_msg_t *) msg; - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG1, "PICKED UP %s XRTCP type: %d fmt: %d\n", - rtp_type(rtp_session), msg->header.type, extp->header.fmt); + if (extp->header.fmt != 15) { // <---- REMOVE WHEN BRIA STOPS SENDING UNSOLICITED REMB + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG1, "PICKED UP %s XRTCP type: %d fmt: %d\n", + rtp_type(rtp_session), msg->header.type, extp->header.fmt); + } if (msg->header.type == _RTCP_PT_PSFB && (extp->header.fmt == _RTCP_PSFB_FIR || extp->header.fmt == _RTCP_PSFB_PLI)) { switch_core_media_gen_key_frame(rtp_session->session); if (rtp_session->vbw) { switch_jb_reset(rtp_session->vbw); } + + switch_channel_set_flag(switch_core_session_get_channel(rtp_session->session), CF_VIDEO_REFRESH_REQ); } if (msg->header.type == _RTCP_PT_RTPFB && extp->header.fmt == _RTCP_RTPFB_NACK) {