mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
pulse-server: error on invalid format
When an invalid format is given as a module argument, generate an error.
This commit is contained in:
parent
7aae9a3e8b
commit
03abce72e5
3 changed files with 14 additions and 0 deletions
|
|
@ -166,6 +166,10 @@ static int module_null_sink_prepare(struct module * const module)
|
||||||
info.format = module->impl->defs.sample_spec.format;
|
info.format = module->impl->defs.sample_spec.format;
|
||||||
if ((str = pw_properties_get(props, "format")) != NULL) {
|
if ((str = pw_properties_get(props, "format")) != NULL) {
|
||||||
info.format = format_paname2id(str, strlen(str));
|
info.format = format_paname2id(str, strlen(str));
|
||||||
|
if (info.format == SPA_AUDIO_FORMAT_UNKNOWN) {
|
||||||
|
pw_log_error("invalid format '%s'", str);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
pw_properties_set(props, "format", NULL);
|
pw_properties_set(props, "format", NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -148,6 +148,11 @@ static int module_pipe_sink_prepare(struct module * const module)
|
||||||
info.format = SPA_AUDIO_FORMAT_S16;
|
info.format = SPA_AUDIO_FORMAT_S16;
|
||||||
if ((str = pw_properties_get(props, "format")) != NULL) {
|
if ((str = pw_properties_get(props, "format")) != NULL) {
|
||||||
info.format = format_paname2id(str, strlen(str));
|
info.format = format_paname2id(str, strlen(str));
|
||||||
|
if (info.format == SPA_AUDIO_FORMAT_UNKNOWN) {
|
||||||
|
pw_log_error("invalid format '%s'", str);
|
||||||
|
res = -EINVAL;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
pw_properties_set(props, "format", NULL);
|
pw_properties_set(props, "format", NULL);
|
||||||
}
|
}
|
||||||
if ((str = pw_properties_get(props, "sink_name")) != NULL) {
|
if ((str = pw_properties_get(props, "sink_name")) != NULL) {
|
||||||
|
|
|
||||||
|
|
@ -148,6 +148,11 @@ static int module_pipe_source_prepare(struct module * const module)
|
||||||
info.format = SPA_AUDIO_FORMAT_S16;
|
info.format = SPA_AUDIO_FORMAT_S16;
|
||||||
if ((str = pw_properties_get(props, "format")) != NULL) {
|
if ((str = pw_properties_get(props, "format")) != NULL) {
|
||||||
info.format = format_paname2id(str, strlen(str));
|
info.format = format_paname2id(str, strlen(str));
|
||||||
|
if (info.format == SPA_AUDIO_FORMAT_UNKNOWN) {
|
||||||
|
pw_log_error("invalid format '%s'", str);
|
||||||
|
res = -EINVAL;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
pw_properties_set(props, "format", NULL);
|
pw_properties_set(props, "format", NULL);
|
||||||
}
|
}
|
||||||
if ((str = pw_properties_get(props, "source_name")) != NULL) {
|
if ((str = pw_properties_get(props, "source_name")) != NULL) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue