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>
This commit is contained in:
Mathieu Duponchelle 2020-11-18 20:36:50 +01:00
parent c1ede049eb
commit 5b08a6042d

View file

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