Video Capture PipeWire: Filter out non-camera nodes

This can be helpful in various situations, such as debugging with an
unrestricted Pipewire socket or for downstream projects like
B2G/Capyloon. Additionally it will help once we move from the camera
portal to the more generic device portal.

Original patch by Fabrice Desré <fabrice@desre.org>

Bug: webrtc:15464
Change-Id: Iae6802f242d68244bca85947cb15ef3eee923ab0
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/318642
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Commit-Queue: Ilya Nikolaevskiy <ilnik@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#40706}
This commit is contained in:
Robert Mader 2023-09-06 11:57:00 +02:00 committed by WebRTC LUCI CQ
parent 3e1e831ae3
commit a717c7ada8
2 changed files with 5 additions and 0 deletions

View File

@ -104,6 +104,7 @@ Raman Budny <budnyjj@gmail.com>
Ramprakash Jelari <ennajelari@gmail.com>
Riku Voipio <riku.voipio@linaro.org>
Robert Bares <robert@bares.me>
Robert Mader <robert.mader@collabora.com>
Robert Mader <robert.mader@posteo.de>
Robert Nagy <robert.nagy@gmail.com>
Ryan Yoakum <ryoakum@skobalt.com>

View File

@ -360,6 +360,10 @@ void PipeWireSession::OnRegistryGlobal(void* data,
if (!spa_dict_lookup(props, PW_KEY_NODE_DESCRIPTION))
return;
auto node_role = spa_dict_lookup(props, PW_KEY_MEDIA_ROLE);
if (!node_role || strcmp(node_role, "Camera"))
return;
that->nodes_.emplace_back(that, id, props);
that->PipeWireSync();
}