mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-03-06 01:40:26 -05:00
module-vban: create streams per stream_name
Always listen on the receive socket. Find the stream with the given stream_name of the packet and create it if it doesn't exist. Also take the sample-rate, channels and format from the packet parameters instead of the config. Fixes #4400
This commit is contained in:
parent
567b484386
commit
1a5514e5cf
6 changed files with 284 additions and 153 deletions
|
|
@ -26,6 +26,7 @@
|
|||
#include <pipewire/impl.h>
|
||||
|
||||
#include <module-vban/stream.h>
|
||||
#include <module-vban/vban.h>
|
||||
#include "network-utils.h"
|
||||
|
||||
#ifndef IPTOS_DSCP
|
||||
|
|
@ -354,6 +355,7 @@ SPA_EXPORT
|
|||
int pipewire__module_init(struct pw_impl_module *module, const char *args)
|
||||
{
|
||||
struct pw_context *context = pw_impl_module_get_context(module);
|
||||
uint32_t id = pw_global_get_id(pw_impl_module_get_global(module));
|
||||
struct impl *impl;
|
||||
struct pw_properties *props = NULL, *stream_props = NULL;
|
||||
char addr[64];
|
||||
|
|
@ -382,7 +384,7 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
|
|||
stream_props = pw_properties_new(NULL, NULL);
|
||||
if (stream_props == NULL) {
|
||||
res = -errno;
|
||||
pw_log_error( "can't create properties: %m");
|
||||
pw_log_error("can't create properties: %m");
|
||||
goto out;
|
||||
}
|
||||
impl->stream_props = stream_props;
|
||||
|
|
@ -391,15 +393,22 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
|
|||
impl->context = context;
|
||||
impl->loop = pw_context_get_main_loop(context);
|
||||
|
||||
if ((sess_name = pw_properties_get(props, "sess.name")) == NULL)
|
||||
pw_properties_setf(props, "sess.name", "%s-%d",
|
||||
pw_get_host_name(), id);
|
||||
if ((sess_name = pw_properties_get(props, "sess.name")) == NULL)
|
||||
sess_name = pw_get_host_name();
|
||||
|
||||
if (strlen(sess_name) > VBAN_STREAM_NAME_SIZE)
|
||||
pw_log_warn("session name '%s' will be truncated to %d characters",
|
||||
sess_name, VBAN_STREAM_NAME_SIZE);
|
||||
|
||||
if (pw_properties_get(props, PW_KEY_NODE_NAME) == NULL)
|
||||
pw_properties_setf(props, PW_KEY_NODE_NAME, "vban_session.%s", sess_name);
|
||||
if (pw_properties_get(props, PW_KEY_NODE_DESCRIPTION) == NULL)
|
||||
pw_properties_setf(props, PW_KEY_NODE_DESCRIPTION, "%s", sess_name);
|
||||
if (pw_properties_get(props, PW_KEY_MEDIA_NAME) == NULL)
|
||||
pw_properties_setf(props, PW_KEY_MEDIA_NAME, "VBAN Session with %s",
|
||||
pw_properties_setf(props, PW_KEY_MEDIA_NAME, "VBAN Session %s",
|
||||
sess_name);
|
||||
|
||||
if ((str = pw_properties_get(props, "stream.props")) != NULL)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue