From fb2b64ea7f4f9e230359cc58c0279b1d4047b177 Mon Sep 17 00:00:00 2001 From: Haihua Hu Date: Mon, 22 May 2023 16:07:08 +0800 Subject: [PATCH] dashsink: add property to set suggested presentation delay of MPD add property suggested-presentation-delay to configure MPD info Part-of: --- .../docs/plugins/gst_plugins_cache.json | 14 +++++++++ .../gst-plugins-bad/ext/dash/gstdashsink.c | 29 +++++++++++++++++++ .../gst-plugins-bad/ext/dash/gstmpdrootnode.c | 11 +++++++ 3 files changed, 54 insertions(+) diff --git a/subprojects/gst-plugins-bad/docs/plugins/gst_plugins_cache.json b/subprojects/gst-plugins-bad/docs/plugins/gst_plugins_cache.json index 2034be431b..50a40b4061 100644 --- a/subprojects/gst-plugins-bad/docs/plugins/gst_plugins_cache.json +++ b/subprojects/gst-plugins-bad/docs/plugins/gst_plugins_cache.json @@ -9572,6 +9572,20 @@ "type": "gboolean", "writable": true }, + "suggested-presentation-delay": { + "blurb": "Provides to the manifest a suggested presentation delay in milliseconds", + "conditionally-available": false, + "construct": false, + "construct-only": false, + "controllable": false, + "default": "0", + "max": "18446744073709551615", + "min": "0", + "mutable": "null", + "readable": true, + "type": "guint64", + "writable": true + }, "target-duration": { "blurb": "The target duration in seconds of a segment/file. (0 - disabled, useful for management of segment duration by the streaming server)", "conditionally-available": false, diff --git a/subprojects/gst-plugins-bad/ext/dash/gstdashsink.c b/subprojects/gst-plugins-bad/ext/dash/gstdashsink.c index 8a94d379f9..f915bab99d 100644 --- a/subprojects/gst-plugins-bad/ext/dash/gstdashsink.c +++ b/subprojects/gst-plugins-bad/ext/dash/gstdashsink.c @@ -160,6 +160,7 @@ static const DashSinkMuxer dash_muxer_list[] = { #define DEFAULT_MPD_USE_SEGMENT_LIST FALSE #define DEFAULT_MPD_MIN_BUFFER_TIME 2000 #define DEFAULT_MPD_PERIOD_DURATION GST_CLOCK_TIME_NONE +#define DEFAULT_MPD_SUGGESTED_PRESENTATION_DELAY 0 #define DEFAULT_DASH_SINK_MUXER GST_DASH_SINK_MUXER_TS @@ -184,6 +185,7 @@ enum PROP_MPD_MIN_BUFFER_TIME, PROP_MPD_BASEURL, PROP_MPD_PERIOD_DURATION, + PROP_MPD_SUGGESTED_PRESENTATION_DELAY, }; enum @@ -248,6 +250,7 @@ struct _GstDashSink guint index; GList *streams; guint64 minimum_update_period; + guint64 suggested_presentation_delay; guint64 min_buffer_time; gint64 period_duration; }; @@ -539,6 +542,21 @@ gst_dash_sink_class_init (GstDashSinkClass * klass) G_MAXUINT64, DEFAULT_MPD_PERIOD_DURATION, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + * GstDashSink:suggested-presentation-delay + * + * set suggested presentation delay of MPD file in milliseconds + * + * Since: 1.24 + */ + g_object_class_install_property (gobject_class, + PROP_MPD_SUGGESTED_PRESENTATION_DELAY, + g_param_spec_uint64 ("suggested-presentation-delay", + "suggested presentation delay", + "Provides to the manifest a suggested presentation delay in milliseconds", + 0, G_MAXUINT64, DEFAULT_MPD_SUGGESTED_PRESENTATION_DELAY, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** * GstDashSink::get-playlist-stream: * @sink: the #GstDashSink @@ -680,6 +698,7 @@ gst_dash_sink_init (GstDashSink * sink) sink->min_buffer_time = DEFAULT_MPD_MIN_BUFFER_TIME; sink->period_duration = DEFAULT_MPD_PERIOD_DURATION; + sink->suggested_presentation_delay = DEFAULT_MPD_SUGGESTED_PRESENTATION_DELAY; g_mutex_init (&sink->mpd_lock); @@ -756,6 +775,10 @@ gst_dash_sink_generate_mpd_content (GstDashSink * sink, if (sink->minimum_update_period) gst_mpd_client_set_root_node (sink->mpd_client, "minimum-update-period", sink->minimum_update_period, NULL); + if (sink->suggested_presentation_delay) + gst_mpd_client_set_root_node (sink->mpd_client, + "suggested-presentation-delay", sink->suggested_presentation_delay, + NULL); if (sink->mpd_baseurl) gst_mpd_client_add_baseurl_node (sink->mpd_client, "url", sink->mpd_baseurl, NULL); @@ -1111,6 +1134,9 @@ gst_dash_sink_set_property (GObject * object, guint prop_id, case PROP_MPD_MINIMUM_UPDATE_PERIOD: sink->minimum_update_period = g_value_get_uint64 (value); break; + case PROP_MPD_SUGGESTED_PRESENTATION_DELAY: + sink->suggested_presentation_delay = g_value_get_uint64 (value); + break; case PROP_MPD_MIN_BUFFER_TIME: sink->min_buffer_time = g_value_get_uint64 (value); break; @@ -1157,6 +1183,9 @@ gst_dash_sink_get_property (GObject * object, guint prop_id, case PROP_MPD_MINIMUM_UPDATE_PERIOD: g_value_set_uint64 (value, sink->minimum_update_period); break; + case PROP_MPD_SUGGESTED_PRESENTATION_DELAY: + g_value_set_uint64 (value, sink->suggested_presentation_delay); + break; case PROP_MPD_MIN_BUFFER_TIME: g_value_set_uint64 (value, sink->min_buffer_time); break; diff --git a/subprojects/gst-plugins-bad/ext/dash/gstmpdrootnode.c b/subprojects/gst-plugins-bad/ext/dash/gstmpdrootnode.c index 2cac539da3..c73dce2bb4 100644 --- a/subprojects/gst-plugins-bad/ext/dash/gstmpdrootnode.c +++ b/subprojects/gst-plugins-bad/ext/dash/gstmpdrootnode.c @@ -101,6 +101,9 @@ gst_mpd_root_node_set_property (GObject * object, guint prop_id, case PROP_MPD_ROOT_MINIMUM_UPDATE_PERIOD: self->minimumUpdatePeriod = g_value_get_uint64 (value); break; + case PROP_MPD_ROOT_SUGGESTED_PRESENTATION_DELAY: + self->suggestedPresentationDelay = g_value_get_uint64 (value); + break; case PROP_MPD_ROOT_MIN_BUFFER_TIME: self->minBufferTime = g_value_get_uint64 (value); break; @@ -152,6 +155,9 @@ gst_mpd_root_node_get_property (GObject * object, guint prop_id, case PROP_MPD_ROOT_MINIMUM_UPDATE_PERIOD: g_value_set_uint64 (value, self->minimumUpdatePeriod); break; + case PROP_MPD_ROOT_SUGGESTED_PRESENTATION_DELAY: + g_value_set_uint64 (value, self->suggestedPresentationDelay); + break; case PROP_MPD_ROOT_MIN_BUFFER_TIME: g_value_set_uint64 (value, self->minBufferTime); break; @@ -350,6 +356,11 @@ gst_mpd_root_node_class_init (GstMPDRootNodeClass * klass) g_param_spec_uint64 ("minimum-update-period", "minimum update period", "minimum update period", 0, G_MAXUINT64, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + g_object_class_install_property (object_class, + PROP_MPD_ROOT_SUGGESTED_PRESENTATION_DELAY, + g_param_spec_uint64 ("suggested-presentation-delay", + "suggested presentation delay", "suggested presentation delay", 0, + G_MAXUINT64, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (object_class, PROP_MPD_ROOT_MIN_BUFFER_TIME, g_param_spec_uint64 ("min-buffer-time", "mininim buffer time",