rtspclientsink: Add publish-clock-mode property

This allows modifying the behaviour how/if the pipeline clock is
published according to RFC7273, similar to the same API on
`GstRTSPMedia`.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3581>
This commit is contained in:
Sebastian Dröge 2022-12-16 11:16:52 +02:00 committed by GStreamer Marge Bot
parent ce50e13e28
commit 5f2989d5a1
3 changed files with 38 additions and 1 deletions

View file

@ -174,6 +174,18 @@
"type": "gchararray",
"writable": true
},
"publish-clock-mode": {
"blurb": "Clock publishing mode according to RFC7273",
"conditionally-available": false,
"construct": false,
"construct-only": false,
"controllable": false,
"default": "clock (1)",
"mutable": "null",
"readable": true,
"type": "GstRTSPPublishClockMode",
"writable": true
},
"retry": {
"blurb": "Max number of retries when allocating RTP ports.",
"conditionally-available": false,

View file

@ -304,6 +304,7 @@ gst_rtsp_client_sink_ntp_time_source_get_type (void)
#define DEFAULT_USER_AGENT "GStreamer/" PACKAGE_VERSION
#define DEFAULT_PROFILES GST_RTSP_PROFILE_AVP
#define DEFAULT_RTX_TIME_MS 500
#define DEFAULT_PUBLISH_CLOCK_MODE GST_RTSP_PUBLISH_CLOCK_MODE_CLOCK
enum
{
@ -333,7 +334,8 @@ enum
PROP_TLS_INTERACTION,
PROP_NTP_TIME_SOURCE,
PROP_USER_AGENT,
PROP_PROFILES
PROP_PROFILES,
PROP_PUBLISH_CLOCK_MODE,
};
static void gst_rtsp_client_sink_finalize (GObject * object);
@ -732,6 +734,20 @@ gst_rtsp_client_sink_class_init (GstRTSPClientSinkClass * klass)
"The User-Agent string to send to the server",
DEFAULT_USER_AGENT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/**
* GstRTSPClientSink:publish-clock-mode:
*
* Sets if and how the media clock should be published according to RFC7273.
*
* Since: 1.22
*
*/
g_object_class_install_property (gobject_class, PROP_PUBLISH_CLOCK_MODE,
g_param_spec_enum ("publish-clock-mode", "Publish Clock Mode",
"Clock publishing mode according to RFC7273",
GST_TYPE_RTSP_PUBLISH_CLOCK_MODE, DEFAULT_PUBLISH_CLOCK_MODE,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/**
* GstRTSPClientSink::handle-request:
* @rtsp_client_sink: a #GstRTSPClientSink
@ -880,6 +896,7 @@ gst_rtsp_client_sink_init (GstRTSPClientSink * sink)
sink->tls_interaction = DEFAULT_TLS_INTERACTION;
sink->ntp_time_source = DEFAULT_NTP_TIME_SOURCE;
sink->user_agent = g_strdup (DEFAULT_USER_AGENT);
sink->publish_clock_mode = DEFAULT_PUBLISH_CLOCK_MODE;
sink->profiles = DEFAULT_PROFILES;
@ -1202,6 +1219,7 @@ gst_rtsp_client_sink_create_stream (GstRTSPClientSink * sink,
gst_rtsp_stream_set_ulpfec_pt (stream, ulpfec_pt);
gst_rtsp_stream_set_ulpfec_percentage (stream, context->ulpfec_percentage);
gst_rtsp_stream_set_publish_clock_mode (stream, sink->publish_clock_mode);
#if 0
if (priv->pool)
@ -1702,6 +1720,9 @@ gst_rtsp_client_sink_set_property (GObject * object, guint prop_id,
g_free (rtsp_client_sink->user_agent);
rtsp_client_sink->user_agent = g_value_dup_string (value);
break;
case PROP_PUBLISH_CLOCK_MODE:
rtsp_client_sink->publish_clock_mode = g_value_get_enum (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@ -1816,6 +1837,9 @@ gst_rtsp_client_sink_get_property (GObject * object, guint prop_id,
case PROP_USER_AGENT:
g_value_set_string (value, rtsp_client_sink->user_agent);
break;
case PROP_PUBLISH_CLOCK_MODE:
g_value_set_enum (value, rtsp_client_sink->publish_clock_mode);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;

View file

@ -186,6 +186,7 @@ struct _GstRTSPClientSink {
GTlsInteraction *tls_interaction;
gint ntp_time_source;
gchar *user_agent;
GstRTSPPublishClockMode publish_clock_mode;
/* state */
GstRTSPState state;