From de3b0a09577cd268e795eab007850cbab32124d1 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 26 Aug 2015 12:10:34 -0500 Subject: [PATCH] FS-8053 #resolve [When WebRTC's SDP contains a=sendonly for video, the client will still receive the video stream] --- .../applications/mod_conference/conference_video.c | 12 ++++++++++++ src/switch_core_media.c | 10 ++++++++++ 2 files changed, 22 insertions(+) diff --git a/src/mod/applications/mod_conference/conference_video.c b/src/mod/applications/mod_conference/conference_video.c index 08d2a91dc7..6e1c1d0d2f 100644 --- a/src/mod/applications/mod_conference/conference_video.c +++ b/src/mod/applications/mod_conference/conference_video.c @@ -1264,6 +1264,10 @@ void conference_video_write_canvas_image_to_codec_group(conference_obj_t *confer continue; } + if (imember->video_flow == SWITCH_MEDIA_FLOW_RECVONLY) { + continue; + } + if (!imember->session || !switch_channel_test_flag(imember->channel, CF_VIDEO) || switch_core_session_read_lock(imember->session) != SWITCH_STATUS_SUCCESS) { continue; @@ -2588,6 +2592,10 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr continue; } + if (imember->video_flow == SWITCH_MEDIA_FLOW_RECVONLY) { + continue; + } + if (need_refresh) { switch_core_session_request_video_refresh(imember->session); } @@ -2922,6 +2930,10 @@ void *SWITCH_THREAD_FUNC conference_video_super_muxing_thread_run(switch_thread_ continue; } + if (imember->video_flow == SWITCH_MEDIA_FLOW_RECVONLY) { + continue; + } + if (!imember->session || !switch_channel_test_flag(imember->channel, CF_VIDEO) || switch_core_session_read_lock(imember->session) != SWITCH_STATUS_SUCCESS) { continue; diff --git a/src/switch_core_media.c b/src/switch_core_media.c index 9d7406d561..0d4cad757a 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -10440,6 +10440,11 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_encoded_video_frame(sw switch_io_event_hook_video_write_frame_t *ptr; switch_status_t status = SWITCH_STATUS_FALSE; + if (switch_core_session_media_flow(session, SWITCH_MEDIA_TYPE_VIDEO) == SWITCH_MEDIA_FLOW_RECVONLY) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Writing video to RECVONLY session\n"); + return SWITCH_STATUS_SUCCESS; + } + if (session->endpoint_interface->io_routines->write_video_frame) { if ((status = session->endpoint_interface->io_routines->write_video_frame(session, frame, flags, stream_id)) == SWITCH_STATUS_SUCCESS) { for (ptr = session->event_hooks.video_write_frame; ptr; ptr = ptr->next) { @@ -10506,6 +10511,11 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_video_frame(switch_cor return SWITCH_STATUS_FALSE; } + if (switch_core_session_media_flow(session, SWITCH_MEDIA_TYPE_VIDEO) == SWITCH_MEDIA_FLOW_RECVONLY) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Writing video to RECVONLY session\n"); + return SWITCH_STATUS_SUCCESS; + } + if (switch_channel_test_flag(session->channel, CF_VIDEO_PAUSE_WRITE)) { return SWITCH_STATUS_SUCCESS; }