mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-05 13:30:02 -05:00
Add vm.overrides property in pipewire and pulse-server
Apply vm.override properties when running in a VM. Increase the default quantum to 1024 when running in a VM to cause less dropouts.
This commit is contained in:
parent
fbd6a62b73
commit
8294a4f42c
4 changed files with 44 additions and 13 deletions
|
|
@ -43,6 +43,10 @@ context.modules = [
|
||||||
#pulse.min.quantum = 256/48000 # 5ms
|
#pulse.min.quantum = 256/48000 # 5ms
|
||||||
#pulse.default.format = F32
|
#pulse.default.format = F32
|
||||||
#pulse.default.position = [ FL FR ]
|
#pulse.default.position = [ FL FR ]
|
||||||
|
# These overrides are only applied when running in a vm.
|
||||||
|
vm.overrides = {
|
||||||
|
pulse.min.quantum = 1024/48000 # 22ms
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,11 @@ context.properties = {
|
||||||
#default.video.height = 480
|
#default.video.height = 480
|
||||||
#default.video.rate.num = 25
|
#default.video.rate.num = 25
|
||||||
#default.video.rate.denom = 1
|
#default.video.rate.denom = 1
|
||||||
|
#
|
||||||
|
# These overrides are only applied when running in a vm.
|
||||||
|
vm.overrides = {
|
||||||
|
default.clock.min-quantum = 1024
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
context.spa-libs = {
|
context.spa-libs = {
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,7 @@
|
||||||
|
|
||||||
#define spa_debug pw_log_debug
|
#define spa_debug pw_log_debug
|
||||||
|
|
||||||
|
#include <spa/support/cpu.h>
|
||||||
#include <spa/utils/result.h>
|
#include <spa/utils/result.h>
|
||||||
#include <spa/debug/dict.h>
|
#include <spa/debug/dict.h>
|
||||||
#include <spa/debug/mem.h>
|
#include <spa/debug/mem.h>
|
||||||
|
|
@ -6225,27 +6226,29 @@ struct pw_protocol_pulse *pw_protocol_pulse_new(struct pw_context *context,
|
||||||
const char *str;
|
const char *str;
|
||||||
struct spa_json it[2];
|
struct spa_json it[2];
|
||||||
char value[512];
|
char value[512];
|
||||||
|
const struct spa_support *support;
|
||||||
|
struct spa_cpu *cpu;
|
||||||
|
uint32_t n_support;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
impl = calloc(1, sizeof(struct impl) + user_data_size);
|
impl = calloc(1, sizeof(struct impl) + user_data_size);
|
||||||
if (impl == NULL)
|
if (impl == NULL)
|
||||||
goto error_exit;
|
goto error_exit;
|
||||||
|
|
||||||
|
|
||||||
if (props == NULL)
|
if (props == NULL)
|
||||||
props = pw_properties_new(NULL, NULL);
|
props = pw_properties_new(NULL, NULL);
|
||||||
if (props == NULL)
|
if (props == NULL)
|
||||||
goto error_free;
|
goto error_free;
|
||||||
|
|
||||||
str = pw_properties_get(props, "server.address");
|
support = pw_context_get_support(context, &n_support);
|
||||||
if (str == NULL) {
|
cpu = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_CPU);
|
||||||
pw_properties_setf(props, "server.address",
|
|
||||||
"[ \"%s-%s\" ]",
|
if ((str = pw_properties_get(props, "vm.overrides")) != NULL) {
|
||||||
PW_PROTOCOL_PULSE_DEFAULT_SERVER,
|
if (cpu != NULL && spa_cpu_get_vm_type(cpu) != SPA_CPU_VM_NONE)
|
||||||
get_server_name(context));
|
pw_properties_update_string(props, str, strlen(str));
|
||||||
str = pw_properties_get(props, "server.address");
|
pw_properties_set(props, "vm.overrides", NULL);
|
||||||
}
|
}
|
||||||
if (str == NULL)
|
|
||||||
goto error_free;
|
|
||||||
|
|
||||||
load_defaults(&impl->defs, props);
|
load_defaults(&impl->defs, props);
|
||||||
|
|
||||||
|
|
@ -6270,6 +6273,17 @@ struct pw_protocol_pulse *pw_protocol_pulse_new(struct pw_context *context,
|
||||||
pw_context_add_listener(context, &impl->context_listener,
|
pw_context_add_listener(context, &impl->context_listener,
|
||||||
&context_events, impl);
|
&context_events, impl);
|
||||||
|
|
||||||
|
str = pw_properties_get(props, "server.address");
|
||||||
|
if (str == NULL) {
|
||||||
|
pw_properties_setf(props, "server.address",
|
||||||
|
"[ \"%s-%s\" ]",
|
||||||
|
PW_PROTOCOL_PULSE_DEFAULT_SERVER,
|
||||||
|
get_server_name(context));
|
||||||
|
str = pw_properties_get(props, "server.address");
|
||||||
|
}
|
||||||
|
if (str == NULL)
|
||||||
|
goto error_free;
|
||||||
|
|
||||||
spa_json_init(&it[0], str, strlen(str));
|
spa_json_init(&it[0], str, strlen(str));
|
||||||
if (spa_json_enter_array(&it[0], &it[1]) > 0) {
|
if (spa_json_enter_array(&it[0], &it[1]) > 0) {
|
||||||
while (spa_json_get_string(&it[1], value, sizeof(value)-1) > 0) {
|
while (spa_json_get_string(&it[1], value, sizeof(value)-1) > 0) {
|
||||||
|
|
|
||||||
|
|
@ -246,11 +246,23 @@ struct pw_context *pw_context_new(struct pw_loop *main_loop,
|
||||||
}
|
}
|
||||||
this->conf = conf;
|
this->conf = conf;
|
||||||
|
|
||||||
|
n_support = pw_get_support(this->support, SPA_N_ELEMENTS(this->support) - 6);
|
||||||
|
cpu = spa_support_find(this->support, n_support, SPA_TYPE_INTERFACE_CPU);
|
||||||
|
|
||||||
if ((str = pw_properties_get(conf, "context.properties")) != NULL) {
|
if ((str = pw_properties_get(conf, "context.properties")) != NULL) {
|
||||||
pw_properties_update_string(properties, str, strlen(str));
|
pw_properties_update_string(properties, str, strlen(str));
|
||||||
pw_log_info(NAME" %p: parsed context.properties section", this);
|
pw_log_info(NAME" %p: parsed context.properties section", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((str = pw_properties_get(properties, "vm.overrides")) != NULL) {
|
||||||
|
if (cpu != NULL && spa_cpu_get_vm_type(cpu) != SPA_CPU_VM_NONE)
|
||||||
|
pw_properties_update_string(properties, str, strlen(str));
|
||||||
|
pw_properties_set(properties, "vm.overrides", NULL);
|
||||||
|
}
|
||||||
|
if (pw_properties_get(properties, PW_KEY_CPU_MAX_ALIGN) == NULL && cpu != NULL)
|
||||||
|
pw_properties_setf(properties, PW_KEY_CPU_MAX_ALIGN,
|
||||||
|
"%u", spa_cpu_get_max_align(cpu));
|
||||||
|
|
||||||
if (getenv("PIPEWIRE_DEBUG") == NULL &&
|
if (getenv("PIPEWIRE_DEBUG") == NULL &&
|
||||||
(str = pw_properties_get(properties, "log.level")) != NULL)
|
(str = pw_properties_get(properties, "log.level")) != NULL)
|
||||||
pw_log_set_level(atoi(str));
|
pw_log_set_level(atoi(str));
|
||||||
|
|
@ -287,16 +299,12 @@ struct pw_context *pw_context_new(struct pw_loop *main_loop,
|
||||||
this->data_system = this->data_loop->system;
|
this->data_system = this->data_loop->system;
|
||||||
this->main_loop = main_loop;
|
this->main_loop = main_loop;
|
||||||
|
|
||||||
n_support = pw_get_support(this->support, SPA_N_ELEMENTS(this->support) - 6);
|
|
||||||
this->support[n_support++] = SPA_SUPPORT_INIT(SPA_TYPE_INTERFACE_System, this->main_loop->system);
|
this->support[n_support++] = SPA_SUPPORT_INIT(SPA_TYPE_INTERFACE_System, this->main_loop->system);
|
||||||
this->support[n_support++] = SPA_SUPPORT_INIT(SPA_TYPE_INTERFACE_Loop, this->main_loop->loop);
|
this->support[n_support++] = SPA_SUPPORT_INIT(SPA_TYPE_INTERFACE_Loop, this->main_loop->loop);
|
||||||
this->support[n_support++] = SPA_SUPPORT_INIT(SPA_TYPE_INTERFACE_LoopUtils, this->main_loop->utils);
|
this->support[n_support++] = SPA_SUPPORT_INIT(SPA_TYPE_INTERFACE_LoopUtils, this->main_loop->utils);
|
||||||
this->support[n_support++] = SPA_SUPPORT_INIT(SPA_TYPE_INTERFACE_DataSystem, this->data_system);
|
this->support[n_support++] = SPA_SUPPORT_INIT(SPA_TYPE_INTERFACE_DataSystem, this->data_system);
|
||||||
this->support[n_support++] = SPA_SUPPORT_INIT(SPA_TYPE_INTERFACE_DataLoop, this->data_loop->loop);
|
this->support[n_support++] = SPA_SUPPORT_INIT(SPA_TYPE_INTERFACE_DataLoop, this->data_loop->loop);
|
||||||
|
|
||||||
if ((cpu = spa_support_find(this->support, n_support, SPA_TYPE_INTERFACE_CPU)) != NULL)
|
|
||||||
pw_properties_setf(properties, PW_KEY_CPU_MAX_ALIGN, "%u", spa_cpu_get_max_align(cpu));
|
|
||||||
|
|
||||||
if ((str = pw_properties_get(properties, "support.dbus")) == NULL ||
|
if ((str = pw_properties_get(properties, "support.dbus")) == NULL ||
|
||||||
pw_properties_parse_bool(str)) {
|
pw_properties_parse_bool(str)) {
|
||||||
lib = pw_properties_get(properties, PW_KEY_LIBRARY_NAME_DBUS);
|
lib = pw_properties_get(properties, PW_KEY_LIBRARY_NAME_DBUS);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue