Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core] Fixed MAVG msRcvBuf and msSndBuf #1289

Merged
merged 3 commits into from
May 27, 2020

Conversation

maxsharabayko
Copy link
Collaborator

There was a mistake in the calculation of the moving average values of msRcvBuf and msSndBuf.

Note. Initial values of m_iCountMAvg, m_iBytesCountMAvg and m_TimespanMAvg are zero.
It means, at the start, the update will be:

m_iCountMAvg      = (int)((0 + (count * elapsed_ms)) / 1000);

Probably better to initialize with -1 and set the initial value to the instant value.
@mbakholdina What do you think?

Fixes #1272

Co-authored-by: Maria Sharabayko <msharabayko@haivision.com>
@maxsharabayko maxsharabayko added Type: Bug Indicates an unexpected problem or unintended behavior [core] Area: Changes in SRT library core labels May 14, 2020
@maxsharabayko maxsharabayko added this to the v1.5.0 milestone May 14, 2020
@maxsharabayko maxsharabayko requested a review from mbakholdina May 14, 2020 12:55
@maxsharabayko
Copy link
Collaborator Author

Added handling of initial zero values.
Maybe makes sense to have m_iCountMAvg and m_iBytesCountMAvg of type uint64_t instead of int. @ethouris What do you think?

@maxsharabayko maxsharabayko marked this pull request as ready for review May 26, 2020 07:57
@maxsharabayko maxsharabayko requested a review from ethouris May 26, 2020 07:57
@maxsharabayko
Copy link
Collaborator Author

Maybe makes sense to have m_iCountMAvg and m_iBytesCountMAvg of type uint64_t instead of int.

Looks like int is ok-ish. m_iAckedBytesCount represents the current state of the buffer, not the accumulated count of all the bytes ever acknowledged.
In this aspect, int is more or less ok.

@maxsharabayko maxsharabayko merged commit 3979f83 into Haivision:master May 27, 2020
@maxsharabayko maxsharabayko deleted the hotfix/mavg-avg-stats branch May 27, 2020 08:54
@mbakholdina mbakholdina modified the milestones: v1.5.0, v1.4.2 Oct 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[core] Area: Changes in SRT library core Type: Bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Statistics always return instantaneous value for send and recv buffers
3 participants