Enable server to stream over an indirect connection

Topics: Question, Suggestion
Jun 15, 2016 at 12:11 AM
Edited Jun 15, 2016 at 12:11 AM
Can the RTSP server work over an existing connection?

Imagine the following scenario:

a) Alice (using COMPUTER1) has a WinForm program that is already connected to COMPUTER2 over the internet (COMPUTER2 has a direct, public facing IP)
b) Alice connects to COMPUTER2 through a known port (CONNECTION1) and the connection is open all the time
c) COMPUTER2, given an event, sends a request over CONNECTION1 so Alice can start a new connection to a random port given by COMPUTER2, i.e., CONNECTION2
d) Alice starts a new socket connection to COMPUTER2. This is is now CONNECTION2.
e) Alice starts streaming (RTSP) using this CONNECTION2.

This will be used when:

f) Now Bob, using his web browser, wants to watch the live streaming Alice is doing. He clicks on her name and a new screen is opened (steps c through e). If a connection is already in place, he should also be able to watch the live stream.
g) this new screen access a particular link that in this case is routed to a service that can RELAY the live stream Alice is doing.
h) Ted might also be able to watch the live cast using the same link.

Now my question is: can the RTSP server work or be modified in a way that it uses an already existing connection?

Would I be able to do this streaming the way I want to?
Coordinator
Jun 15, 2016 at 9:52 PM
Sorry for the delay, just getting the time to look into this and respond...

You want to setup something like a 'Proxy Server' I imagine.

Let Lan = 192.168.1.0/24 (192.168.1.0 - 192.168.1.255)
Let Router = 192.168.1.1

Any Lan end point can reach Internet through Router.

Correct?

You could technically just use the RtspClient on the Lan to submit a Rtsp request to the Internet and start an Rtsp Interleaved session which will be able to be sent back to the Lan....

Where the proxy terminology comes in, if I am understanding you correctly is that you want add a special Lan component e.g. Router with the ability to communicate to the Internet.

No other IP on Lan besides Router would be able to access the Internet in such a case, Correct?

So you would need an RtspServer instance which can access the internet or at least the network where the streams are running.

You would thus like to make a Rtsp request to the RtspServer from the Lan and the RtspServer would SETUP the stream requested, this can be done via Announce with password protection or via a myriad of other ways depending on how you want it to work.

What is essential is that you make a RtspRequest from the Lan, receive it on the RtspServer, choose how to handle it and proceed.

Once this is complete the RtspServer can now be used to playback the stream from the Lan to any client on the Lan or outside the Lan without making another connection outside of the Lan to consume the stream.

So,

Ted makes a request to the RtspServer.
ANNOUNCE rtsp://someoutsideServerName/path/etc
CSeq: 1
Authorization:Basic:sdadasdsa
The RtpServer sees this request and decides if it wants to handle it.

If the credentials were okay and the method is supported on the RtspServer, the RtspServer would then create a RtspSource @ 'rtsp://someoutsideServerName/path/etc' and return a response which indicates success, if the stream was already playing or setup then an appropriate response would be returned.
RTSP/1.0 OK
CSeq: 1
Content-Type:application/sdp
Content-Length: X
<sdp of length X>
Ted would then issue a SETUP and PLAY request to the RtspServer, by default the RtspServer makes a unique ID for each source it creates and the source is accessible from that ID via Uri, a name could also be given but would require a SessionDescription to be sent to the RtspServer with the name attribute filled out by Ted initially e.g.

's=GiveTheStreamThisName'

should appear in the body of the ANNOUNCE he sends to the RtspServer.
SETUP rtsp://<sdp control uri>
CSeq: 2
Authorization:Basic:sdadasdsa

RTSP/1.0 OK
CSeq: 2
...

PLAY rtsp://<sdp control uri>
CSeq: 3
Authorization:Basic:sdadasdsa
...

RTSP/1.0 OK
CSeq: 3
Bob can then also perform the same SETUP and PLAY at any point after the 'ANNOUNCE' has succeeded from the RtspServer...
SETUP rtsp://<sdp control uri>
CSeq: 2
Authorization:Basic:sdadasdsa

RTSP/1.0 OK
CSeq: 2
...

DESCRIBE rtsp://<sdp control uri>
CSeq: 1
Authorization:Basic:sdadasdsa

RTSP/1.0 OK
CSeq: 1
Content-Type:application/sdp
Content-Length: X
<sdp of length X>

SETUP rtsp://<sdp control uri>
CSeq: 2
Authorization:Basic:sdadasdsa
...

RTSP/1.0 OK
CSeq: 2
...

PLAY rtsp://<sdp control uri>
CSeq: 3
Authorization:Basic:sdadasdsa
...

RTSP/1.0 OK
CSeq: 3
That should be all of what your looking for....

Yes, you can inter operate with Live555 and their proxies but my RtspClient will NOT send the "REGISTER" request and the RtspServer will not honor it.

Ever.

well... maybe not ever... but.... probably, likely, and honestly not if I could ever help it.

With that being typed, if I can provide you any further assistance or clarify my response in any way just let me know!
Marked as answer by juliusfriedman on 6/15/2016 at 1:52 PM