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

TSBPD logic extracted from CRcvBuffer. #1968

Merged

Conversation

maxsharabayko
Copy link
Collaborator

Extracted refactoring around CRcvBuffer and TSBPD logic from PR #1965. No functional changes are expected.
The new CTsbpdTime class is now to operate with TSBPD timing.

Refactoring, no functional changes are expected.
New CTsbpdTime class to operate with TSBPD timing.
@maxsharabayko maxsharabayko added Type: Maintenance Work required to maintain or clean up the code [core] Area: Changes in SRT library core labels Apr 27, 2021
@maxsharabayko maxsharabayko added this to the v1.4.4 milestone Apr 27, 2021
@maxsharabayko maxsharabayko self-assigned this Apr 27, 2021
srtcore/tsbpd_time.h Outdated Show resolved Hide resolved
srtcore/tsbpd_time.h Outdated Show resolved Hide resolved
srtcore/tsbpd_time.h Outdated Show resolved Hide resolved
srtcore/tsbpd_time.h Outdated Show resolved Hide resolved
maxsharabayko and others added 2 commits April 27, 2021 16:49
Co-authored-by: stevomatthews <smatthews@haivision.com>
@maxsharabayko maxsharabayko marked this pull request as ready for review April 27, 2021 14:56
srtcore/tsbpd_time.h Outdated Show resolved Hide resolved
srtcore/tsbpd_time.h Outdated Show resolved Hide resolved
srtcore/tsbpd_time.h Outdated Show resolved Hide resolved
srtcore/tsbpd_time.h Outdated Show resolved Hide resolved
srtcore/tsbpd_time.h Outdated Show resolved Hide resolved
Comment on lines 85 to 86
/// @brief Get TSBPD base time considering possible carryover
/// when packet timestamp is overflown and continues from 0.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure what you mean here. Does this function get the TSBPD base time value in order to compare with the timestamp for a packet to see if it has exceeded the wrap value (and therefore should be re-evaluated to continue from 0 as it should)?

Also, is this inversion in function names intentional?
time_point getPktTsbPdBaseTime(uint32_t usPktTimestamp) const;
time_point getTsbPdTimeBase(uint32_t usPktTimestamp) const;

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@stevomatthews This naming is something that also looks confusing to me and I would love to improve,

Let us say that Packet TSBPD time is the time when a packet can be extracted from the receiver buffer.
Essentially, it consists of usPktTsbpdTime = usTsbpdTimeBase + usPktTimeStamp + usTsbpdDelay + usDrift,
where usTsbpdTimeBase takes possible packet timestamp carryover into account.

Then:

  • getTsbPdTimeBase(uint32_t usPktTimestamp) returns usTsbpdTimeBase for a packet (with possible carryover).
  • getPktTsbPdBaseTime(uint32_t usPktTimestamp) returns usTsbpdTimeBase + usPktTimeStamp.
  • getPktTsbPdTime(uint32_t usPktTimestamp) returns usTsbpdTimeBase + usPktTimeStamp + usTsbpdDelay + usDrift.

srtcore/tsbpd_time.h Outdated Show resolved Hide resolved
srtcore/tsbpd_time.h Outdated Show resolved Hide resolved
srtcore/tsbpd_time.h Outdated Show resolved Hide resolved
srtcore/tsbpd_time.h Outdated Show resolved Hide resolved
srtcore/tsbpd_time.h Outdated Show resolved Hide resolved
srtcore/tsbpd_time.h Outdated Show resolved Hide resolved
Copy link
Collaborator

@stevomatthews stevomatthews left a comment

Choose a reason for hiding this comment

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

Minor edits to tsbpd_time.h

srtcore/tsbpd_time.h Outdated Show resolved Hide resolved
srtcore/tsbpd_time.h Outdated Show resolved Hide resolved
srtcore/tsbpd_time.h Outdated Show resolved Hide resolved
Copy link
Collaborator

@stevomatthews stevomatthews left a comment

Choose a reason for hiding this comment

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

@returns --> @return in tsbpd_time.h

maxsharabayko and others added 2 commits April 28, 2021 08:56
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.

2 participants