From 5ceb2cf83f1d92384ec8588c522920c91da547df Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Wed, 27 Nov 2019 15:22:35 +0100 Subject: [PATCH] rtsp-sdp: Don't try to use non-initialized values Only attempt to use the various timing values iif gst_rtsp_stream_get_info() returns TRUE. Also avoid the whole clock signalling block if we're not dealing with senders. CID: 1439524 CID: 1439536 CID: 1439520 --- gst/rtsp-server/rtsp-sdp.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/gst/rtsp-server/rtsp-sdp.c b/gst/rtsp-server/rtsp-sdp.c index 701cea5..9a2a247 100644 --- a/gst/rtsp-server/rtsp-sdp.c +++ b/gst/rtsp-server/rtsp-sdp.c @@ -295,7 +295,7 @@ gst_rtsp_sdp_make_media (GstSDPMessage * sdp, GstSDPInfo * info, } /* RFC 7273 clock signalling */ - { + if (gst_rtsp_stream_is_sender (stream)) { GstBin *joined_bin = gst_rtsp_stream_get_joined_bin (stream); GstClock *clock = gst_element_get_clock (GST_ELEMENT_CAST (joined_bin)); gchar *ts_refclk = NULL; @@ -305,9 +305,9 @@ gst_rtsp_sdp_make_media (GstSDPMessage * sdp, GstSDPInfo * info, GstRTSPPublishClockMode publish_clock_mode = gst_rtsp_stream_get_publish_clock_mode (stream); - if (gst_rtsp_stream_is_sender (stream)) - gst_rtsp_stream_get_rtpinfo (stream, &rtptime, NULL, &clock_rate, - &running_time); + if (!gst_rtsp_stream_get_rtpinfo (stream, &rtptime, NULL, &clock_rate, + &running_time)) + goto clock_signalling_cleanup; base_time = gst_element_get_base_time (GST_ELEMENT_CAST (joined_bin)); g_assert (base_time != GST_CLOCK_TIME_NONE); clock_time = running_time + base_time; @@ -374,6 +374,7 @@ gst_rtsp_sdp_make_media (GstSDPMessage * sdp, GstSDPInfo * info, } } } + clock_signalling_cleanup: if (clock) gst_object_unref (clock); -- 2.7.4