93 QString host = QString::fromStdString(
m_info.data_host());
94 quint16 port =
static_cast<quint16
>(
m_info.data_port());
96 if (host.isEmpty() || port == 0) {
99 throw std::runtime_error(
"[lsl::stream_inlet] Invalid data host or port in stream_info");
104 if (!
m_pSocket->waitForConnected(5000)) {
108 throw std::runtime_error(std::string(
"[lsl::stream_inlet] Failed to connect to outlet: ") + err.toStdString());
112 if (!
m_pSocket->waitForReadyRead(5000)) {
115 throw std::runtime_error(
"[lsl::stream_inlet] Timeout waiting for handshake from outlet");
119 while (header.size() < 8) {
121 if (!
m_pSocket->waitForReadyRead(5000)) {
125 header.append(
m_pSocket->read(8 - header.size()));
128 if (header.size() < 8 || header.left(4) != QByteArray(
"LSL1", 4)) {
131 throw std::runtime_error(
"[lsl::stream_inlet] Invalid handshake from outlet");
135 int headerChannels = 0;
136 std::memcpy(&headerChannels, header.constData() + 4,
sizeof(
int));
138 qDebug() <<
"[lsl::stream_inlet] Warning: outlet reports" << headerChannels
197 std::vector<std::vector<float>> chunk;
212 if (nCompleteSamples == 0) {
216 chunk.reserve(nCompleteSamples);
219 for (
int s = 0; s < nCompleteSamples; ++s) {
222 chunk.push_back(std::move(sample));