module-rtp: fix loading of source

This commit is contained in:
Wim Taymans 2023-02-26 18:30:22 +01:00
parent be09198249
commit 9e67d6781d

View file

@ -725,13 +725,14 @@ static int session_load_source(struct session *session, struct pw_properties *pr
pw_log_error("Can't open memstream: %m"); pw_log_error("Can't open memstream: %m");
return -errno; return -errno;
} }
fprintf(f, "{");
if ((str = pw_properties_get(props, "rtp.destination.ip")) != NULL) if ((str = pw_properties_get(props, "rtp.destination.ip")) != NULL)
pw_properties_set(props, "source.ip", str); fprintf(f, "\"source.ip\" = \"%s\", ", str);
if ((str = pw_properties_get(props, "rtp.destination.port")) != NULL) if ((str = pw_properties_get(props, "rtp.destination.port")) != NULL)
pw_properties_set(props, "source.port", str); fprintf(f, "\"source.port\" = %s, ", str);
if ((str = pw_properties_get(props, "rtp.session")) != NULL) if ((str = pw_properties_get(props, "rtp.session")) != NULL)
pw_properties_set(props, "sess.name", str); fprintf(f, "\"sess.name\" = \"%s\", ", str);
if ((media = pw_properties_get(props, "rtp.media")) == NULL) if ((media = pw_properties_get(props, "rtp.media")) == NULL)
media = "audio"; media = "audio";
@ -749,7 +750,7 @@ static int session_load_source(struct session *session, struct pw_properties *pr
pw_log_error("unknown rtp.mime type %s", mime); pw_log_error("unknown rtp.mime type %s", mime);
return -EINVAL; return -EINVAL;
} }
pw_properties_set(props, "rtp.media", format_info->media_type); fprintf(f, "\"rtp.media\" = \"%s\", ", format_info->media_type);
if (format_info->format_str != NULL) { if (format_info->format_str != NULL) {
pw_properties_set(props, "audio.format", format_info->format_str); pw_properties_set(props, "audio.format", format_info->format_str);
if ((str = pw_properties_get(props, "rtp.rate")) != NULL) if ((str = pw_properties_get(props, "rtp.rate")) != NULL)
@ -764,7 +765,6 @@ static int session_load_source(struct session *session, struct pw_properties *pr
if ((str = pw_properties_get(props, "rtp.ts-offset")) != NULL) if ((str = pw_properties_get(props, "rtp.ts-offset")) != NULL)
pw_properties_set(props, "sess.ts-offset", str); pw_properties_set(props, "sess.ts-offset", str);
fprintf(f, "{");
fprintf(f, " stream.props = {"); fprintf(f, " stream.props = {");
pw_properties_serialize_dict(f, &props->dict, 0); pw_properties_serialize_dict(f, &props->dict, 0);
fprintf(f, " }"); fprintf(f, " }");