diff options
author | Wim Taymans <wtaymans@redhat.com> | 2014-02-04 10:14:45 +0100 |
---|---|---|
committer | Wim Taymans <wtaymans@redhat.com> | 2014-02-04 10:14:45 +0100 |
commit | 71c45fce5a50146ca799215874095679708872d3 (patch) | |
tree | 0569b8f07da47c481e1a49bf81cee203fba76b5e | |
parent | f9355e5481fbb26c61a1b4eae361499c3e2f8722 (diff) |
stream: add fallback for missing stats property
Use a fallback when the payloader does not have a stats property
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=723554
-rw-r--r-- | gst/rtsp-server/rtsp-stream.c | 41 |
1 files changed, 26 insertions, 15 deletions
diff --git a/gst/rtsp-server/rtsp-stream.c b/gst/rtsp-server/rtsp-stream.c index dfc0349..96485df 100644 --- a/gst/rtsp-server/rtsp-stream.c +++ b/gst/rtsp-server/rtsp-stream.c @@ -1880,35 +1880,46 @@ gst_rtsp_stream_get_rtpinfo (GstRTSPStream * stream, { GstRTSPStreamPrivate *priv; GstStructure *stats; + GObjectClass *payobjclass; g_return_val_if_fail (GST_IS_RTSP_STREAM (stream), FALSE); priv = stream->priv; + payobjclass = G_OBJECT_GET_CLASS (priv->payloader); + g_mutex_lock (&priv->lock); - g_object_get (priv->payloader, "stats", &stats, NULL); + if (g_object_class_find_property (payobjclass, "stats")) { + g_object_get (priv->payloader, "stats", &stats, NULL); + if (stats == NULL) + goto no_stats; + + if (seq) + gst_structure_get_uint (stats, "seqnum", seq); - if (stats == NULL) - goto no_stats; + if (rtptime) + gst_structure_get_uint (stats, "timestamp", rtptime); - if (seq) - gst_structure_get_uint (stats, "seqnum", seq); + if (running_time) + gst_structure_get_clock_time (stats, "running-time", running_time); - if (rtptime) - gst_structure_get_uint (stats, "timestamp", rtptime); + if (clock_rate) { + gst_structure_get_uint (stats, "clock-rate", clock_rate); + if (*clock_rate == 0 && running_time) + *running_time = GST_CLOCK_TIME_NONE; + } + gst_structure_free (stats); + } else { + if (!g_object_class_find_property (payobjclass, "seqnum") || + !g_object_class_find_property (payobjclass, "timestamp")) + goto no_stats; - if (running_time) - gst_structure_get_clock_time (stats, "running-time", running_time); + g_object_get (priv->payloader, "seqnum", seq, "timestamp", rtptime, NULL); - if (clock_rate) { - gst_structure_get_uint (stats, "clock-rate", clock_rate); - if (*clock_rate == 0 && running_time) + if (running_time) *running_time = GST_CLOCK_TIME_NONE; } - - gst_structure_free (stats); - g_mutex_unlock (&priv->lock); return TRUE; |