mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
module-rtp-sink: improve source.ip default
Use the default source.ip from the same address family as the destination.ip. See #3851
This commit is contained in:
parent
346264f7a4
commit
0fba5537ed
1 changed files with 8 additions and 7 deletions
|
|
@ -115,6 +115,7 @@ PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME);
|
||||||
|
|
||||||
#define DEFAULT_PORT 46000
|
#define DEFAULT_PORT 46000
|
||||||
#define DEFAULT_SOURCE_IP "0.0.0.0"
|
#define DEFAULT_SOURCE_IP "0.0.0.0"
|
||||||
|
#define DEFAULT_SOURCE_IP6 "::"
|
||||||
#define DEFAULT_DESTINATION_IP "224.0.0.56"
|
#define DEFAULT_DESTINATION_IP "224.0.0.56"
|
||||||
#define DEFAULT_TTL 1
|
#define DEFAULT_TTL 1
|
||||||
#define DEFAULT_LOOP false
|
#define DEFAULT_LOOP false
|
||||||
|
|
@ -470,13 +471,6 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
|
||||||
str = pw_properties_get(props, "local.ifname");
|
str = pw_properties_get(props, "local.ifname");
|
||||||
impl->ifname = str ? strdup(str) : NULL;
|
impl->ifname = str ? strdup(str) : NULL;
|
||||||
|
|
||||||
if ((str = pw_properties_get(props, "source.ip")) == NULL)
|
|
||||||
str = DEFAULT_SOURCE_IP;
|
|
||||||
if ((res = parse_address(str, 0, &impl->src_addr, &impl->src_len)) < 0) {
|
|
||||||
pw_log_error("invalid source.ip %s: %s", str, spa_strerror(res));
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
impl->dst_port = DEFAULT_PORT + ((uint32_t) (pw_rand32() % 512) << 1);
|
impl->dst_port = DEFAULT_PORT + ((uint32_t) (pw_rand32() % 512) << 1);
|
||||||
impl->dst_port = pw_properties_get_uint32(props, "destination.port", impl->dst_port);
|
impl->dst_port = pw_properties_get_uint32(props, "destination.port", impl->dst_port);
|
||||||
if ((str = pw_properties_get(props, "destination.ip")) == NULL)
|
if ((str = pw_properties_get(props, "destination.ip")) == NULL)
|
||||||
|
|
@ -485,6 +479,13 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
|
||||||
pw_log_error("invalid destination.ip %s: %s", str, spa_strerror(res));
|
pw_log_error("invalid destination.ip %s: %s", str, spa_strerror(res));
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
if ((str = pw_properties_get(props, "source.ip")) == NULL)
|
||||||
|
str = impl->dst_addr.ss_family == AF_INET ?
|
||||||
|
DEFAULT_SOURCE_IP : DEFAULT_SOURCE_IP6;
|
||||||
|
if ((res = parse_address(str, 0, &impl->src_addr, &impl->src_len)) < 0) {
|
||||||
|
pw_log_error("invalid source.ip %s: %s", str, spa_strerror(res));
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
impl->ttl = pw_properties_get_uint32(props, "net.ttl", DEFAULT_TTL);
|
impl->ttl = pw_properties_get_uint32(props, "net.ttl", DEFAULT_TTL);
|
||||||
impl->mcast_loop = pw_properties_get_bool(props, "net.loop", DEFAULT_LOOP);
|
impl->mcast_loop = pw_properties_get_bool(props, "net.loop", DEFAULT_LOOP);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue