From dc2810522026042ccf589e309c357d912140b12c Mon Sep 17 00:00:00 2001 From: Justin Kim Date: Tue, 22 Jan 2019 13:02:30 +0900 Subject: [PATCH] srt: Use default host and port if uri doesn't provide --- ext/srt/gstsrtobject.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/ext/srt/gstsrtobject.c b/ext/srt/gstsrtobject.c index e4e9fb9b7c..3e6468c82a 100644 --- a/ext/srt/gstsrtobject.c +++ b/ext/srt/gstsrtobject.c @@ -494,15 +494,18 @@ gst_srt_object_validate_parameters (GstStructure * s, GstUri * uri) guint local_port; const gchar *local_address = gst_structure_get_string (s, "localaddress"); - if (local_address == NULL) { - gst_srt_object_set_string_value (s, "localaddress", - GST_SRT_DEFAULT_LOCALADDRESS); + local_address = + gst_uri_get_host (uri) == + NULL ? GST_SRT_DEFAULT_LOCALADDRESS : gst_uri_get_host (uri); + gst_srt_object_set_string_value (s, "localaddress", local_address); } if (!gst_structure_get_uint (s, "localport", &local_port)) { - gst_srt_object_set_uint_value (s, "localport", - G_STRINGIFY (GST_SRT_DEFAULT_PORT)); + local_port = + gst_uri_get_port (uri) == + GST_URI_NO_PORT ? GST_SRT_DEFAULT_PORT : gst_uri_get_port (uri); + gst_structure_set (s, "localport", G_TYPE_UINT, local_port, NULL); } } }