mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-05 13:30:02 -05:00
node: add NODE_SUSPEND_ON_IDLE option
Makes the node suspend as soon as it goes to IDLE.
This commit is contained in:
parent
709d25f0c4
commit
6515553b7d
3 changed files with 18 additions and 9 deletions
|
|
@ -185,20 +185,21 @@ context.objects = [
|
||||||
#latency.internal.rate = 0
|
#latency.internal.rate = 0
|
||||||
#latency.internal.ns = 0
|
#latency.internal.ns = 0
|
||||||
#clock.name = api.alsa.0
|
#clock.name = api.alsa.0
|
||||||
|
node.suspend-on-idle = true
|
||||||
#audio.format = "S32"
|
#audio.format = "S32"
|
||||||
#audio.rate = 48000
|
#audio.rate = 48000
|
||||||
#audio.allowed-rates = [ ]
|
#audio.allowed-rates = [ ]
|
||||||
#audio.channels = 4
|
#audio.channels = 4
|
||||||
#audio.position = [ FL FR RL RR ]
|
#audio.position = [ FL FR RL RR ]
|
||||||
#resample.quality = 4
|
#resample.quality = 4
|
||||||
resample.disable = true
|
resample.disable = true
|
||||||
#monitor.channel-volumes = false
|
#monitor.channel-volumes = false
|
||||||
#channelmix.normalize = true
|
#channelmix.normalize = true
|
||||||
#channelmix.mix-lfe = false
|
#channelmix.mix-lfe = false
|
||||||
#channelmix.upmix = false
|
#channelmix.upmix = false
|
||||||
#channelmix.lfe-cutoff = 0
|
#channelmix.lfe-cutoff = 0
|
||||||
#node.param.Props = {
|
#node.param.Props = {
|
||||||
# params = [
|
# params = [
|
||||||
# audio.channels 6
|
# audio.channels 6
|
||||||
# ]
|
# ]
|
||||||
#}
|
#}
|
||||||
|
|
@ -229,14 +230,15 @@ context.objects = [
|
||||||
#api.alsa.start-delay = 0
|
#api.alsa.start-delay = 0
|
||||||
#api.alsa.disable-mmap = false
|
#api.alsa.disable-mmap = false
|
||||||
#api.alsa.disable-batch = false
|
#api.alsa.disable-batch = false
|
||||||
#api.alsa.use-chmap = false
|
#api.alsa.use-chmap = false
|
||||||
#api.alsa.multirate = true
|
#api.alsa.multirate = true
|
||||||
#latency.internal.rate = 0
|
#latency.internal.rate = 0
|
||||||
#latency.internal.ns = 0
|
#latency.internal.ns = 0
|
||||||
#clock.name = api.alsa.0
|
#clock.name = api.alsa.0
|
||||||
|
node.suspend-on-idle = true
|
||||||
#audio.format = "S32"
|
#audio.format = "S32"
|
||||||
#audio.rate = 48000
|
#audio.rate = 48000
|
||||||
#audio.allowed-rates = [ ]
|
#audio.allowed-rates = [ ]
|
||||||
#audio.channels = 2
|
#audio.channels = 2
|
||||||
#audio.position = "FL,FR"
|
#audio.position = "FL,FR"
|
||||||
#resample.quality = 4
|
#resample.quality = 4
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,7 @@ struct impl {
|
||||||
struct spa_list pending_list;
|
struct spa_list pending_list;
|
||||||
|
|
||||||
unsigned int pause_on_idle:1;
|
unsigned int pause_on_idle:1;
|
||||||
|
unsigned int suspend_on_idle:1;
|
||||||
unsigned int cache_params:1;
|
unsigned int cache_params:1;
|
||||||
unsigned int pending_play:1;
|
unsigned int pending_play:1;
|
||||||
};
|
};
|
||||||
|
|
@ -387,6 +388,10 @@ static void node_update_state(struct pw_impl_node *node, enum pw_node_state stat
|
||||||
spa_list_for_each(resource, &node->global->resource_list, link)
|
spa_list_for_each(resource, &node->global->resource_list, link)
|
||||||
pw_resource_error(resource, res, error);
|
pw_resource_error(resource, res, error);
|
||||||
}
|
}
|
||||||
|
if (old == PW_NODE_STATE_RUNNING &&
|
||||||
|
state == PW_NODE_STATE_IDLE &&
|
||||||
|
impl->suspend_on_idle)
|
||||||
|
pw_impl_node_set_state(node, PW_NODE_STATE_SUSPENDED);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int suspend_node(struct pw_impl_node *this)
|
static int suspend_node(struct pw_impl_node *this)
|
||||||
|
|
@ -867,6 +872,7 @@ static void check_properties(struct pw_impl_node *node)
|
||||||
}
|
}
|
||||||
|
|
||||||
impl->pause_on_idle = pw_properties_get_bool(node->properties, PW_KEY_NODE_PAUSE_ON_IDLE, true);
|
impl->pause_on_idle = pw_properties_get_bool(node->properties, PW_KEY_NODE_PAUSE_ON_IDLE, true);
|
||||||
|
impl->suspend_on_idle = pw_properties_get_bool(node->properties, PW_KEY_NODE_SUSPEND_ON_IDLE, false);
|
||||||
impl->cache_params = pw_properties_get_bool(node->properties, PW_KEY_NODE_CACHE_PARAMS, true);
|
impl->cache_params = pw_properties_get_bool(node->properties, PW_KEY_NODE_CACHE_PARAMS, true);
|
||||||
node->transport_sync = pw_properties_get_bool(node->properties, PW_KEY_NODE_TRANSPORT_SYNC, false);
|
node->transport_sync = pw_properties_get_bool(node->properties, PW_KEY_NODE_TRANSPORT_SYNC, false);
|
||||||
driver = pw_properties_get_bool(node->properties, PW_KEY_NODE_DRIVER, false);
|
driver = pw_properties_get_bool(node->properties, PW_KEY_NODE_DRIVER, false);
|
||||||
|
|
|
||||||
|
|
@ -171,6 +171,7 @@ extern "C" {
|
||||||
#define PW_KEY_NODE_WANT_DRIVER "node.want-driver" /**< the node wants to be grouped with a driver
|
#define PW_KEY_NODE_WANT_DRIVER "node.want-driver" /**< the node wants to be grouped with a driver
|
||||||
* node in order to schedule the graph. */
|
* node in order to schedule the graph. */
|
||||||
#define PW_KEY_NODE_PAUSE_ON_IDLE "node.pause-on-idle" /**< pause the node when idle */
|
#define PW_KEY_NODE_PAUSE_ON_IDLE "node.pause-on-idle" /**< pause the node when idle */
|
||||||
|
#define PW_KEY_NODE_SUSPEND_ON_IDLE "node.suspend-on-idle" /**< suspend the node when idle */
|
||||||
#define PW_KEY_NODE_CACHE_PARAMS "node.cache-params" /**< cache the node params */
|
#define PW_KEY_NODE_CACHE_PARAMS "node.cache-params" /**< cache the node params */
|
||||||
#define PW_KEY_NODE_TRANSPORT_SYNC "node.transport.sync" /**< the node handles transport sync */
|
#define PW_KEY_NODE_TRANSPORT_SYNC "node.transport.sync" /**< the node handles transport sync */
|
||||||
#define PW_KEY_NODE_DRIVER "node.driver" /**< node can drive the graph */
|
#define PW_KEY_NODE_DRIVER "node.driver" /**< node can drive the graph */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue