v2.0.0
Loading...
Searching...
No Matches
lsl_stream_discovery.cpp File Reference

Implements the UDP multicast listener that turns LSL outlet announcements on 239.255.172.215:16571 into stream_info results. More...

#include "lsl_stream_discovery.h"
#include <QUdpSocket>
#include <QHostAddress>
#include <QNetworkDatagram>
#include <QElapsedTimer>
#include <QDebug>
#include <set>
Include dependency graph for lsl_stream_discovery.cpp:

Go to the source code of this file.

Detailed Description

Implements the UDP multicast listener that turns LSL outlet announcements on 239.255.172.215:16571 into stream_info results.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2026 MNE-CPP Authors

Author
Christoph Dinh chris.nosp@m.toph.nosp@m..dinh.nosp@m.@mne.nosp@m.-cpp..nosp@m.org
Since
2.0.0
Date
March 2026

LSLLIB::resolve_streams binds a QUdpSocket on the LSL discovery port 16571 with ShareAddress + ReuseAddressHint so multiple LSLLIB consumers can coexist on the same host, joins the well-known LSL multicast group 239.255.172.215 (skipped on WebAssembly, where the runtime cannot join multicast groups but may still receive broadcast traffic), and then enters a timeout-bounded loop that pulls every pending datagram, parses it via LSLLIB::stream_info::from_string and accumulates the results.

Each accepted descriptor is deduplicated on its per-instance UUID and has its data_host overwritten with the datagram's actual sender address, which is more reliable than the hostname the outlet self-reports (it copes with hosts that have multiple interfaces or that resolve their own name to a loopback address). LSLLIB::resolve_stream is implemented as a thin client-side filter on top: it calls LSLLIB::resolve_streams once and then matches the requested property locally, which keeps the network-facing surface to a single well-tested code path.

Definition in file lsl_stream_discovery.cpp.