From 2bdefa3532cded8c4e4ad695c475c1394b01de00 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 24 Jul 2019 15:28:04 +0000 Subject: [PATCH] [core] add a flag to tell when video media bugs that touch the write stream are active --- src/include/switch_types.h | 2 ++ src/switch_core_media_bug.c | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 2baddf0101..674de974d0 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -1630,6 +1630,8 @@ typedef enum { CF_WANT_DTLSv1_2, CF_RFC7329_COMPAT, CF_REATTACHED, + CF_VIDEO_READ_TAPPED, + CF_VIDEO_WRITE_TAPPED, /* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */ /* IF YOU ADD NEW ONES CHECK IF THEY SHOULD PERSIST OR ZERO THEM IN switch_core_session.c switch_core_session_request_xml() */ CF_FLAG_MAX diff --git a/src/switch_core_media_bug.c b/src/switch_core_media_bug.c index 4e92c2d9e6..eca4c495d2 100644 --- a/src/switch_core_media_bug.c +++ b/src/switch_core_media_bug.c @@ -918,6 +918,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_add(switch_core_session_t if (switch_test_flag(bug, SMBF_READ_VIDEO_STREAM) || switch_test_flag(bug, SMBF_WRITE_VIDEO_STREAM) || switch_test_flag(bug, SMBF_READ_VIDEO_PING) || switch_test_flag(bug, SMBF_WRITE_VIDEO_PING)) { switch_channel_set_flag_recursive(session->channel, CF_VIDEO_DECODED_READ); + + if (switch_test_flag(bug, SMBF_READ_VIDEO_STREAM) || switch_test_flag(bug, SMBF_READ_VIDEO_PING)) { + switch_channel_set_flag_recursive(session->channel, CF_VIDEO_READ_TAPPED); + } + + if (switch_test_flag(bug, SMBF_WRITE_VIDEO_STREAM) || switch_test_flag(bug, SMBF_WRITE_VIDEO_PING)) { + switch_channel_set_flag_recursive(session->channel, CF_VIDEO_WRITE_TAPPED); + } } if (switch_test_flag(bug, SMBF_SPY_VIDEO_STREAM) || switch_core_media_bug_test_flag(bug, SMBF_SPY_VIDEO_STREAM_BLEG)) { @@ -1297,6 +1305,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_close(switch_media_bug_t * if (switch_test_flag(bp, SMBF_READ_VIDEO_STREAM) || switch_test_flag(bp, SMBF_WRITE_VIDEO_STREAM) || switch_test_flag(bp, SMBF_READ_VIDEO_PING) || switch_test_flag(bp, SMBF_WRITE_VIDEO_PING)) { switch_channel_clear_flag_recursive(bp->session->channel, CF_VIDEO_DECODED_READ); + + if (switch_test_flag(bp, SMBF_READ_VIDEO_STREAM) || switch_test_flag(bp, SMBF_READ_VIDEO_PING)) { + switch_channel_clear_flag_recursive(bp->session->channel, CF_VIDEO_READ_TAPPED); + } + + if (switch_test_flag(bp, SMBF_WRITE_VIDEO_STREAM) || switch_test_flag(bp, SMBF_WRITE_VIDEO_PING)) { + switch_channel_clear_flag_recursive(bp->session->channel, CF_VIDEO_WRITE_TAPPED); + } } bp->ready = 0;