Repository navigation
Conversation
Before, the post-processor got an offset of 0 until the first burst finished. The first timestamps and the start of the jitter fit therefore used no offset. The real offset then arrived about 0.6 s later as a step. Now `LiveSource::correction` waits up to 5 s for the first offset. liblsl uses the same wait (src/stream_inlet_impl.h:44, src/time_receiver.cpp:57-76). The wait ends early when no probe thread runs. If no offset arrives in 5 s, liblsl raises timeout_error. This source gives the last value instead and does not wait again until a reset. The samples therefore continue to flow when UDP is blocked. ClockState also gets `reset_offset` and `retarget` for the recovery path. A burst that started before a change of target publishes nothing.
Before, a closed TCP connection to an outlet that still ran froze the stream. `find_again` found the old instance identifier and returned nothing, and the reader then read the dead socket again. Now the reader connects again to the same endpoint after the socket closes. The handshake sends the old instance identifier, so a different outlet on the same port cannot attach. liblsl does the same (src/data_receiver.cpp:331-345). If the stream has a new instance identifier, the reader attaches to it. The clock offset then resets as in liblsl (src/time_receiver.cpp:212-218), and the probes go to the new service port (src/time_receiver.cpp:26-33). If only the watchdog fires and the old stream is still visible, the reader keeps the open socket, as liblsl does (src/inlet_connection.cpp:186-188). Two live tests use a loopback proxy and a restarted outlet.
Before, a consumer connection with `Max-Chunk-Length` 0 wrote each sample with its own socket write. With a chunk length above 0, a partial chunk waited up to 200 ms for an idle timeout. liblsl writes when a sample carries the push-through flag, or when the count reaches the chunk size (src/tcp_server.cpp:782). A chunk length of 0 means no limit (src/tcp_server.cpp:749-753). Each push call sets the flag on its last sample by default (src/stream_outlet_impl.h:208-209). Now the samples of one push call go into each consumer queue with one lock. The writer takes all samples that wait. It writes when the count reaches the chunk size, or when the queue is empty. An empty queue acts as the push-through flag, so no sample waits for a later push. `Outlet::push_samples` sends a block with one timestamp for each sample. `push_chunk` and the chunk calls of the C API use it. `push_chunk_fast` is now the same call as `push_chunk`. A blocking outlet writes a chunk with one write for each consumer. The C API reads no pushthrough argument, as before. A push with the flag off therefore does not hold samples back.
Before, the reader removed the bytes of each decoded sample from the front of its buffer. On a full 64 KB read, that costs time in proportion to the square of the buffer size. The reader also took the queue lock and woke the consumer once for each sample. Now `decode_buffered` decodes every whole sample of a read and moves the rest of the buffer once. `SampleQueue::push_owned` then moves the samples into the queue with one lock and no copy. A measurement on this machine decoded 1 MB of 8-channel float32 samples in 64 KB reads. The old loop took 58-66 ms. The new loop took 5 ms. The decoder still allocates one `Vec<Value>` for each sample. The type `Sample` is public, so this change keeps it.
Before, a query socket always used a TTL of 1. A query of the site scope or a wider scope therefore did not pass a router. liblsl sets the TTL of its query socket from the configuration (src/resolve_attempt_udp.cpp:45). This resolver now does the same, for IPv4 and IPv6.
Clippy rejects an enum with one large variant and two empty variants. The box keeps the result small.
If the reset ran first, a burst to the old service port could publish after the reset. The epoch test now runs against the new target first. A live test moves the probes from one outlet to a second outlet. The test fails when the retarget does nothing.
This was referenced Nov 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This branch corrects four network faults and one smaller fault. Each fix has a test. The reference is liblsl at
conformance/liblsl/(e651023c).clock::FIRST_OFFSET_TIMEOUT) for the first offset, as liblsltime_correction(5)does. The post-processor never sees a zero offset first.ClockState::retarget) and the offset resets (ClockState::reset_offset), as insrc/time_receiver.cpp:26-33, 212-218.Max-Chunk-Length(0 = no limit). NewOutlet::push_samples. The C API chunk calls use it.SampleQueue::push_owned). Measured: 1 MB of 8-channel data decodes in 5 ms (was 58-66 ms). 64-channel: 3.7 ms (was 11 ms).multicast_ttlof the configuration, assrc/resolve_attempt_udp.cpp:45does.Deliberate differences from liblsl
timeout_error. labstream gives the samples with the last offset (0 if none). A firstpullwith clock sync can take longer than its timeout.pushthroughflag. The C API ignores thepushthroughargument.Not in this branch
Vec<Value>allocation. A fix needs an API change.Tests
clippy -D warnings,doc -D warnings, full workspace tests. All pass.tests/recover_live.rs(a proxy cuts the connection; a restarted outlet),tests/clock_live.rs(retarget). The proxy test fails onmainafter 10 s and passes here in about 0.05 s.main: plain,--zero-stamps,--desc,--postproc 728/28.--chunk 1626/28 and--sync24/28: liblsl itself refuses the failing string cells. selftest, refuse100, pylsl_check 5/5 and examples pass.Before release (v0.1.3)
conformance/oracle/labrecorder.sh(reconnect and TTL changes).docs/releasing.md.🤖 Generated with Claude Code