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] Utilize all insert results of the new recv buffer. #2535

Closed
wants to merge 7 commits into from

Conversation

gou4shi1
Copy link
Contributor

@gou4shi1 gou4shi1 commented Nov 12, 2022

As https://github.com/Haivision/srt/pull/2530/files#r1020280948 said.
This PR decouples handleSocketPacketReception() from getAvailRcvBufferSizeNoLock().
The "no room" condition now only relies on the recv buffer itself.

@codecov-commenter

This comment was marked as off-topic.

@ethouris
Copy link
Collaborator

Would you be able to make it more "friendly" against changes in #2527?

@maxsharabayko maxsharabayko added Type: Maintenance Work required to maintain or clean up the code [core] Area: Changes in SRT library core labels Nov 14, 2022
@maxsharabayko maxsharabayko added this to the v1.6.0 milestone Nov 14, 2022
@gou4shi1
Copy link
Contributor Author

Would you be able to make it more "friendly" against changes in #2527?

Did you mean to introduce CRcvBuffer::InsertInfo in this PR?

@ethouris
Copy link
Collaborator

I'm not exactly convinced about adding this parameter so that it can be better displayed in logs. As for this, might be a better idea to instead move the whole log into the receiver buffer internals. In that PR the discrepancy is also detected on the level of insert() call, and it is also reported to the caller - not that the caller recognizes this by checking the range of the returned value.

@gou4shi1
Copy link
Contributor Author

gou4shi1 commented Nov 14, 2022

move the whole log into the receiver buffer internals

I'm OK for this, but I don't want to change too much codes at once to keep a single PR small.

@ethouris
Copy link
Collaborator

I understand, but if you provide changes that will make them harder to merge with my PR, it will be counter-productive. If this value is only used in logs, it should be able to be taken as before. Important would be if this value is to be used for some checks involved in the overall functionality.

@ethouris
Copy link
Collaborator

You might consider borrowing the definition of CRcvBuffer::size(), which decreased from capacity() should give you the size of the remaining space in the buffer. If executed in the RcvQ:worker thread, it should even be unracy.

Copy link
Collaborator

@maxsharabayko maxsharabayko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might make sense to declare an enum of the return values of the CRcvBuffer::insert(..) function.

enum {
    RBUF_INSERT_RES_OK = 0,
    RBUF_INSERT_RES_DUP = -1, // Duplicated (redundant).
    RBUF_INSERT_RES_BALETED = -2,
    RBUF_INSERT_RES_NO_ROOM = -3,
};

srtcore/core.cpp Outdated Show resolved Hide resolved
srtcore/core.cpp Outdated Show resolved Hide resolved
srtcore/core.cpp Outdated Show resolved Hide resolved
@ethouris
Copy link
Collaborator

In #2527 there's something kinda better. There is an enum and localized to the buffer class.

@gou4shi1
Copy link
Contributor Author

Might make sense to declare an enum of the return values of the CRcvBuffer::insert(..) function.

In #2527 there's something kinda better. There is an enum and localized to the buffer class.

So to reduce conflicts, I would not do this in this PR. I will address other comments tomorrow.

@gou4shi1
Copy link
Contributor Author

gou4shi1 commented Nov 29, 2022

Close due to #2546 has already removed getAvailRcvBufferSizeNoLock() from handleSocketPacketReception() and to avoid conflicts with #2527

@gou4shi1 gou4shi1 closed this Nov 29, 2022
@maxsharabayko
Copy link
Collaborator

@gou4shi1 Thank you for the PR anyway! These changes are to come one day. :)

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: Maintenance Work required to maintain or clean up the code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants