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: ")
109 + err.toStdString());
113 if (!
m_pSocket->waitForReadyRead(5000)) {
116 throw std::runtime_error(
"[lsl::stream_inlet] Timeout waiting for handshake from outlet");
120 while (header.size() < 8) {
122 if (!
m_pSocket->waitForReadyRead(5000)) {
126 header.append(
m_pSocket->read(8 - header.size()));
129 if (header.size() < 8 || header.left(4) != QByteArray(
"LSL1", 4)) {
132 throw std::runtime_error(
"[lsl::stream_inlet] Invalid handshake from outlet");
136 int headerChannels = 0;
137 std::memcpy(&headerChannels, header.constData() + 4,
sizeof(
int));
139 qDebug() <<
"[lsl::stream_inlet] Warning: outlet reports" << headerChannels
198 std::vector<std::vector<float>> chunk;
213 if (nCompleteSamples == 0) {
217 chunk.reserve(nCompleteSamples);
220 for (
int s = 0; s < nCompleteSamples; ++s) {
223 chunk.push_back(std::move(sample));