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
This commit is contained in:
Edward Hervey 2019-11-27 15:22:35 +01:00
parent 9c5ca231a6
commit 5ceb2cf83f

View file

@ -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);