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

Add support for generic srt socket options set/get. #4325

Merged
merged 6 commits into from
Jan 24, 2025

Conversation

toots
Copy link
Member

@toots toots commented Jan 24, 2025

This PR adds support for generic SRT socket options:

  • All srt socket types used in input.srt and output.srt are now bare bone srt.socket with no method. This decluters the API documentation.
  • srt.socket is added to decorate a SRT socket with its methods
  • A new on_socket callback is introduced that is executed just after setting our default socket options to give the user flexibility to set their own and/or monitor a socket etc.
  • New socket options methods are added.

Here's an example use to set latency on incoming sockets. Please note that this is more tricky than it seems: setting the latency on the incoming socket instead of the listening socket results in a timeout!

def on_socket(~mode, s) =
  if
    mode == "listen"
  then
    s = srt.socket(s)
    print(
      "Setting latency to 20ms on listening socket"
    )
    s.set_latency(20)
  end

  if
    mode == "incoming"
  then
    s = srt.socket(s)
    print(
      "Incoming socket latency: #{s.latency()}ms"
    )
  end
end

input = input.srt(mode="listener", on_socket=on_socket)

Ref: #4256

@toots toots force-pushed the generic-srt-socket-options branch from 6b090ec to f67da78 Compare January 24, 2025 18:34
@toots toots merged commit 3560f33 into main Jan 24, 2025
34 checks passed
@toots toots deleted the generic-srt-socket-options branch January 24, 2025 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant