Skip to content
This repository has been archived by the owner on Jul 12, 2023. It is now read-only.

Added port-range property to PlayerEndpoint #14

Merged
merged 4 commits into from Nov 23, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 21 additions & 2 deletions src/gst-plugins/kmsplayerendpoint.c
Expand Up @@ -45,6 +45,7 @@ G_DEFINE_QUARK (APPSINK_KEY, appsink);
G_DEFINE_QUARK (PTS_KEY, pts);

#define NETWORK_CACHE_DEFAULT 2000
#define PORT_RANGE_DEFAULT NULL
#define IS_PREROLL TRUE

GST_DEBUG_CATEGORY_STATIC (kms_player_endpoint_debug_category);
Expand Down Expand Up @@ -83,6 +84,7 @@ struct _KmsPlayerEndpointPrivate
KmsLoop *loop;
gboolean use_encoded_media;
gint network_cache;
gchar *port_range;

GMutex base_time_mutex;
gboolean reset;
Expand All @@ -99,6 +101,7 @@ enum
PROP_VIDEO_DATA,
PROP_POSITION,
PROP_NETWORK_CACHE,
PROP_PORT_RANGE,
PROP_PIPELINE,
N_PROPERTIES
};
Expand Down Expand Up @@ -194,6 +197,10 @@ kms_player_endpoint_set_property (GObject * object, guint property_id,
case PROP_NETWORK_CACHE:
playerendpoint->priv->network_cache = g_value_get_int (value);
break;
case PROP_PORT_RANGE:
g_free (playerendpoint->priv->port_range);
playerendpoint->priv->port_range = g_value_dup_string (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
Expand Down Expand Up @@ -267,6 +274,9 @@ kms_player_endpoint_get_property (GObject * object, guint property_id,
case PROP_NETWORK_CACHE:
g_value_set_int (value, playerendpoint->priv->network_cache);
break;
case PROP_PORT_RANGE:
g_value_set_string (value, playerendpoint->priv->port_range);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
Expand Down Expand Up @@ -1089,6 +1099,11 @@ kms_player_endpoint_class_init (KmsPlayerEndpointClass * klass)
0, G_MAXINT, NETWORK_CACHE_DEFAULT,
G_PARAM_READWRITE | GST_PARAM_MUTABLE_READY));

g_object_class_install_property (gobject_class, PROP_PORT_RANGE,
g_param_spec_string ("port-range", "UDP Port range for RTSP source",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
g_param_spec_string ("port-range", "UDP Port range for RTSP source",
g_param_spec_string ("port-range", "Port range for RTSP client",

"When using rtsp sources, what range of UDP ports can be allocated",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"When using rtsp sources, what range of UDP ports can be allocated",
"Range of ports that can be allocated when acting as RTSP client",

PORT_RANGE_DEFAULT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));

g_object_class_install_property (gobject_class, PROP_PIPELINE,
g_param_spec_object ("pipeline", "Internal pipeline",
"PlayerEndpoint's private pipeline",
Expand Down Expand Up @@ -1272,8 +1287,11 @@ kms_player_endpoint_uridecodebin_element_added (GstBin * bin,

if (g_strcmp0 (gst_plugin_feature_get_name (GST_PLUGIN_FEATURE
(gst_element_get_factory (element))), RTSPSRC) == 0) {
g_object_set (G_OBJECT (element), "latency", self->priv->network_cache,
"drop-on-latency", TRUE, NULL);
g_object_set (G_OBJECT (element),
"latency", self->priv->network_cache,
"drop-on-latency", TRUE,
"port-range", self->priv->port_range,
NULL);
}
}

Expand Down Expand Up @@ -1343,6 +1361,7 @@ kms_player_endpoint_init (KmsPlayerEndpoint * self)
self->priv->uridecodebin =
gst_element_factory_make ("uridecodebin", NULL);
self->priv->network_cache = NETWORK_CACHE_DEFAULT;
self->priv->port_range = PORT_RANGE_DEFAULT;

self->priv->stats.probes = kms_list_new_full (g_direct_equal, g_object_unref,
(GDestroyNotify) kms_stats_probe_destroy);
Expand Down
3 changes: 3 additions & 0 deletions src/server/config/PlayerEndpoint.conf.ini
@@ -0,0 +1,3 @@
;; This is setting from gstreamer plugin gst-plugins-good
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
;; This is setting from gstreamer plugin gst-plugins-good
;; Range of ports that can be allocated when acting as RTSP client

;; https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-good/html/gst-plugins-good-plugins-rtspsrc.html#GstRTSPSrc--port-range
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
;; https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-good/html/gst-plugins-good-plugins-rtspsrc.html#GstRTSPSrc--port-range

;rtspSrcPortRange=<PortMin-PortMax>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
;rtspSrcPortRange=<PortMin-PortMax>
;rtspClientPortRange=<PortMin-PortMax>

8 changes: 8 additions & 0 deletions src/server/implementation/objects/PlayerEndpointImpl.cpp
Expand Up @@ -36,6 +36,7 @@ GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
#define PIPELINE "pipeline"
#define SET_POSITION "set-position"
#define NS_TO_MS 1000000
#define RTSP_SRC_PORT_RANGE "rtspSrcPortRange"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#define RTSP_SRC_PORT_RANGE "rtspSrcPortRange"
#define RTSP_CLIENT_PORT_RANGE "rtspClientPortRange"


namespace kurento
{
Expand Down Expand Up @@ -106,6 +107,13 @@ PlayerEndpointImpl::PlayerEndpointImpl (const boost::property_tree::ptree &conf,

g_object_set (G_OBJECT (element), "use-encoded-media", useEncodedMedia,
"network-cache", networkCache, NULL);

try {
std::string portRange = getConfigValue <std::string, PlayerEndpoint> (RTSP_SRC_PORT_RANGE);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
std::string portRange = getConfigValue <std::string, PlayerEndpoint> (RTSP_SRC_PORT_RANGE);
std::string portRange = getConfigValue <std::string, PlayerEndpoint> (RTSP_CLIENT_PORT_RANGE);

g_object_set (G_OBJECT (element), "port-range", portRange.c_str(), NULL);
} catch (boost::property_tree::ptree_error &) {
GST_DEBUG ("PlayerEndpoint config file doesn't contain property %s. Ignoring.", RTSP_SRC_PORT_RANGE);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
GST_DEBUG ("PlayerEndpoint config file doesn't contain property %s. Ignoring.", RTSP_SRC_PORT_RANGE);
GST_DEBUG ("PlayerEndpoint config file doesn't contain property %s. Ignoring.", RTSP_CLIENT_PORT_RANGE);

}
}

PlayerEndpointImpl::~PlayerEndpointImpl()
Expand Down