open-ephys-plugins / ephys-socket

A simple TCP client for receiving raw matrix data
1 stars 8 forks source link

Connection without streaming causes upstream source to block #12

Open jonnew opened 3 weeks ago

jonnew commented 3 weeks ago

In the context of using this with Bonsai, if the ephys socket connects, but play is not pressed it will cause the upstream socket to block which can be a big issue for high bandwidth data sources. Data accumulates causes freezes, etc.

bparks13 commented 2 weeks ago

This is somewhat related to issue-10 that I created a while ago, where there is a possibility of losing data if the stream is connected, but data is not acquired. The solution posted there is that the socket connection can be tested but not fully established until acquisition actually starts. This should fix the issue on the Bonsai side, since it will only cause buffering issues if the connection is fully established due to a buffer becoming full.

Another possible solution is to have a thread start running in the OE GUI while acquisition is not active that constantly reads, and then promptly throws away, incoming data until acquisition is actually started. This would ensure that the buffer is not filled, so there are no more issues in Bonsai, but guarantees that data will be lost because it will be read and then ignored. This poses some issues though, since this empty reading thread would always need to be started after acquisition is stopped to ensure that no stuttering occurs in Bonsai