Skip to content

Commit 5f207c8

Browse files
committed
pipe_manager: do not move streams that set PW_KEY_TARGET_OBJECT to a different device than the one we are using
1 parent 3471aa4 commit 5f207c8

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

src/pipe_manager.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,7 @@ void on_node_info(void* object, const struct pw_node_info* info) {
308308
}
309309

310310
bool ignore_input_stream = false;
311+
bool ignore_output_stream = false;
311312

312313
if (nd->nd_info->media_class == tags::pipewire::media_class::input_stream && !pm->input_device.name.empty()) {
313314
if (const auto* target_object = spa_dict_lookup(info->props, PW_KEY_TARGET_OBJECT)) {
@@ -336,6 +337,33 @@ void on_node_info(void* object, const struct pw_node_info* info) {
336337
}
337338
}
338339

340+
if (nd->nd_info->media_class == tags::pipewire::media_class::output_stream && !pm->output_device.name.empty()) {
341+
if (const auto* target_object = spa_dict_lookup(info->props, PW_KEY_TARGET_OBJECT)) {
342+
/*
343+
target.object can a name or serial number:
344+
https://gitlab.freedesktop.org/pipewire/pipewire/-/blob/master/src/pipewire/keys.h#L334
345+
*/
346+
347+
uint64_t serial = SPA_ID_INVALID;
348+
349+
util::str_to_num(target_object, serial);
350+
351+
if (target_object != pm->output_device.name) {
352+
ignore_output_stream = true;
353+
} else if (serial != SPA_ID_INVALID && serial != pm->output_device.serial) {
354+
ignore_output_stream = true;
355+
}
356+
357+
if (ignore_output_stream) {
358+
util::debug("The output stream " + nd->nd_info->name +
359+
" does not have as target the same output device used as EE: " + pm->output_device.name +
360+
"\n The user wants it to play to device " + target_object + ". We will ignore this stream.");
361+
362+
remove_node = true;
363+
}
364+
}
365+
}
366+
339367
if (remove_node) {
340368
nd->nd_info->proxy = nullptr;
341369

util/NEWS.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Description:
66
- Features∶
77
- Community Presets have been implemented. Users can install packages containing multiple Easy Effects presets to be imported and applied inside the application. These packages will be maintained and shipped by volunteers. You can search them on the repositories of your favorite distribution.
88
- Added the ability of collapsing the sidebar to hide the effects list and expand the area of the effects user interface.
9+
- EasyEffects won't touch streams that define `PW_KEY_TARGET_OBJECT` to an output device that is different from the one EE is using.
910

1011
- Bug fixes∶
1112
- A change in GTK 4.14.1 prevented to apply the values inserted into the text field of our SpinButton widgets. This issue is now resolved.

0 commit comments

Comments
 (0)