Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RTSP client in android

I am writing a RTSP client in Android. I am able to receive the Responses for all the requests i.e.,

  1. DESCRIBE it sends back the 200 OK
  2. SETUP with transport: RTP/AVP:unicast:client_port=4568:4569 got the 200 OK Message back
  3. Sent PLAY, and got the OK Message

After that how to get the audio and video frames?

I have searched on blogs, but all say to listen at client_port but I am not receiving any packets.

Please let me know am I doing correctly.

like image 248
Vinay Avatar asked Jul 29 '09 16:07

Vinay


3 Answers

You may or may not know this, but Android has built in support for RTSP using the VideoView.

http://developer.android.com/reference/android/widget/VideoView.html

This may cut down on your development time...or it may be totally useless if you're trying to roll your own RTSP stack.

like image 77
haseman Avatar answered Nov 01 '22 06:11

haseman


RTSP is only used to start the streaming. It gives you an SDP description of the real streams. You have to manage an RTCP connection and a RTP connection per channel (audio / video). The ports to use are the "client_port" ones.

It is pretty complex to code a RTSP/RTCP/RTP stack from scratch. You can have a look at the live555 library that implement such a stack in c++.

like image 3
neuro Avatar answered Nov 01 '22 06:11

neuro


Put a sniffer on the network, you should see UDP packet with destination port 4568 targeted at your IP address.

With a decent sniffer, you will be able to see the rtsp dialog. Maybe you are missing something in the answers

You should also check the content of the SETUP response, to see if the port you requested were accepted.

Things to check :

  • Listening in UDP.
  • Firewall rules.
  • Range of the play request : Don't specify any to be sure the server will be playing something.

If you are behind a router or firewall, you probably won't receive anything, because your router / firewall don't know what to do with incoming UDP packets

like image 1
shodanex Avatar answered Nov 01 '22 08:11

shodanex