Fix #438 by accounting for the fact that only half of the buffer of a continuous flow is readable at any one point in time#443
Conversation
pedro-alves-ferreira
left a comment
There was a problem hiding this comment.
Thanks for fixing this. LGTM, with one comment.
| auto const sampleRate = parser.getGrainRate(); | ||
| // Compute the grain count based on our configured history duration | ||
| auto const bufferLength = _historyDuration * sampleRate.numerator / (1'000'000'000ULL * sampleRate.denominator); | ||
| auto const bufferLength = _historyDuration * sampleRate.numerator / (500'000'000ULL * sampleRate.denominator); |
There was a problem hiding this comment.
I would add a comment to make it clearer. Something like: "The denominator is multiplied by 500M, rather than 1B, so that the buffer length is twice as large as the history duration."
There was a problem hiding this comment.
Fair point, I added an explanatory comment.
… continuous flow is readable at any one point in time. Signed-off-by: Kimon Hoffmann <Kimon.Hoffmann@lawo.com>
d817026 to
0d5b266
Compare
|
@KimonHoffmann could you add the unit test that was attached to the bug report? that would validate your fix |
Unfortunately not, because it lacks a DCO signoff and does not follow the practices of our unit tests (it has intermittent console output, for example). I can try to attach a clean room test instead. |
|
Hi, Serge from GV here, I'm the one who reported the problem to Vincent Trussart. This is not an acceptable fix, I tried it with the unit test I wrote that reproduces the issue, still not fixed. Doubling the history will make the size match the video and anc duration but for an audio only configuration the returned size is invalid since only half of it is usable. That makes the test fail. |
You mean that only half of We can consider how to improve the UX on this, I'm not really in favor of having the physical buffer length diverge from |
|
My point is mainly that a flow writer and reader user need to know exactly how much data a flow can hold and when it is outside the range. This fixes the continuous buffer duration not matching the discrete flow, I'm ok with this. However we still need to provide a way for a continuous user to know the exact history duration. I just find it awkward that I have to divide by 2 the bufferLength given by the mxlContinuousFlowConfigInfo, we need a cleaner way, maybe inline function will do the work. The fact that mxlFlowConfigInfo is a union of the two types of config makes you think it returns a similar information about the buffer duration, I'm pretty sure more will do the same mistake and not divide the bufferLength by two. At least flowinfo.h header should be updated to explain this for mxlContinuousFlowConfigInfo. |
|
Yes, I agree that the UX as it is right now is error prone. |
The configured history duration is used to determine the buffer size, but before this change this failed to account for the fact that only half of the buffer is readable at any one point in time, effectively halving the history duration for all continuous flows.