From 7895bf38ad258bf03f2ccbfd74a3b36001420124 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim-Philipp=20M=C3=BCller?= Date: Tue, 15 Mar 2022 13:49:09 +0000 Subject: [PATCH] rtspsrc: proxy new "add-reference-timestamp-meta" property from rtpjitterbuffer When syncing to an RFC7273 clock this will add the original reconstructed reference clock timestamp to buffers in form of a GstReferenceTimestampMeta. This is useful when we want to process or analyse data based on the original timestamps untainted by any local adjustments, for example reconstruct AES67 audio streams with sample accuracy. Part-of: --- .../gst-plugins-good/docs/gst_plugins_cache.json | 12 +++++++++ subprojects/gst-plugins-good/gst/rtsp/gstrtspsrc.c | 31 ++++++++++++++++++++++ subprojects/gst-plugins-good/gst/rtsp/gstrtspsrc.h | 1 + 3 files changed, 44 insertions(+) diff --git a/subprojects/gst-plugins-good/docs/gst_plugins_cache.json b/subprojects/gst-plugins-good/docs/gst_plugins_cache.json index b31410b..08abb74 100644 --- a/subprojects/gst-plugins-good/docs/gst_plugins_cache.json +++ b/subprojects/gst-plugins-good/docs/gst_plugins_cache.json @@ -20010,6 +20010,18 @@ } }, "properties": { + "add-reference-timestamp-meta": { + "blurb": "Add Reference Timestamp Meta to buffers with the original clock timestamp before any adjustments when syncing to an RFC7273 clock.", + "conditionally-available": false, + "construct": false, + "construct-only": false, + "controllable": false, + "default": "false", + "mutable": "null", + "readable": true, + "type": "gboolean", + "writable": true + }, "backchannel": { "blurb": "The type of backchannel to setup. Default is 'none'.", "conditionally-available": false, diff --git a/subprojects/gst-plugins-good/gst/rtsp/gstrtspsrc.c b/subprojects/gst-plugins-good/gst/rtsp/gstrtspsrc.c index 0032ae5..e1180a1 100644 --- a/subprojects/gst-plugins-good/gst/rtsp/gstrtspsrc.c +++ b/subprojects/gst-plugins-good/gst/rtsp/gstrtspsrc.c @@ -301,6 +301,7 @@ gst_rtsp_backchannel_get_type (void) #define DEFAULT_USER_AGENT "GStreamer/" PACKAGE_VERSION #define DEFAULT_MAX_RTCP_RTP_TIME_DIFF 1000 #define DEFAULT_RFC7273_SYNC FALSE +#define DEFAULT_ADD_REFERENCE_TIMESTAMP_META FALSE #define DEFAULT_MAX_TS_OFFSET_ADJUSTMENT G_GUINT64_CONSTANT(0) #define DEFAULT_MAX_TS_OFFSET G_GINT64_CONSTANT(3000000000) #define DEFAULT_VERSION GST_RTSP_VERSION_1_0 @@ -350,6 +351,7 @@ enum PROP_USER_AGENT, PROP_MAX_RTCP_RTP_TIME_DIFF, PROP_RFC7273_SYNC, + PROP_ADD_REFERENCE_TIMESTAMP_META, PROP_MAX_TS_OFFSET_ADJUSTMENT, PROP_MAX_TS_OFFSET, PROP_DEFAULT_VERSION, @@ -900,6 +902,23 @@ gst_rtspsrc_class_init (GstRTSPSrcClass * klass) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /** + * GstRTSPSrc:add-reference-timestamp-meta: + * + * When syncing to a RFC7273 clock, add #GstReferenceTimestampMeta + * to buffers with the original reconstructed reference clock timestamp. + * + * Since: 1.22 + */ + g_object_class_install_property (gobject_class, + PROP_ADD_REFERENCE_TIMESTAMP_META, + g_param_spec_boolean ("add-reference-timestamp-meta", + "Add Reference Timestamp Meta", + "Add Reference Timestamp Meta to buffers with the original clock timestamp " + "before any adjustments when syncing to an RFC7273 clock.", + DEFAULT_ADD_REFERENCE_TIMESTAMP_META, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + + /** * GstRTSPSrc:default-rtsp-version: * * The preferred RTSP version to use while negotiating the version with the server. @@ -1457,6 +1476,7 @@ gst_rtspsrc_init (GstRTSPSrc * src) src->user_agent = g_strdup (DEFAULT_USER_AGENT); src->max_rtcp_rtp_time_diff = DEFAULT_MAX_RTCP_RTP_TIME_DIFF; src->rfc7273_sync = DEFAULT_RFC7273_SYNC; + src->add_reference_timestamp_meta = DEFAULT_ADD_REFERENCE_TIMESTAMP_META; src->max_ts_offset_adjustment = DEFAULT_MAX_TS_OFFSET_ADJUSTMENT; src->max_ts_offset = DEFAULT_MAX_TS_OFFSET; src->max_ts_offset_is_set = FALSE; @@ -1779,6 +1799,9 @@ gst_rtspsrc_set_property (GObject * object, guint prop_id, const GValue * value, case PROP_RFC7273_SYNC: rtspsrc->rfc7273_sync = g_value_get_boolean (value); break; + case PROP_ADD_REFERENCE_TIMESTAMP_META: + rtspsrc->add_reference_timestamp_meta = g_value_get_boolean (value); + break; case PROP_MAX_TS_OFFSET_ADJUSTMENT: rtspsrc->max_ts_offset_adjustment = g_value_get_uint64 (value); break; @@ -1950,6 +1973,9 @@ gst_rtspsrc_get_property (GObject * object, guint prop_id, GValue * value, case PROP_RFC7273_SYNC: g_value_set_boolean (value, rtspsrc->rfc7273_sync); break; + case PROP_ADD_REFERENCE_TIMESTAMP_META: + g_value_set_boolean (value, rtspsrc->add_reference_timestamp_meta); + break; case PROP_MAX_TS_OFFSET_ADJUSTMENT: g_value_set_uint64 (value, rtspsrc->max_ts_offset_adjustment); break; @@ -4032,6 +4058,11 @@ gst_rtspsrc_stream_configure_manager (GstRTSPSrc * src, GstRTSPStream * stream, g_object_set (src->manager, "rfc7273-sync", src->rfc7273_sync, NULL); } + if (g_object_class_find_property (klass, "add-reference-timestamp-meta")) { + g_object_set (src->manager, "add-reference-timestamp-meta", + src->add_reference_timestamp_meta, NULL); + } + if (src->use_pipeline_clock) { if (g_object_class_find_property (klass, "use-pipeline-clock")) { g_object_set (src->manager, "use-pipeline-clock", TRUE, NULL); diff --git a/subprojects/gst-plugins-good/gst/rtsp/gstrtspsrc.h b/subprojects/gst-plugins-good/gst/rtsp/gstrtspsrc.h index 5af00f9..93ad288 100644 --- a/subprojects/gst-plugins-good/gst/rtsp/gstrtspsrc.h +++ b/subprojects/gst-plugins-good/gst/rtsp/gstrtspsrc.h @@ -270,6 +270,7 @@ struct _GstRTSPSrc { gchar *user_agent; gint max_rtcp_rtp_time_diff; gboolean rfc7273_sync; + gboolean add_reference_timestamp_meta; guint64 max_ts_offset_adjustment; gint64 max_ts_offset; gboolean max_ts_offset_is_set; -- 2.7.4