100 QString host = QString::fromStdString(
m_info.data_host());
101 quint16 port =
static_cast<quint16
>(
m_info.data_port());
103 if (host.isEmpty() || port == 0) {
106 throw std::runtime_error(
"[lsl::stream_inlet] Invalid data host or port in stream_info");
111 if (!
m_pSocket->waitForConnected(5000)) {
115 throw std::runtime_error(std::string(
"[lsl::stream_inlet] Failed to connect to outlet: ")
116 + err.toStdString());
120 if (!
m_pSocket->waitForReadyRead(5000)) {
123 throw std::runtime_error(
"[lsl::stream_inlet] Timeout waiting for handshake from outlet");
127 while (header.size() < 8) {
129 if (!
m_pSocket->waitForReadyRead(5000)) {
133 header.append(
m_pSocket->read(8 - header.size()));
136 if (header.size() < 8 || header.left(4) != QByteArray(
"LSL1", 4)) {
139 throw std::runtime_error(
"[lsl::stream_inlet] Invalid handshake from outlet");
143 int headerChannels = 0;
144 std::memcpy(&headerChannels, header.constData() + 4,
sizeof(
int));
146 qDebug() <<
"[lsl::stream_inlet] Warning: outlet reports" << headerChannels
205 std::vector<std::vector<float>> chunk;
220 if (nCompleteSamples == 0) {
224 chunk.reserve(nCompleteSamples);
227 for (
int s = 0; s < nCompleteSamples; ++s) {
230 chunk.push_back(std::move(sample));