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] Added SRT_SYNC_CLOCK_TYPE preprocessor definition #1885

Merged
merged 5 commits into from
Mar 24, 2021

Conversation

maxsharabayko
Copy link
Collaborator

@maxsharabayko maxsharabayko commented Mar 23, 2021

Adds SRT_SYNC_CLOCK_TYPE preprocessor definition in sync.h so that internally SRT can distinguish clock type outside of the sync.h file.
Useful for #1876 to print in the log message the clock type used by SRT.

Partially addresses #1702

TODO

  • TBD separately. API function to get clock type in runtime. Maybe int srt_clock_type()?
  • Not to be done (no need so far)? Include clock type preprocessor definition into srt.h?

@maxsharabayko maxsharabayko added Type: Enhancement Indicates new feature requests [core] Area: Changes in SRT library core labels Mar 23, 2021
@maxsharabayko maxsharabayko added this to the v1.4.3 milestone Mar 23, 2021
@maxsharabayko
Copy link
Collaborator Author

API change proposal to be moved to a separate PR to unblock other changes.

srt.h

enum SRT_SYNC_CLOCK_TYPE
{
    SRT_SYNC_CLOCK_TYPE_STDCXX_STEADY      = 0, // C++11 std::chrono::steady_clock
    SRT_SYNC_CLOCK_TYPE_GETTIME_MONOTONIC  = 1, // clock_gettime with CLOCK_MONOTONIC
    SRT_SYNC_CLOCK_TYPE_WINQPC             = 2,
    SRT_SYNC_CLOCK_TYPE_MACH_ABSTIME       = 3,
    SRT_SYNC_CLOCK_TYPE_POSIX_GETTIMEOFDAY = 4,
    SRT_SYNC_CLOCK_TYPE_AMD64_RDTSC        = 5,
    SRT_SYNC_CLOCK_TYPE_IA32_RDTSC         = 6,
    SRT_SYNC_CLOCK_TYPE_IA64_ITC           = 7
};

SRT_API int srt_clock_type();

srt_c_api.cpp

int srt_clock_type()
{
    return SRT_SYNC_CLOCK;
}

Copy link
Collaborator

@ethouris ethouris left a comment

Choose a reason for hiding this comment

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

Beside these names, everything looks good.

@maxsharabayko maxsharabayko marked this pull request as ready for review March 24, 2021 09:53
@maxsharabayko maxsharabayko merged commit 1d4338a into Haivision:master Mar 24, 2021
@maxsharabayko maxsharabayko deleted the develop/sync_clocktype branch March 24, 2021 10:21
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: Enhancement Indicates new feature requests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants