From 47d4164a0970844be9e3a9bdb69461e8c257c77e Mon Sep 17 00:00:00 2001 From: Evangelos Ribeiro Tzaras Date: Thu, 7 Apr 2022 15:29:39 +0200 Subject: [PATCH] sip: media-pipeline: Take srtp into account when determing pipeline state If we're using srtp we should also consider the state of srtpenc and srtpdec elements when determining the state of the whole pipeline. --- plugins/sip/calls-sip-media-pipeline.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/plugins/sip/calls-sip-media-pipeline.c b/plugins/sip/calls-sip-media-pipeline.c index 7cfb4f7..1e58294 100644 --- a/plugins/sip/calls-sip-media-pipeline.c +++ b/plugins/sip/calls-sip-media-pipeline.c @@ -206,22 +206,25 @@ set_state (CallsSipMediaPipeline *self, static void check_element_maps (CallsSipMediaPipeline *self) { + uint all_rtp_elements; + g_assert (CALLS_IS_SIP_MEDIA_PIPELINE (self)); - /* TODO take encryption into account */ - if (self->element_map_playing == EL_ALL_RTP) { + all_rtp_elements = self->use_srtp ? EL_ALL_SRTP : EL_ALL_RTP; + + if (self->element_map_playing == all_rtp_elements) { g_debug ("All pipeline elements are playing"); set_state (self, CALLS_MEDIA_PIPELINE_STATE_PLAYING); return; } - if (self->element_map_paused == EL_ALL_RTP) { + if (self->element_map_paused == all_rtp_elements) { g_debug ("All pipeline elements are paused"); set_state (self, CALLS_MEDIA_PIPELINE_STATE_PAUSED); return; } - if (self->element_map_stopped == EL_ALL_RTP) { + if (self->element_map_stopped == all_rtp_elements) { g_debug ("All pipeline elements are stopped"); set_state (self, CALLS_MEDIA_PIPELINE_STATE_STOPPED); return; @@ -319,13 +322,10 @@ on_bus_message (GstBus *bus, else if (message->src == GST_OBJECT (self->rtcp_sink)) element_id = EL_RTCP_SINK; - /* TODO srtp encryption - else if (message->src == GST_OBJECT (self->srtpenc)) - element_id = EL_SRTP_ENCODER; - else if (message->src == GST_OBJECT (self->srtpdec)) - element_id = EL_SRTP_DECODER; - */ - + else if (message->src == GST_OBJECT (self->srtpenc)) + element_id = EL_SRTP_ENCODER; + else if (message->src == GST_OBJECT (self->srtpdec)) + element_id = EL_SRTP_DECODER; else if (message->src == GST_OBJECT (self->audio_src)) element_id = EL_AUDIO_SRC;