Link to home
Start Free TrialLog in
Avatar of mte01
mte01Flag for Lebanon

asked on

RTSP Server & Client Source Code

Hey experts,

  I couldn't find on the internet any open source code that demonstrates a simple RTSP Server & Client communication...(I need it to be Windows compliant)....any help on some available code??
ASKER CERTIFIED SOLUTION
Avatar of sunnycoder
sunnycoder
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mte01

ASKER

>>sunnycoder

Note that I should only do the following 4 commands:

SETUP
•      If the client state is INIT (see state diagram below), create a UDP socket for receiving RTP data (different from the RTSP socket), set the timeout on the socket to 5 milliseconds (this value can be changed if necessary, requires justification), and change the state to READY.
•      Send SETUP request to the RTSP server. You will need to insert the Transport header in which you specify the port for the RTP data socket you just created (make sure to select an unused port number).
•      Read reply from RTSP server (the reply for a successful server response should be 200) and parse the Session header in the response to get the session ID (the session ID can be selected arbitrarily).

PLAY
•      If the client state is READY, send PLAY request after increasing the RTSP sequence number by one and changing the client state to PLAYING. You must insert the Session header and use the session ID returned in the SETUP response. You must not put the Transport header in this request.
•      Read server's response.
•      The received RTP packets at the client must be de-packetized and displayed as done in Task I. The frames should be displayed within the developed GUI. You need to take care of the timers including your code processing time in order to achieve normal speed for the display of the consecutive video frames.  

PAUSE
•      If client state is PLAYING, send PAUSE request after increasing the RTSP sequence number by one and changing the state to READY. You must insert the Session header and use the session ID returned in the SETUP response. You must not put the Transport header in this request.
•      Read server's response.

TEARDOWN
•      Send TEARDOWN request after increasing the RTSP sequence number by one. You must insert the Session header and use the session ID returned in the SETUP response. You must not put the Transport header in this request.
•      Read server's response.

*********************************************************************************

What is easier to start from an echo client/server using UDP sockets (in C++), or start from one of the links that you provided??
If this is a course assignment, I would recommend :
start from an echo client/server using UDP sockets

1. You will get to learn a lot

2. though it is easier to cut down code (which you might have to do if you choose one of the links above), still you will need to develop a thorough understanding of the code to be able to make any modifications at all ... The amount of effort you would be spending in trying to gain an understanding of the whole code would be better utilized in building your own code and understanding.

It might take you little longer than using existing code, but it s worth the time spent.
Avatar of mte01

ASKER

>>sunnycoder

Yes, I thought so....my only problem is that I have to create two sockets: one for RTSP & one for RTP......I am thinking of using the existing UDP one for the echo client as an RTP socket.....but I have to do a new one as an RTSP socket (and I don't know if different properties should be set..different from the RTP one). Note that I have all the code that does the packetization/de-packetization.....I have done that on a simulated UDP socket (a matlab code that takes a file whose parts should conform to RTP packets, and shuffles these packets, and generates an output file, the one that should be received at the client), and I already have a client reading packets every 500 milliseconds from this file to display an MJPEG movie, so I guess I only need a code that estblishes an RTSP session without anything else to do the rest of the 4 commands.....any help on that??
>(and I don't know if different properties should be set..different from the RTP one).
Typically RTSP is the controlling channel for RTP (or any other transport protocol) .. Commands travelling over your RTSP connection will control your RTP stream. Not sure which properties are you refering to here!!!

>I only need a code that estblishes an RTSP session without anything else to do the rest of the 4 commands
As I said above, it will be linked with your RTP stream
http://www.ietf.org/rfc/rfc2326.txt
http://www.ietf.org/rfc/rfc1889.txt

I did an RTSP streaming client using RTP as one of my early projects .. looks daunting but is not that hard .. all you need is to get started .. read the RFCs first .. they are invaluable to gain an insight into what the components are and how they fit together ... Once you have a clear picture, implementing it is not very hard.
> read the RFCs first
Dont let the length of those documents discourage you .. you dont need to know them inside out .. just enough to gain a clear overall picture.
Avatar of mte01

ASKER

>>sunnycoder

Can you please help in this question: http:Q_21858301.html