Haivision / srt

Secure, Reliable, Transport
https://www.srtalliance.org
Mozilla Public License 2.0
3.11k stars 851 forks source link

stransmit overview and examples #10

Closed SKIPADoDev closed 6 years ago

SKIPADoDev commented 7 years ago

Congratulations on the new SRT alliance.

I compiled the source on Ubuntu 16.04 LTS. And got stransmit to do something:

# stransmit -kv udp://0.0.0.0:9110 udp://localhost:9120
# netstat -na | grep 9110
udp        0      0 0.0.0.0:9110            0.0.0.0:* 

But it does not LISTEN or accept udp or SRT connections I read stransmit.cpp but I need help with URI Args I think

I want to listen for and accept TS/SRT connections and pipe them to TS/UDP.
In other words, terminate an SRT tunnel on a remote server.

Can you please provide an over view of the functionality and some command line examples.

Thanks for any help

matiaspl commented 7 years ago

I've been experimenting today too, and according to the README you should be doing:

on the transmitter: stransmit udp://0.0.0.0:9110 srt://localhost:1234/?mode=server
and on the receiver: stransmit srt://localhost:1234/?mode=client udp://localhost:9120

This got me to the point where some packets were passed along the SRT link, but I had to do some other stuff and in the end didn't check if the data was any good.

matiaspl commented 7 years ago

It works fine. My testbed for video streaming looks like this:

PC1 (VLC first instance: UDP out :9000) SERVER1 (stransmit: UDP :9000, SRT server mode out :1234) ./stransmit udp://srv1_ip:9000 srt://srv1_ip:1234/?mode=server

SERVER2 (stransmit: SRT client mode in :1234, UDP out :9001) ./stransmit srt://srv1_ip:1234/?mode=client udp://pc1_ip:9001 | PC1 (VLC second instance: UDP in :9001)

Add -s:5000 -r:5000 for additional connection info every 5 seconds.

SKIPADoDev commented 7 years ago

@matiaspl thank you for your tests and the proper syntax. your configuration does indeed work for 2 stransmit instances stransmit_out:srt://?mode=server => stransmit_in:srt://?mode=client

But this doesn't work when the transmitter is an actual Haivision encoder streaming TS over SRT. makito_out:srt://?mode=caller => stransmit_in:srt://?mode=client the encoder sends endless connection packets to the receiver and the stransmit receiver times out after 3 seconds just as if there were no stransmit transmitter.

matiaspl commented 7 years ago

I never worked with Makito, but shouldn't this be: makito_out:srt://?mode=caller => stransmit_in:srt://?mode=server ?

SKIPADoDev commented 7 years ago

Thanks, that works!
but is confusing because in your example the 1234 output/transmitter is mode server and the input/receiver is mode client. udp:9000 => srt://srv1_ip:1234/?mode=server => srt://srv1_ip:1234/?mode=client =>udp:9001 And this worked for me too...

SKIPADoDev commented 7 years ago

oh, it does make sense. server-client just means who is doing the listening and who is connecting, not who is sending or receiving. I was thinking only in upload mode: encoder => server and the example is in download mode: server => player.
Thanks again for the help.

dgepstein commented 7 years ago

Right. In Haivision's product implementation, "Caller Mode" is the client initiating the session, "Listener Mode" is the server opening a socket and receiving connections. "Rendezvous Mode" is a firewall traversal mode where both sides attempt to connect to the other simultaneously using the same source and destination ports in the hope that intermediary firewalls will allow bidirectional UDP traffic on the assumption that the origin of the "session" was from the trusted to the untrusted network. This works in situations where the firewall has engaged some sort of UDP session fixup mode and where the firewall is not engaging in packet mangeling and randomizing source ports.

Note that because, as identified above, the content direction is independent of session negotiation, it is possible to use an intermediary SRT enabled device to listen for connnections from both sides and bridge between networks, allowing both endpoints to operate as callers. This is useful in cases where both endpoints are behind NATing firewalls or where it is desiarable to only allow UDP traffic through a security boundary from a trusted host.

SKIPADoDev commented 7 years ago

Thanks dgepstein for clarifying the different modes. I can imagine many possible architectures for SRT/UDP routing now.

AdamYellen commented 6 years ago

Documentation for stransmit has been added to the docs directory.