mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
module-rtp: fix rtp.media property
Use sess.media for the media type (audio/midi) because rtp.media is used in the SDP to describe the media (midi and audio are both are audio).
This commit is contained in:
parent
9e67d6781d
commit
933743581b
4 changed files with 29 additions and 30 deletions
|
|
@ -734,7 +734,7 @@ static int session_load_source(struct session *session, struct pw_properties *pr
|
|||
if ((str = pw_properties_get(props, "rtp.session")) != NULL)
|
||||
fprintf(f, "\"sess.name\" = \"%s\", ", str);
|
||||
|
||||
if ((media = pw_properties_get(props, "rtp.media")) == NULL)
|
||||
if ((media = pw_properties_get(props, "sess.media")) == NULL)
|
||||
media = "audio";
|
||||
|
||||
if (spa_streq(media, "audio")) {
|
||||
|
|
@ -750,7 +750,7 @@ static int session_load_source(struct session *session, struct pw_properties *pr
|
|||
pw_log_error("unknown rtp.mime type %s", mime);
|
||||
return -EINVAL;
|
||||
}
|
||||
fprintf(f, "\"rtp.media\" = \"%s\", ", format_info->media_type);
|
||||
fprintf(f, "\"sess.media\" = \"%s\", ", format_info->media_type);
|
||||
if (format_info->format_str != NULL) {
|
||||
pw_properties_set(props, "audio.format", format_info->format_str);
|
||||
if ((str = pw_properties_get(props, "rtp.rate")) != NULL)
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@
|
|||
* - `sess.name = <str>`: a session name
|
||||
* - `sess.ts-offset = <int>`: an offset to apply to the timestamp, default -1 = random offset
|
||||
* - `sess.ts-refclk = <string>`: the name of a reference clock
|
||||
* - `sess.media = <string>`: the session media type audio|midi, default audio
|
||||
* - `sess.media = <string>`: the media type audio|midi, default audio
|
||||
* - `stream.props = {}`: properties to be passed to the stream
|
||||
*
|
||||
* ## General options
|
||||
|
|
@ -83,7 +83,7 @@
|
|||
* #sess.min-ptime = 2
|
||||
* #sess.max-ptime = 20
|
||||
* #sess.name = "PipeWire RTP stream"
|
||||
* #sess.media = audio
|
||||
* #sess.media = "audio"
|
||||
* #audio.format = "S16BE"
|
||||
* #audio.rate = 48000
|
||||
* #audio.channels = 2
|
||||
|
|
@ -122,7 +122,7 @@ PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME);
|
|||
"sess.name=<a name for the session> " \
|
||||
"sess.min-ptime=<minimum packet time in milliseconds, default:2> " \
|
||||
"sess.max-ptime=<maximum packet time in milliseconds, default:20> " \
|
||||
"sess.media=<media type, audio or midi, default:audio> " \
|
||||
"sess.media=<string, the media type audio|midi, default audio> " \
|
||||
"audio.format=<format, default:"DEFAULT_FORMAT"> " \
|
||||
"audio.rate=<sample rate, default:"SPA_STRINGIFY(DEFAULT_RATE)"> " \
|
||||
"audio.channels=<number of channels, default:"SPA_STRINGIFY(DEFAULT_CHANNELS)"> "\
|
||||
|
|
@ -455,7 +455,7 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
|
|||
copy_props(impl, props, PW_KEY_MEDIA_NAME);
|
||||
copy_props(impl, props, PW_KEY_MEDIA_CLASS);
|
||||
copy_props(impl, props, "net.mtu");
|
||||
copy_props(impl, props, "rtp.media");
|
||||
copy_props(impl, props, "sess.media");
|
||||
copy_props(impl, props, "sess.name");
|
||||
copy_props(impl, props, "sess.min-ptime");
|
||||
copy_props(impl, props, "sess.max-ptime");
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@
|
|||
* - `local.ifname = <str>`: interface name to use
|
||||
* - `node.always-process = <bool>`: true to receive even when not running
|
||||
* - `sess.latency.msec = <str>`: target network latency in milliseconds, default 100
|
||||
* - `rtp.media = <string>`: the media type audio|midi, default audio
|
||||
* - `sess.media = <string>`: the media type audio|midi, default audio
|
||||
* - `stream.props = {}`: properties to be passed to the stream
|
||||
*
|
||||
* ## General options
|
||||
|
|
@ -74,7 +74,7 @@
|
|||
* #local.ifname = eth0
|
||||
* sess.latency.msec = 100
|
||||
* #node.always-process = false
|
||||
* #rtp.media = "audio"
|
||||
* #sess.media = "audio"
|
||||
* #audio.format = "S16BE"
|
||||
* #audio.rate = 48000
|
||||
* #audio.channels = 2
|
||||
|
|
@ -103,7 +103,7 @@ PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME);
|
|||
"source.ip=<source IP address, default:"DEFAULT_SOURCE_IP"> " \
|
||||
"source.port=<int, source port> " \
|
||||
"sess.latency.msec=<target network latency, default "SPA_STRINGIFY(DEFAULT_SESS_LATENCY)"> " \
|
||||
"rtp.media=<string, the media type audio|midi, default audio> " \
|
||||
"sess.media=<string, the media type audio|midi, default audio> " \
|
||||
"audio.format=<format, default:"DEFAULT_FORMAT"> " \
|
||||
"audio.rate=<sample rate, default:"SPA_STRINGIFY(DEFAULT_RATE)"> " \
|
||||
"audio.channels=<number of channels, default:"SPA_STRINGIFY(DEFAULT_CHANNELS)"> "\
|
||||
|
|
@ -478,7 +478,7 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
|
|||
copy_props(impl, props, PW_KEY_MEDIA_NAME);
|
||||
copy_props(impl, props, PW_KEY_MEDIA_CLASS);
|
||||
copy_props(impl, props, "net.mtu");
|
||||
copy_props(impl, props, "rtp.media");
|
||||
copy_props(impl, props, "sess.media");
|
||||
copy_props(impl, props, "sess.name");
|
||||
copy_props(impl, props, "sess.min-ptime");
|
||||
copy_props(impl, props, "sess.max-ptime");
|
||||
|
|
@ -487,12 +487,12 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args)
|
|||
str = pw_properties_get(props, "local.ifname");
|
||||
impl->ifname = str ? strdup(str) : NULL;
|
||||
|
||||
impl->src_port = pw_properties_get_uint32(stream_props, "source.port", 0);
|
||||
impl->src_port = pw_properties_get_uint32(props, "source.port", 0);
|
||||
if (impl->src_port == 0) {
|
||||
pw_log_error("invalid source.port");
|
||||
goto out;
|
||||
}
|
||||
if ((str = pw_properties_get(stream_props, "source.ip")) == NULL ||
|
||||
if ((str = pw_properties_get(props, "source.ip")) == NULL ||
|
||||
(res = parse_address(str, impl->src_port, &impl->src_addr, &impl->src_len)) < 0) {
|
||||
pw_log_error("invalid source.ip %s: %s", str, spa_strerror(res));
|
||||
goto out;
|
||||
|
|
|
|||
|
|
@ -270,24 +270,23 @@ struct rtp_stream *rtp_stream_new(struct pw_core *core,
|
|||
spa_hook_list_init(&impl->listener_list);
|
||||
impl->stream_events = stream_events;
|
||||
|
||||
impl->info.media_type = SPA_MEDIA_TYPE_audio;
|
||||
impl->info.media_subtype = SPA_MEDIA_SUBTYPE_raw;
|
||||
if ((str = pw_properties_get(props, "rtp.media")) != NULL) {
|
||||
if (spa_streq(str, "audio")) {
|
||||
impl->info.media_type = SPA_MEDIA_TYPE_audio;
|
||||
impl->info.media_subtype = SPA_MEDIA_SUBTYPE_raw;
|
||||
impl->payload = 127;
|
||||
}
|
||||
else if (spa_streq(str, "midi")) {
|
||||
impl->info.media_type = SPA_MEDIA_TYPE_application;
|
||||
impl->info.media_subtype = SPA_MEDIA_SUBTYPE_control;
|
||||
impl->payload = 0x61;
|
||||
}
|
||||
else {
|
||||
pw_log_error("unsupported media type:%s", str);
|
||||
res = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
if ((str = pw_properties_get(props, "sess.media")) == NULL)
|
||||
str = "audio";
|
||||
|
||||
if (spa_streq(str, "audio")) {
|
||||
impl->info.media_type = SPA_MEDIA_TYPE_audio;
|
||||
impl->info.media_subtype = SPA_MEDIA_SUBTYPE_raw;
|
||||
impl->payload = 127;
|
||||
}
|
||||
else if (spa_streq(str, "midi")) {
|
||||
impl->info.media_type = SPA_MEDIA_TYPE_application;
|
||||
impl->info.media_subtype = SPA_MEDIA_SUBTYPE_control;
|
||||
impl->payload = 0x61;
|
||||
}
|
||||
else {
|
||||
pw_log_error("unsupported media type:%s", str);
|
||||
res = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
switch (impl->info.media_type) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue