sccn / liblsl

C++ lsl library for multi-modal time-synched data transmission over the local network

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[REQ] Optionally prevent send buffer overflow

cboulay opened this issue · comments

Context:

I am playing back an XDF file through LSL to test my online pipelines. I would like to push data through the LSL Outlet(s) as fast as possible but not faster than my inlet(s) can handle. Instead of manually tuning my playback rate for every different scenario, I thought it would be cool if the playback could self-regulate.
I think I can use the stream's buffer duration (from 6 minutes to ~5 seconds) and the inlet's pull_chunk size as my arguments to control buffer size and chunk size. What I don't have currently is the ability to prevent overflowing the send buffer.

Brainstorm:

  • Create a new outlet method that returns fill fraction of each buffer; on each send check all buffers and only send when all are < 90% full.
  • Finally finish off that synchronous push branch and have the push function block until the send buffer has room.

Any other ideas?