Count the number of received buffers per timestamp to save 1s latency in `finalsink.py`
We can save a second of latency in Finalsink by changing our clustering strategy.
We receive a buffer per postcoh instance, and there's one per bank, so we get 4 buffers per timestamp. Clustering needs all data for a given window, so currently we need to wait until we've received all 4 buffers.
Counting the number of buffers would require finalsink to know how many buffers to expect. At the moment, it doesn't, so instead it waits for a buffer to arrive for the Next second's timestamp, then processes all data up to that time. Buffers have a 1s window, hence the second of latency we can save.
It shouldn't be difficult to get finalsink to know how many buffers to expect. We have options such as:
- Communicate it through gstreamer, counting the number of pads
- Use a command line argument and pass it through to finalsink
- It may be more correct to use a property on finalsink
- Have finalsink calculate it based on the first received buffers
I think our choice there isn't particularly important. Do the simplest (command line arg?), keep it modular and easy to replace if we reconsider (Hard coding it might be a step too far though.). The important task for this issue is counting the received buffers, and in case something goes wrong, using the current strategy of processing as soon as a buffer is received with a later timestampt than we were expecting.
It's possible that this doesn't gel well with a possible refactor/rework, so I've made it a separate, but related, issue.