summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathieu Duponchelle <mathieu@centricular.com>2020-11-18 20:36:50 +0100
committerMathieu Duponchelle <mathieu@centricular.com>2020-11-18 20:36:50 +0100
commit5b08a6042d11b4278cf74c8912699c1854188ce0 (patch)
tree4769402bd374db29fe67b50a0bb9a9d15acb803d
parentc1ede049eb0c15e3a2452f461b05d7fc4273ff1c (diff)
rtsp-stream: collect a clock_rate when blocking
This lets us provide a clock_rate in a fashion similar to the other code paths in get_rtpinfo() Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/174>
-rw-r--r--gst/rtsp-server/rtsp-stream.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/gst/rtsp-server/rtsp-stream.c b/gst/rtsp-server/rtsp-stream.c
index ddf7ba4..c94e6ee 100644
--- a/gst/rtsp-server/rtsp-stream.c
+++ b/gst/rtsp-server/rtsp-stream.c
@@ -220,6 +220,7 @@ struct _GstRTSPStreamPrivate
guint32 blocked_seqnum;
guint32 blocked_rtptime;
GstClockTime blocked_running_time;
+ gint blocked_clock_rate;
/* Whether we should send and receive RTCP */
gboolean enable_rtcp;
@@ -4344,6 +4345,14 @@ gst_rtsp_stream_get_rtpinfo (GstRTSPStream * stream,
goto stats;
*running_time = priv->blocked_running_time;
}
+
+ if (clock_rate) {
+ *clock_rate = priv->blocked_clock_rate;
+
+ if (*clock_rate == 0 && running_time)
+ *running_time = GST_CLOCK_TIME_NONE;
+ }
+
goto done;
}
}
@@ -5306,6 +5315,17 @@ pad_blocking (GstPad * pad, GstPadProbeInfo * info, gpointer user_data)
gst_event_unref (event);
}
+ event = gst_pad_get_sticky_event (pad, GST_EVENT_CAPS, 0);
+ if (event) {
+ GstCaps *caps;
+ GstStructure *s;
+
+ gst_event_parse_caps (event, &caps);
+ s = gst_caps_get_structure (caps, 0);
+ gst_structure_get_int (s, "clock-rate", &priv->blocked_clock_rate);
+ gst_event_unref (event);
+ }
+
priv->blocking = TRUE;
GST_DEBUG_OBJECT (pad, "Now blocking");
@@ -5347,6 +5367,7 @@ set_blocked (GstRTSPStream * stream, gboolean blocked)
priv->blocking = FALSE;
priv->blocked_buffer = FALSE;
priv->blocked_running_time = GST_CLOCK_TIME_NONE;
+ priv->blocked_clock_rate = 0;
priv->blocked_id[i] = gst_pad_add_probe (priv->send_src[i],
GST_PAD_PROBE_TYPE_BLOCK | GST_PAD_PROBE_TYPE_BUFFER |
GST_PAD_PROBE_TYPE_BUFFER_LIST |
@@ -6243,8 +6264,8 @@ gst_rtsp_stream_set_rate_control (GstRTSPStream * stream, gboolean enabled)
if (stream->priv->appsink[0])
g_object_set (stream->priv->appsink[0], "sync", enabled, NULL);
if (stream->priv->payloader
- && g_object_class_find_property (G_OBJECT_GET_CLASS (stream->priv->
- payloader), "onvif-no-rate-control"))
+ && g_object_class_find_property (G_OBJECT_GET_CLASS (stream->
+ priv->payloader), "onvif-no-rate-control"))
g_object_set (stream->priv->payloader, "onvif-no-rate-control", !enabled,
NULL);
if (stream->priv->session) {