dashsink: add property to set suggested presentation delay of MPD

add property suggested-presentation-delay to configure MPD info

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4687>
This commit is contained in:
Haihua Hu 2023-05-22 16:07:08 +08:00 committed by GStreamer Marge Bot
parent 83e307ac96
commit fb2b64ea7f
3 changed files with 54 additions and 0 deletions

View file

@ -9572,6 +9572,20 @@
"type": "gboolean", "type": "gboolean",
"writable": true "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": { "target-duration": {
"blurb": "The target duration in seconds of a segment/file. (0 - disabled, useful for management of segment duration by the streaming server)", "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, "conditionally-available": false,

View file

@ -160,6 +160,7 @@ static const DashSinkMuxer dash_muxer_list[] = {
#define DEFAULT_MPD_USE_SEGMENT_LIST FALSE #define DEFAULT_MPD_USE_SEGMENT_LIST FALSE
#define DEFAULT_MPD_MIN_BUFFER_TIME 2000 #define DEFAULT_MPD_MIN_BUFFER_TIME 2000
#define DEFAULT_MPD_PERIOD_DURATION GST_CLOCK_TIME_NONE #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 #define DEFAULT_DASH_SINK_MUXER GST_DASH_SINK_MUXER_TS
@ -184,6 +185,7 @@ enum
PROP_MPD_MIN_BUFFER_TIME, PROP_MPD_MIN_BUFFER_TIME,
PROP_MPD_BASEURL, PROP_MPD_BASEURL,
PROP_MPD_PERIOD_DURATION, PROP_MPD_PERIOD_DURATION,
PROP_MPD_SUGGESTED_PRESENTATION_DELAY,
}; };
enum enum
@ -248,6 +250,7 @@ struct _GstDashSink
guint index; guint index;
GList *streams; GList *streams;
guint64 minimum_update_period; guint64 minimum_update_period;
guint64 suggested_presentation_delay;
guint64 min_buffer_time; guint64 min_buffer_time;
gint64 period_duration; gint64 period_duration;
}; };
@ -539,6 +542,21 @@ gst_dash_sink_class_init (GstDashSinkClass * klass)
G_MAXUINT64, DEFAULT_MPD_PERIOD_DURATION, G_MAXUINT64, DEFAULT_MPD_PERIOD_DURATION,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); 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: * GstDashSink::get-playlist-stream:
* @sink: the #GstDashSink * @sink: the #GstDashSink
@ -680,6 +698,7 @@ gst_dash_sink_init (GstDashSink * sink)
sink->min_buffer_time = DEFAULT_MPD_MIN_BUFFER_TIME; sink->min_buffer_time = DEFAULT_MPD_MIN_BUFFER_TIME;
sink->period_duration = DEFAULT_MPD_PERIOD_DURATION; sink->period_duration = DEFAULT_MPD_PERIOD_DURATION;
sink->suggested_presentation_delay = DEFAULT_MPD_SUGGESTED_PRESENTATION_DELAY;
g_mutex_init (&sink->mpd_lock); g_mutex_init (&sink->mpd_lock);
@ -756,6 +775,10 @@ gst_dash_sink_generate_mpd_content (GstDashSink * sink,
if (sink->minimum_update_period) if (sink->minimum_update_period)
gst_mpd_client_set_root_node (sink->mpd_client, gst_mpd_client_set_root_node (sink->mpd_client,
"minimum-update-period", sink->minimum_update_period, NULL); "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) if (sink->mpd_baseurl)
gst_mpd_client_add_baseurl_node (sink->mpd_client, "url", gst_mpd_client_add_baseurl_node (sink->mpd_client, "url",
sink->mpd_baseurl, NULL); sink->mpd_baseurl, NULL);
@ -1111,6 +1134,9 @@ gst_dash_sink_set_property (GObject * object, guint prop_id,
case PROP_MPD_MINIMUM_UPDATE_PERIOD: case PROP_MPD_MINIMUM_UPDATE_PERIOD:
sink->minimum_update_period = g_value_get_uint64 (value); sink->minimum_update_period = g_value_get_uint64 (value);
break; break;
case PROP_MPD_SUGGESTED_PRESENTATION_DELAY:
sink->suggested_presentation_delay = g_value_get_uint64 (value);
break;
case PROP_MPD_MIN_BUFFER_TIME: case PROP_MPD_MIN_BUFFER_TIME:
sink->min_buffer_time = g_value_get_uint64 (value); sink->min_buffer_time = g_value_get_uint64 (value);
break; break;
@ -1157,6 +1183,9 @@ gst_dash_sink_get_property (GObject * object, guint prop_id,
case PROP_MPD_MINIMUM_UPDATE_PERIOD: case PROP_MPD_MINIMUM_UPDATE_PERIOD:
g_value_set_uint64 (value, sink->minimum_update_period); g_value_set_uint64 (value, sink->minimum_update_period);
break; break;
case PROP_MPD_SUGGESTED_PRESENTATION_DELAY:
g_value_set_uint64 (value, sink->suggested_presentation_delay);
break;
case PROP_MPD_MIN_BUFFER_TIME: case PROP_MPD_MIN_BUFFER_TIME:
g_value_set_uint64 (value, sink->min_buffer_time); g_value_set_uint64 (value, sink->min_buffer_time);
break; break;

View file

@ -101,6 +101,9 @@ gst_mpd_root_node_set_property (GObject * object, guint prop_id,
case PROP_MPD_ROOT_MINIMUM_UPDATE_PERIOD: case PROP_MPD_ROOT_MINIMUM_UPDATE_PERIOD:
self->minimumUpdatePeriod = g_value_get_uint64 (value); self->minimumUpdatePeriod = g_value_get_uint64 (value);
break; break;
case PROP_MPD_ROOT_SUGGESTED_PRESENTATION_DELAY:
self->suggestedPresentationDelay = g_value_get_uint64 (value);
break;
case PROP_MPD_ROOT_MIN_BUFFER_TIME: case PROP_MPD_ROOT_MIN_BUFFER_TIME:
self->minBufferTime = g_value_get_uint64 (value); self->minBufferTime = g_value_get_uint64 (value);
break; break;
@ -152,6 +155,9 @@ gst_mpd_root_node_get_property (GObject * object, guint prop_id,
case PROP_MPD_ROOT_MINIMUM_UPDATE_PERIOD: case PROP_MPD_ROOT_MINIMUM_UPDATE_PERIOD:
g_value_set_uint64 (value, self->minimumUpdatePeriod); g_value_set_uint64 (value, self->minimumUpdatePeriod);
break; break;
case PROP_MPD_ROOT_SUGGESTED_PRESENTATION_DELAY:
g_value_set_uint64 (value, self->suggestedPresentationDelay);
break;
case PROP_MPD_ROOT_MIN_BUFFER_TIME: case PROP_MPD_ROOT_MIN_BUFFER_TIME:
g_value_set_uint64 (value, self->minBufferTime); g_value_set_uint64 (value, self->minBufferTime);
break; break;
@ -350,6 +356,11 @@ gst_mpd_root_node_class_init (GstMPDRootNodeClass * klass)
g_param_spec_uint64 ("minimum-update-period", g_param_spec_uint64 ("minimum-update-period",
"minimum update period", "minimum update period", 0, "minimum update period", "minimum update period", 0,
G_MAXUINT64, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); 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, g_object_class_install_property (object_class,
PROP_MPD_ROOT_MIN_BUFFER_TIME, PROP_MPD_ROOT_MIN_BUFFER_TIME,
g_param_spec_uint64 ("min-buffer-time", "mininim buffer time", g_param_spec_uint64 ("min-buffer-time", "mininim buffer time",