media-factory: unref old clock when setting new clock

https://bugzilla.gnome.org/show_bug.cgi?id=796724
This commit is contained in:
Tim-Philipp Müller 2018-07-12 19:01:54 +01:00
parent f304096994
commit 7f7a210b84

View file

@ -1380,13 +1380,14 @@ void
gst_rtsp_media_factory_set_clock (GstRTSPMediaFactory * factory,
GstClock * clock)
{
GstRTSPMediaFactoryPrivate *priv;
GstClock **clock_p;
g_return_if_fail (GST_IS_RTSP_MEDIA_FACTORY (factory));
g_return_if_fail (GST_IS_CLOCK (clock) || clock == NULL);
GST_RTSP_MEDIA_FACTORY_LOCK (factory);
priv = factory->priv;
priv->clock = clock ? gst_object_ref (clock) : NULL;
clock_p = &factory->priv->clock;
gst_object_replace ((GstObject **) clock_p, (GstObject *) clock);
GST_RTSP_MEDIA_FACTORY_UNLOCK (factory);
}
@ -1407,6 +1408,8 @@ gst_rtsp_media_factory_get_clock (GstRTSPMediaFactory * factory)
GstRTSPMediaFactoryPrivate *priv;
GstClock *ret;
g_return_val_if_fail (GST_IS_RTSP_MEDIA_FACTORY (factory), NULL);
GST_RTSP_MEDIA_FACTORY_LOCK (factory);
priv = factory->priv;
ret = priv->clock ? gst_object_ref (priv->clock) : NULL;